typescript 5.1.0-dev.20230324 → 5.1.0-dev.20230325

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-dev.20230324`;
21
+ var version = `${versionMajorMinor}.0-dev.20230325`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5746,7 +5746,6 @@ var Diagnostics = {
5746
5746
  _0_modifier_cannot_appear_on_an_index_signature: diag(1071, 1 /* Error */, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."),
5747
5747
  A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, 1 /* Error */, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
5748
5748
  Invalid_reference_directive_syntax: diag(1084, 1 /* Error */, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
5749
- Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, 1 /* Error */, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
5750
5749
  _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, 1 /* Error */, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
5751
5750
  _0_modifier_cannot_appear_on_a_parameter: diag(1090, 1 /* Error */, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
5752
5751
  Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, 1 /* Error */, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5777,7 +5776,7 @@ var Diagnostics = {
5777
5776
  An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, 1 /* Error */, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."),
5778
5777
  An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, 1 /* Error */, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."),
5779
5778
  An_export_assignment_cannot_have_modifiers: diag(1120, 1 /* Error */, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
5780
- Octal_literals_are_not_allowed_in_strict_mode: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."),
5779
+ Octal_literals_are_not_allowed_Use_the_syntax_0: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_Use_the_syntax_0_1121", "Octal literals are not allowed. Use the syntax '{0}'."),
5781
5780
  Variable_declaration_list_cannot_be_empty: diag(1123, 1 /* Error */, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."),
5782
5781
  Digit_expected: diag(1124, 1 /* Error */, "Digit_expected_1124", "Digit expected."),
5783
5782
  Hexadecimal_digit_expected: diag(1125, 1 /* Error */, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."),
@@ -6088,6 +6087,9 @@ var Diagnostics = {
6088
6087
  _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6089
6088
  _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6090
6089
  Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
6090
+ Octal_escape_sequences_are_not_allowed_Use_the_syntax_0: diag(1487, 1 /* Error */, "Octal_escape_sequences_are_not_allowed_Use_the_syntax_0_1487", "Octal escape sequences are not allowed. Use the syntax '{0}'."),
6091
+ Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."),
6092
+ Decimals_with_leading_zeros_are_not_allowed: diag(1489, 1 /* Error */, "Decimals_with_leading_zeros_are_not_allowed_1489", "Decimals with leading zeros are not allowed."),
6091
6093
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
6092
6094
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
6093
6095
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7428,8 +7430,6 @@ var Diagnostics = {
7428
7430
  Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, 1 /* Error */, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."),
7429
7431
  Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, 1 /* Error */, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."),
7430
7432
  Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, 1 /* Error */, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."),
7431
- Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, 1 /* Error */, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."),
7432
- Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, 1 /* Error */, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."),
7433
7433
  Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
7434
7434
  JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, 1 /* Error */, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."),
7435
7435
  JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, 1 /* Error */, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),
@@ -8411,7 +8411,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8411
8411
  isReservedWord: () => token >= 82 /* FirstReservedWord */ && token <= 117 /* LastReservedWord */,
8412
8412
  isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
8413
8413
  getCommentDirectives: () => commentDirectives,
8414
- getNumericLiteralFlags: () => tokenFlags & 1008 /* NumericLiteralFlags */,
8414
+ getNumericLiteralFlags: () => tokenFlags & 25584 /* NumericLiteralFlags */,
8415
8415
  getTokenFlags: () => tokenFlags,
8416
8416
  reScanGreaterToken,
8417
8417
  reScanAsteriskEqualsToken,
@@ -8452,11 +8452,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8452
8452
  });
8453
8453
  }
8454
8454
  return scanner;
8455
- function error(message, errPos = pos, length3) {
8455
+ function error(message, errPos = pos, length3, arg0) {
8456
8456
  if (onError) {
8457
8457
  const oldPos = pos;
8458
8458
  pos = errPos;
8459
- onError(message, length3 || 0);
8459
+ onError(message, length3 || 0, arg0);
8460
8460
  pos = oldPos;
8461
8461
  }
8462
8462
  }
@@ -8473,10 +8473,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8473
8473
  allowSeparator = false;
8474
8474
  isPreviousTokenSeparator = true;
8475
8475
  result += text.substring(start2, pos);
8476
- } else if (isPreviousTokenSeparator) {
8477
- error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8478
8476
  } else {
8479
- error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8477
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8478
+ if (isPreviousTokenSeparator) {
8479
+ error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8480
+ } else {
8481
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8482
+ }
8480
8483
  }
8481
8484
  pos++;
8482
8485
  start2 = pos;
@@ -8491,13 +8494,39 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8491
8494
  break;
8492
8495
  }
8493
8496
  if (text.charCodeAt(pos - 1) === 95 /* _ */) {
8497
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8494
8498
  error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
8495
8499
  }
8496
8500
  return result + text.substring(start2, pos);
8497
8501
  }
8498
8502
  function scanNumber() {
8499
- const start2 = pos;
8500
- const mainFragment = scanNumberFragment();
8503
+ let start2 = pos;
8504
+ let mainFragment;
8505
+ if (text.charCodeAt(pos) === 48 /* _0 */) {
8506
+ pos++;
8507
+ if (text.charCodeAt(pos) === 95 /* _ */) {
8508
+ tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
8509
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8510
+ pos--;
8511
+ mainFragment = scanNumberFragment();
8512
+ } else if (!scanDigits()) {
8513
+ tokenFlags |= 8192 /* ContainsLeadingZero */;
8514
+ mainFragment = "" + +tokenValue;
8515
+ } else if (!tokenValue) {
8516
+ mainFragment = "0";
8517
+ } else {
8518
+ tokenValue = "" + parseInt(tokenValue, 8);
8519
+ tokenFlags |= 32 /* Octal */;
8520
+ const withMinus = token === 40 /* MinusToken */;
8521
+ const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
8522
+ if (withMinus)
8523
+ start2--;
8524
+ error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
8525
+ return { type: 8 /* NumericLiteral */, value: tokenValue };
8526
+ }
8527
+ } else {
8528
+ mainFragment = scanNumberFragment();
8529
+ }
8501
8530
  let decimalFragment;
8502
8531
  let scientificFragment;
8503
8532
  if (text.charCodeAt(pos) === 46 /* dot */) {
@@ -8531,6 +8560,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8531
8560
  } else {
8532
8561
  result = text.substring(start2, end2);
8533
8562
  }
8563
+ if (tokenFlags & 8192 /* ContainsLeadingZero */) {
8564
+ error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
8565
+ return { type: 8 /* NumericLiteral */, value: "" + +result };
8566
+ }
8534
8567
  if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
8535
8568
  checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */));
8536
8569
  return {
@@ -8562,12 +8595,17 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8562
8595
  pos = identifierStart;
8563
8596
  }
8564
8597
  }
8565
- function scanOctalDigits() {
8598
+ function scanDigits() {
8566
8599
  const start2 = pos;
8567
- while (isOctalDigit(text.charCodeAt(pos))) {
8600
+ let isOctal = true;
8601
+ while (isDigit(text.charCodeAt(pos))) {
8602
+ if (!isOctalDigit(text.charCodeAt(pos))) {
8603
+ isOctal = false;
8604
+ }
8568
8605
  pos++;
8569
8606
  }
8570
- return +text.substring(start2, pos);
8607
+ tokenValue = text.substring(start2, pos);
8608
+ return isOctal;
8571
8609
  }
8572
8610
  function scanExactNumberOfHexDigits(count, canHaveSeparators) {
8573
8611
  const valueString = scanHexDigits(
@@ -8645,7 +8683,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8645
8683
  }
8646
8684
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
8647
8685
  result += text.substring(start2, pos);
8648
- result += scanEscapeSequence();
8686
+ result += scanEscapeSequence(
8687
+ /*shouldEmitInvalidEscapeError*/
8688
+ true
8689
+ );
8649
8690
  start2 = pos;
8650
8691
  continue;
8651
8692
  }
@@ -8659,7 +8700,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8659
8700
  }
8660
8701
  return result;
8661
8702
  }
8662
- function scanTemplateAndSetTokenValue(isTaggedTemplate) {
8703
+ function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
8663
8704
  const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
8664
8705
  pos++;
8665
8706
  let start2 = pos;
@@ -8688,7 +8729,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8688
8729
  }
8689
8730
  if (currChar === 92 /* backslash */) {
8690
8731
  contents += text.substring(start2, pos);
8691
- contents += scanEscapeSequence(isTaggedTemplate);
8732
+ contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8692
8733
  start2 = pos;
8693
8734
  continue;
8694
8735
  }
@@ -8708,7 +8749,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8708
8749
  tokenValue = contents;
8709
8750
  return resultingToken;
8710
8751
  }
8711
- function scanEscapeSequence(isTaggedTemplate) {
8752
+ function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8712
8753
  const start2 = pos;
8713
8754
  pos++;
8714
8755
  if (pos >= end) {
@@ -8719,12 +8760,37 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8719
8760
  pos++;
8720
8761
  switch (ch) {
8721
8762
  case 48 /* _0 */:
8722
- if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) {
8763
+ if (pos >= end || !isDigit(text.charCodeAt(pos))) {
8764
+ return "\0";
8765
+ }
8766
+ case 49 /* _1 */:
8767
+ case 50 /* _2 */:
8768
+ case 51 /* _3 */:
8769
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8770
+ pos++;
8771
+ }
8772
+ case 52 /* _4 */:
8773
+ case 53 /* _5 */:
8774
+ case 54 /* _6 */:
8775
+ case 55 /* _7 */:
8776
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8723
8777
  pos++;
8724
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8725
- return text.substring(start2, pos);
8726
8778
  }
8727
- return "\0";
8779
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8780
+ if (shouldEmitInvalidEscapeError) {
8781
+ const code = parseInt(text.substring(start2 + 1, pos), 8);
8782
+ error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
8783
+ return String.fromCharCode(code);
8784
+ }
8785
+ return text.substring(start2, pos);
8786
+ case 56 /* _8 */:
8787
+ case 57 /* _9 */:
8788
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8789
+ if (shouldEmitInvalidEscapeError) {
8790
+ error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8791
+ return String.fromCharCode(ch);
8792
+ }
8793
+ return text.substring(start2, pos);
8728
8794
  case 98 /* b */:
8729
8795
  return "\b";
8730
8796
  case 116 /* t */:
@@ -8742,59 +8808,69 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8742
8808
  case 34 /* doubleQuote */:
8743
8809
  return '"';
8744
8810
  case 117 /* u */:
8745
- if (isTaggedTemplate) {
8746
- for (let escapePos = pos; escapePos < pos + 4; escapePos++) {
8747
- if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* openBrace */) {
8748
- pos = escapePos;
8749
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8750
- return text.substring(start2, pos);
8751
- }
8752
- }
8753
- }
8754
8811
  if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8755
8812
  pos++;
8756
- if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) {
8813
+ const escapedValueString = scanMinimumNumberOfHexDigits(
8814
+ 1,
8815
+ /*canHaveSeparators*/
8816
+ false
8817
+ );
8818
+ const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8819
+ if (escapedValue < 0) {
8757
8820
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8821
+ if (shouldEmitInvalidEscapeError) {
8822
+ error(Diagnostics.Hexadecimal_digit_expected);
8823
+ }
8758
8824
  return text.substring(start2, pos);
8759
8825
  }
8760
- if (isTaggedTemplate) {
8761
- const savePos = pos;
8762
- const escapedValueString = scanMinimumNumberOfHexDigits(
8763
- 1,
8764
- /*canHaveSeparators*/
8765
- false
8766
- );
8767
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8768
- if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125 /* closeBrace */) {
8769
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8770
- return text.substring(start2, pos);
8771
- } else {
8772
- pos = savePos;
8826
+ if (!isCodePoint(escapedValue)) {
8827
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8828
+ if (shouldEmitInvalidEscapeError) {
8829
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8773
8830
  }
8831
+ return text.substring(start2, pos);
8832
+ }
8833
+ if (pos >= end) {
8834
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8835
+ if (shouldEmitInvalidEscapeError) {
8836
+ error(Diagnostics.Unexpected_end_of_text);
8837
+ }
8838
+ return text.substring(start2, pos);
8774
8839
  }
8840
+ if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8841
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8842
+ if (shouldEmitInvalidEscapeError) {
8843
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
8844
+ }
8845
+ return text.substring(start2, pos);
8846
+ }
8847
+ pos++;
8775
8848
  tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8776
- return scanExtendedUnicodeEscape();
8849
+ return utf16EncodeAsString(escapedValue);
8777
8850
  }
8778
- tokenFlags |= 1024 /* UnicodeEscape */;
8779
- return scanHexadecimalEscape(
8780
- /*numDigits*/
8781
- 4
8782
- );
8783
- case 120 /* x */:
8784
- if (isTaggedTemplate) {
8785
- if (!isHexDigit(text.charCodeAt(pos))) {
8851
+ for (; pos < start2 + 6; pos++) {
8852
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8786
8853
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8854
+ if (shouldEmitInvalidEscapeError) {
8855
+ error(Diagnostics.Hexadecimal_digit_expected);
8856
+ }
8787
8857
  return text.substring(start2, pos);
8788
- } else if (!isHexDigit(text.charCodeAt(pos + 1))) {
8789
- pos++;
8858
+ }
8859
+ }
8860
+ tokenFlags |= 1024 /* UnicodeEscape */;
8861
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8862
+ case 120 /* x */:
8863
+ for (; pos < start2 + 4; pos++) {
8864
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8790
8865
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8866
+ if (shouldEmitInvalidEscapeError) {
8867
+ error(Diagnostics.Hexadecimal_digit_expected);
8868
+ }
8791
8869
  return text.substring(start2, pos);
8792
8870
  }
8793
8871
  }
8794
- return scanHexadecimalEscape(
8795
- /*numDigits*/
8796
- 2
8797
- );
8872
+ tokenFlags |= 4096 /* HexEscape */;
8873
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8798
8874
  case 13 /* carriageReturn */:
8799
8875
  if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
8800
8876
  pos++;
@@ -8807,19 +8883,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8807
8883
  return String.fromCharCode(ch);
8808
8884
  }
8809
8885
  }
8810
- function scanHexadecimalEscape(numDigits) {
8811
- const escapedValue = scanExactNumberOfHexDigits(
8812
- numDigits,
8813
- /*canHaveSeparators*/
8814
- false
8815
- );
8816
- if (escapedValue >= 0) {
8817
- return String.fromCharCode(escapedValue);
8818
- } else {
8819
- error(Diagnostics.Hexadecimal_digit_expected);
8820
- return "";
8821
- }
8822
- }
8823
8886
  function scanExtendedUnicodeEscape() {
8824
8887
  const escapedValueString = scanMinimumNumberOfHexDigits(
8825
8888
  1,
@@ -9048,7 +9111,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9048
9111
  return token = 10 /* StringLiteral */;
9049
9112
  case 96 /* backtick */:
9050
9113
  return token = scanTemplateAndSetTokenValue(
9051
- /*isTaggedTemplate*/
9114
+ /*shouldEmitInvalidEscapeError*/
9052
9115
  false
9053
9116
  );
9054
9117
  case 37 /* percent */:
@@ -9223,11 +9286,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9223
9286
  tokenFlags |= 256 /* OctalSpecifier */;
9224
9287
  return token = checkBigIntSuffix();
9225
9288
  }
9226
- if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
9227
- tokenValue = "" + scanOctalDigits();
9228
- tokenFlags |= 32 /* Octal */;
9229
- return token = 8 /* NumericLiteral */;
9230
- }
9231
9289
  case 49 /* _1 */:
9232
9290
  case 50 /* _2 */:
9233
9291
  case 51 /* _3 */:
@@ -9544,14 +9602,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9544
9602
  return void 0;
9545
9603
  }
9546
9604
  function reScanTemplateToken(isTaggedTemplate) {
9547
- Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
9548
9605
  pos = tokenStart;
9549
- return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
9606
+ return token = scanTemplateAndSetTokenValue(!isTaggedTemplate);
9550
9607
  }
9551
9608
  function reScanTemplateHeadOrNoSubstitutionTemplate() {
9552
9609
  pos = tokenStart;
9553
9610
  return token = scanTemplateAndSetTokenValue(
9554
- /*isTaggedTemplate*/
9611
+ /*shouldEmitInvalidEscapeError*/
9555
9612
  true
9556
9613
  );
9557
9614
  }
@@ -12041,8 +12098,13 @@ function canUseOriginalText(node, flags) {
12041
12098
  if (nodeIsSynthesized(node) || !node.parent || flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) {
12042
12099
  return false;
12043
12100
  }
12044
- if (isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12045
- return !!(flags & 8 /* AllowNumericSeparator */);
12101
+ if (isNumericLiteral(node)) {
12102
+ if (node.numericLiteralFlags & 26656 /* IsInvalid */) {
12103
+ return false;
12104
+ }
12105
+ if (node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12106
+ return !!(flags & 8 /* AllowNumericSeparator */);
12107
+ }
12046
12108
  }
12047
12109
  return !isBigIntLiteral(node);
12048
12110
  }
@@ -12558,15 +12620,6 @@ function isPartOfTypeNode(node) {
12558
12620
  }
12559
12621
  return false;
12560
12622
  }
12561
- function isChildOfNodeWithKind(node, kind) {
12562
- while (node) {
12563
- if (node.kind === kind) {
12564
- return true;
12565
- }
12566
- node = node.parent;
12567
- }
12568
- return false;
12569
- }
12570
12623
  function forEachReturnStatement(body, visitor) {
12571
12624
  return traverse(body);
12572
12625
  function traverse(node) {
@@ -19824,7 +19877,7 @@ function createNodeFactory(flags, baseFactory2) {
19824
19877
  return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node;
19825
19878
  }
19826
19879
  function checkTemplateLiteralLikeNode(kind, text, rawText, templateFlags = 0 /* None */) {
19827
- Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19880
+ Debug.assert(!(templateFlags & ~7176 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19828
19881
  let cooked = void 0;
19829
19882
  if (rawText !== void 0 && rawText !== text) {
19830
19883
  cooked = getCookedText(kind, rawText);
@@ -19853,7 +19906,7 @@ function createNodeFactory(flags, baseFactory2) {
19853
19906
  const node = createBaseToken(kind);
19854
19907
  node.text = text;
19855
19908
  node.rawText = rawText;
19856
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19909
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19857
19910
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19858
19911
  return node;
19859
19912
  }
@@ -19861,7 +19914,7 @@ function createNodeFactory(flags, baseFactory2) {
19861
19914
  const node = createBaseDeclaration(kind);
19862
19915
  node.text = text;
19863
19916
  node.rawText = rawText;
19864
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19917
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19865
19918
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19866
19919
  return node;
19867
19920
  }
@@ -26526,8 +26579,8 @@ var Parser;
26526
26579
  function parseErrorAtRange(range, message, ...args) {
26527
26580
  parseErrorAt(range.pos, range.end, message, ...args);
26528
26581
  }
26529
- function scanError(message, length2) {
26530
- parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
26582
+ function scanError(message, length2, arg0) {
26583
+ parseErrorAtPosition(scanner.getTokenEnd(), length2, message, arg0);
26531
26584
  }
26532
26585
  function getNodePos() {
26533
26586
  return scanner.getTokenFullStart();
@@ -26566,9 +26619,6 @@ var Parser;
26566
26619
  function reScanTemplateToken(isTaggedTemplate) {
26567
26620
  return currentToken = scanner.reScanTemplateToken(isTaggedTemplate);
26568
26621
  }
26569
- function reScanTemplateHeadOrNoSubstitutionTemplate() {
26570
- return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate();
26571
- }
26572
26622
  function reScanLessThanToken() {
26573
26623
  return currentToken = scanner.reScanLessThanToken();
26574
26624
  }
@@ -27640,8 +27690,11 @@ var Parser;
27640
27690
  return parseLiteralLikeNode(token());
27641
27691
  }
27642
27692
  function parseTemplateHead(isTaggedTemplate) {
27643
- if (isTaggedTemplate) {
27644
- reScanTemplateHeadOrNoSubstitutionTemplate();
27693
+ if (!isTaggedTemplate && scanner.getTokenFlags() & 26656 /* IsInvalid */) {
27694
+ reScanTemplateToken(
27695
+ /*isTaggedTemplate*/
27696
+ false
27697
+ );
27645
27698
  }
27646
27699
  const fragment = parseLiteralLikeNode(token());
27647
27700
  Debug.assert(fragment.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
@@ -27659,8 +27712,7 @@ var Parser;
27659
27712
  }
27660
27713
  function parseLiteralLikeNode(kind) {
27661
27714
  const pos = getNodePos();
27662
- const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048 /* TemplateLiteralLikeFlags */) : (
27663
- // Octal literals are not allowed in strict mode or ES5
27715
+ const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 7176 /* TemplateLiteralLikeFlags */) : (
27664
27716
  // Note that theoretically the following condition would hold true literals like 009,
27665
27717
  // which is not octal. But because of how the scanner separates the tokens, we would
27666
27718
  // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
@@ -29716,7 +29768,10 @@ var Parser;
29716
29768
  const tagExpression = factory2.createTaggedTemplateExpression(
29717
29769
  tag,
29718
29770
  typeArguments,
29719
- token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression(
29771
+ token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateToken(
29772
+ /*isTaggedTemplate*/
29773
+ true
29774
+ ), parseLiteralNode()) : parseTemplateExpression(
29720
29775
  /*isTaggedTemplate*/
29721
29776
  true
29722
29777
  )
@@ -29804,10 +29859,16 @@ var Parser;
29804
29859
  }
29805
29860
  function parsePrimaryExpression() {
29806
29861
  switch (token()) {
29862
+ case 14 /* NoSubstitutionTemplateLiteral */:
29863
+ if (scanner.getTokenFlags() & 26656 /* IsInvalid */) {
29864
+ reScanTemplateToken(
29865
+ /*isTaggedTemplate*/
29866
+ false
29867
+ );
29868
+ }
29807
29869
  case 8 /* NumericLiteral */:
29808
29870
  case 9 /* BigIntLiteral */:
29809
29871
  case 10 /* StringLiteral */:
29810
- case 14 /* NoSubstitutionTemplateLiteral */:
29811
29872
  return parseLiteralNode();
29812
29873
  case 109 /* ThisKeyword */:
29813
29874
  case 107 /* SuperKeyword */:
@@ -40414,11 +40475,6 @@ function createBinder() {
40414
40475
  }
40415
40476
  }
40416
40477
  }
40417
- function checkStrictModeNumericLiteral(node) {
40418
- if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
40419
- file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
40420
- }
40421
- }
40422
40478
  function checkStrictModePostfixUnaryExpression(node) {
40423
40479
  if (inStrictMode) {
40424
40480
  checkStrictModeEvalOrArguments(node, node.operand);
@@ -40610,8 +40666,6 @@ function createBinder() {
40610
40666
  return checkStrictModeCatchClause(node);
40611
40667
  case 218 /* DeleteExpression */:
40612
40668
  return checkStrictModeDeleteExpression(node);
40613
- case 8 /* NumericLiteral */:
40614
- return checkStrictModeNumericLiteral(node);
40615
40669
  case 223 /* PostfixUnaryExpression */:
40616
40670
  return checkStrictModePostfixUnaryExpression(node);
40617
40671
  case 222 /* PrefixUnaryExpression */:
@@ -82678,25 +82732,6 @@ function createTypeChecker(host) {
82678
82732
  return false;
82679
82733
  }
82680
82734
  function checkGrammarNumericLiteral(node) {
82681
- if (node.numericLiteralFlags & 32 /* Octal */) {
82682
- let diagnosticMessage;
82683
- if (languageVersion >= 1 /* ES5 */) {
82684
- diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
82685
- } else if (isChildOfNodeWithKind(node, 199 /* LiteralType */)) {
82686
- diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
82687
- } else if (isChildOfNodeWithKind(node, 303 /* EnumMember */)) {
82688
- diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
82689
- }
82690
- if (diagnosticMessage) {
82691
- const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === 40 /* MinusToken */;
82692
- const literal = (withMinus ? "-" : "") + "0o" + node.text;
82693
- return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
82694
- }
82695
- }
82696
- checkNumericLiteralValueSize(node);
82697
- return false;
82698
- }
82699
- function checkNumericLiteralValueSize(node) {
82700
82735
  const isFractional = getTextOfNode(node).indexOf(".") !== -1;
82701
82736
  const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
82702
82737
  if (isFractional || isScientific) {
@@ -85637,7 +85672,7 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
85637
85672
  );
85638
85673
  }
85639
85674
  function createTemplateCooked(factory2, template) {
85640
- return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85675
+ return template.templateFlags & 26656 /* IsInvalid */ ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85641
85676
  }
85642
85677
  function getRawLiteral(factory2, node, currentSourceFile) {
85643
85678
  let text = node.rawText;
@@ -108835,7 +108870,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108835
108870
  /*jsxAttributeEscape*/
108836
108871
  false
108837
108872
  );
108838
- return !expression.numericLiteralFlags && !stringContains(text, tokenToString(24 /* DotToken */));
108873
+ return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !stringContains(text, tokenToString(24 /* DotToken */)) && !stringContains(text, String.fromCharCode(69 /* E */)) && !stringContains(text, String.fromCharCode(101 /* e */));
108839
108874
  } else if (isAccessExpression(expression)) {
108840
108875
  const constantValue = getConstantValue(expression);
108841
108876
  return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue;
@@ -113083,7 +113118,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
113083
113118
  Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
113084
113119
  Diagnostics.Invalid_use_of_0_in_strict_mode.code,
113085
113120
  Diagnostics.A_label_is_not_allowed_here.code,
113086
- Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113087
113121
  Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113088
113122
  // grammar errors
113089
113123
  Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,