@typescript-deploys/pr-build 5.1.0-pr-51837-45 → 5.1.0-pr-50951-3

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
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-insiders.20230311`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230313`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -5789,6 +5789,7 @@ var Diagnostics = {
5789
5789
  _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."),
5790
5790
  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."),
5791
5791
  Invalid_reference_directive_syntax: diag(1084, 1 /* Error */, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
5792
+ 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}'."),
5792
5793
  _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."),
5793
5794
  _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."),
5794
5795
  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."),
@@ -5819,7 +5820,7 @@ var Diagnostics = {
5819
5820
  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."),
5820
5821
  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."),
5821
5822
  An_export_assignment_cannot_have_modifiers: diag(1120, 1 /* Error */, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
5822
- 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}'."),
5823
+ 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."),
5823
5824
  Variable_declaration_list_cannot_be_empty: diag(1123, 1 /* Error */, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."),
5824
5825
  Digit_expected: diag(1124, 1 /* Error */, "Digit_expected_1124", "Digit expected."),
5825
5826
  Hexadecimal_digit_expected: diag(1125, 1 /* Error */, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."),
@@ -6129,9 +6130,6 @@ var Diagnostics = {
6129
6130
  _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."),
6130
6131
  _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."),
6131
6132
  Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
6132
- 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}'."),
6133
- Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."),
6134
- 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."),
6135
6133
  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."),
6136
6134
  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."),
6137
6135
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7468,6 +7466,8 @@ var Diagnostics = {
7468
7466
  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."),
7469
7467
  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."),
7470
7468
  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."),
7469
+ 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}'."),
7470
+ 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}'."),
7471
7471
  Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
7472
7472
  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."),
7473
7473
  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."),
@@ -8449,7 +8449,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8449
8449
  isReservedWord: () => token >= 82 /* FirstReservedWord */ && token <= 117 /* LastReservedWord */,
8450
8450
  isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
8451
8451
  getCommentDirectives: () => commentDirectives,
8452
- getNumericLiteralFlags: () => tokenFlags & 25584 /* NumericLiteralFlags */,
8452
+ getNumericLiteralFlags: () => tokenFlags & 1008 /* NumericLiteralFlags */,
8453
8453
  getTokenFlags: () => tokenFlags,
8454
8454
  reScanGreaterToken,
8455
8455
  reScanAsteriskEqualsToken,
@@ -8490,11 +8490,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8490
8490
  });
8491
8491
  }
8492
8492
  return scanner;
8493
- function error(message, errPos = pos, length3, arg0) {
8493
+ function error(message, errPos = pos, length3) {
8494
8494
  if (onError) {
8495
8495
  const oldPos = pos;
8496
8496
  pos = errPos;
8497
- onError(message, length3 || 0, arg0);
8497
+ onError(message, length3 || 0);
8498
8498
  pos = oldPos;
8499
8499
  }
8500
8500
  }
@@ -8511,13 +8511,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8511
8511
  allowSeparator = false;
8512
8512
  isPreviousTokenSeparator = true;
8513
8513
  result += text.substring(start2, pos);
8514
+ } else if (isPreviousTokenSeparator) {
8515
+ error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8514
8516
  } else {
8515
- tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8516
- if (isPreviousTokenSeparator) {
8517
- error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8518
- } else {
8519
- error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8520
- }
8517
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8521
8518
  }
8522
8519
  pos++;
8523
8520
  start2 = pos;
@@ -8532,38 +8529,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8532
8529
  break;
8533
8530
  }
8534
8531
  if (text.charCodeAt(pos - 1) === 95 /* _ */) {
8535
- tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8536
8532
  error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
8537
8533
  }
8538
8534
  return result + text.substring(start2, pos);
8539
8535
  }
8540
8536
  function scanNumber() {
8541
- let start2 = pos;
8542
- let mainFragment;
8543
- if (text.charCodeAt(pos) === 48 /* _0 */) {
8544
- pos++;
8545
- if (text.charCodeAt(pos) === 95 /* _ */) {
8546
- tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
8547
- error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8548
- pos--;
8549
- mainFragment = scanNumberFragment();
8550
- } else if (!scanDigits()) {
8551
- tokenFlags |= 8192 /* ContainsLeadingZero */;
8552
- mainFragment = "" + +tokenValue;
8553
- } else if (!tokenValue) {
8554
- mainFragment = "0";
8555
- } else {
8556
- tokenValue = "" + parseInt(tokenValue, 8);
8557
- tokenFlags |= 32 /* Octal */;
8558
- const withMinus = token === 40 /* MinusToken */;
8559
- const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
8560
- start2 -= +withMinus;
8561
- error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
8562
- return { type: 8 /* NumericLiteral */, value: tokenValue };
8563
- }
8564
- } else {
8565
- mainFragment = scanNumberFragment();
8566
- }
8537
+ const start2 = pos;
8538
+ const mainFragment = scanNumberFragment();
8567
8539
  let decimalFragment;
8568
8540
  let scientificFragment;
8569
8541
  if (text.charCodeAt(pos) === 46 /* dot */) {
@@ -8597,10 +8569,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8597
8569
  } else {
8598
8570
  result = text.substring(start2, end2);
8599
8571
  }
8600
- if (tokenFlags & 8192 /* ContainsLeadingZero */) {
8601
- error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
8602
- return { type: 8 /* NumericLiteral */, value: "" + +result };
8603
- }
8604
8572
  if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
8605
8573
  checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */));
8606
8574
  return {
@@ -8632,17 +8600,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8632
8600
  pos = identifierStart;
8633
8601
  }
8634
8602
  }
8635
- function scanDigits() {
8603
+ function scanOctalDigits() {
8636
8604
  const start2 = pos;
8637
- let isOctal = true;
8638
- while (isDigit(text.charCodeAt(pos))) {
8639
- if (!isOctalDigit(text.charCodeAt(pos))) {
8640
- isOctal = false;
8641
- }
8605
+ while (isOctalDigit(text.charCodeAt(pos))) {
8642
8606
  pos++;
8643
8607
  }
8644
- tokenValue = text.substring(start2, pos);
8645
- return isOctal;
8608
+ return +text.substring(start2, pos);
8646
8609
  }
8647
8610
  function scanExactNumberOfHexDigits(count, canHaveSeparators) {
8648
8611
  const valueString = scanHexDigits(
@@ -8720,10 +8683,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8720
8683
  }
8721
8684
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
8722
8685
  result += text.substring(start2, pos);
8723
- result += scanEscapeSequence(
8724
- /*shouldEmitInvalidEscapeError*/
8725
- true
8726
- );
8686
+ result += scanEscapeSequence();
8727
8687
  start2 = pos;
8728
8688
  continue;
8729
8689
  }
@@ -8737,7 +8697,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8737
8697
  }
8738
8698
  return result;
8739
8699
  }
8740
- function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
8700
+ function scanTemplateAndSetTokenValue(isTaggedTemplate) {
8741
8701
  const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
8742
8702
  pos++;
8743
8703
  let start2 = pos;
@@ -8766,7 +8726,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8766
8726
  }
8767
8727
  if (currChar === 92 /* backslash */) {
8768
8728
  contents += text.substring(start2, pos);
8769
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8729
+ contents += scanEscapeSequence(isTaggedTemplate);
8770
8730
  start2 = pos;
8771
8731
  continue;
8772
8732
  }
@@ -8786,7 +8746,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8786
8746
  tokenValue = contents;
8787
8747
  return resultingToken;
8788
8748
  }
8789
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8749
+ function scanEscapeSequence(isTaggedTemplate) {
8790
8750
  const start2 = pos;
8791
8751
  pos++;
8792
8752
  if (pos >= end) {
@@ -8797,37 +8757,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8797
8757
  pos++;
8798
8758
  switch (ch) {
8799
8759
  case 48 /* _0 */:
8800
- if (pos >= end || !isDigit(text.charCodeAt(pos))) {
8801
- return "\0";
8802
- }
8803
- case 49 /* _1 */:
8804
- case 50 /* _2 */:
8805
- case 51 /* _3 */:
8806
- if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8760
+ if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) {
8807
8761
  pos++;
8762
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8763
+ return text.substring(start2, pos);
8808
8764
  }
8809
- case 52 /* _4 */:
8810
- case 53 /* _5 */:
8811
- case 54 /* _6 */:
8812
- case 55 /* _7 */:
8813
- if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8814
- pos++;
8815
- }
8816
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8817
- if (shouldEmitInvalidEscapeError) {
8818
- const code = parseInt(text.substring(start2 + 1, pos), 8);
8819
- error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
8820
- return String.fromCharCode(code);
8821
- }
8822
- return text.substring(start2, pos);
8823
- case 56 /* _8 */:
8824
- case 57 /* _9 */:
8825
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8826
- if (shouldEmitInvalidEscapeError) {
8827
- error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8828
- return String.fromCharCode(ch);
8829
- }
8830
- return text.substring(start2, pos);
8765
+ return "\0";
8831
8766
  case 98 /* b */:
8832
8767
  return "\b";
8833
8768
  case 116 /* t */:
@@ -8845,69 +8780,59 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8845
8780
  case 34 /* doubleQuote */:
8846
8781
  return '"';
8847
8782
  case 117 /* u */:
8848
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8849
- pos++;
8850
- const escapedValueString = scanMinimumNumberOfHexDigits(
8851
- 1,
8852
- /*canHaveSeparators*/
8853
- false
8854
- );
8855
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8856
- if (escapedValue < 0) {
8857
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8858
- if (shouldEmitInvalidEscapeError) {
8859
- error(Diagnostics.Hexadecimal_digit_expected);
8783
+ if (isTaggedTemplate) {
8784
+ for (let escapePos = pos; escapePos < pos + 4; escapePos++) {
8785
+ if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* openBrace */) {
8786
+ pos = escapePos;
8787
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8788
+ return text.substring(start2, pos);
8860
8789
  }
8861
- return text.substring(start2, pos);
8862
8790
  }
8863
- if (!isCodePoint(escapedValue)) {
8864
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8865
- if (shouldEmitInvalidEscapeError) {
8866
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8867
- }
8868
- return text.substring(start2, pos);
8869
- }
8870
- if (pos >= end) {
8791
+ }
8792
+ if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8793
+ pos++;
8794
+ if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) {
8871
8795
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8872
- if (shouldEmitInvalidEscapeError) {
8873
- error(Diagnostics.Unexpected_end_of_text);
8874
- }
8875
8796
  return text.substring(start2, pos);
8876
8797
  }
8877
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8878
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8879
- if (shouldEmitInvalidEscapeError) {
8880
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
8798
+ if (isTaggedTemplate) {
8799
+ const savePos = pos;
8800
+ const escapedValueString = scanMinimumNumberOfHexDigits(
8801
+ 1,
8802
+ /*canHaveSeparators*/
8803
+ false
8804
+ );
8805
+ const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8806
+ if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125 /* closeBrace */) {
8807
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8808
+ return text.substring(start2, pos);
8809
+ } else {
8810
+ pos = savePos;
8881
8811
  }
8882
- return text.substring(start2, pos);
8883
8812
  }
8884
- pos++;
8885
8813
  tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8886
- return utf16EncodeAsString(escapedValue);
8887
- }
8888
- for (; pos < start2 + 6; pos++) {
8889
- if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8890
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8891
- if (shouldEmitInvalidEscapeError) {
8892
- error(Diagnostics.Hexadecimal_digit_expected);
8893
- }
8894
- return text.substring(start2, pos);
8895
- }
8814
+ return scanExtendedUnicodeEscape();
8896
8815
  }
8897
8816
  tokenFlags |= 1024 /* UnicodeEscape */;
8898
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8817
+ return scanHexadecimalEscape(
8818
+ /*numDigits*/
8819
+ 4
8820
+ );
8899
8821
  case 120 /* x */:
8900
- for (; pos < start2 + 4; pos++) {
8901
- if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8822
+ if (isTaggedTemplate) {
8823
+ if (!isHexDigit(text.charCodeAt(pos))) {
8824
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8825
+ return text.substring(start2, pos);
8826
+ } else if (!isHexDigit(text.charCodeAt(pos + 1))) {
8827
+ pos++;
8902
8828
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8903
- if (shouldEmitInvalidEscapeError) {
8904
- error(Diagnostics.Hexadecimal_digit_expected);
8905
- }
8906
8829
  return text.substring(start2, pos);
8907
8830
  }
8908
8831
  }
8909
- tokenFlags |= 4096 /* HexEscape */;
8910
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8832
+ return scanHexadecimalEscape(
8833
+ /*numDigits*/
8834
+ 2
8835
+ );
8911
8836
  case 13 /* carriageReturn */:
8912
8837
  if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
8913
8838
  pos++;
@@ -8920,6 +8845,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8920
8845
  return String.fromCharCode(ch);
8921
8846
  }
8922
8847
  }
8848
+ function scanHexadecimalEscape(numDigits) {
8849
+ const escapedValue = scanExactNumberOfHexDigits(
8850
+ numDigits,
8851
+ /*canHaveSeparators*/
8852
+ false
8853
+ );
8854
+ if (escapedValue >= 0) {
8855
+ return String.fromCharCode(escapedValue);
8856
+ } else {
8857
+ error(Diagnostics.Hexadecimal_digit_expected);
8858
+ return "";
8859
+ }
8860
+ }
8923
8861
  function scanExtendedUnicodeEscape() {
8924
8862
  const escapedValueString = scanMinimumNumberOfHexDigits(
8925
8863
  1,
@@ -9148,7 +9086,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9148
9086
  return token = 10 /* StringLiteral */;
9149
9087
  case 96 /* backtick */:
9150
9088
  return token = scanTemplateAndSetTokenValue(
9151
- /*shouldEmitInvalidEscapeError*/
9089
+ /* isTaggedTemplate */
9152
9090
  false
9153
9091
  );
9154
9092
  case 37 /* percent */:
@@ -9323,6 +9261,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9323
9261
  tokenFlags |= 256 /* OctalSpecifier */;
9324
9262
  return token = checkBigIntSuffix();
9325
9263
  }
9264
+ if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
9265
+ tokenValue = "" + scanOctalDigits();
9266
+ tokenFlags |= 32 /* Octal */;
9267
+ return token = 8 /* NumericLiteral */;
9268
+ }
9326
9269
  case 49 /* _1 */:
9327
9270
  case 50 /* _2 */:
9328
9271
  case 51 /* _3 */:
@@ -9639,13 +9582,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9639
9582
  return void 0;
9640
9583
  }
9641
9584
  function reScanTemplateToken(isTaggedTemplate) {
9585
+ Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
9642
9586
  pos = tokenStart;
9643
- return token = scanTemplateAndSetTokenValue(!isTaggedTemplate);
9587
+ return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
9644
9588
  }
9645
9589
  function reScanTemplateHeadOrNoSubstitutionTemplate() {
9646
9590
  pos = tokenStart;
9647
9591
  return token = scanTemplateAndSetTokenValue(
9648
- /*shouldEmitInvalidEscapeError*/
9592
+ /* isTaggedTemplate */
9649
9593
  true
9650
9594
  );
9651
9595
  }
@@ -10337,32 +10281,36 @@ function getModifiers(node) {
10337
10281
  return filter(node.modifiers, isModifier);
10338
10282
  }
10339
10283
  }
10340
- function getJSDocParameterTagsWorker(param, noCache) {
10341
- if (param.name) {
10342
- if (isIdentifier(param.name)) {
10343
- const name = param.name.escapedText;
10344
- return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
10345
- } else {
10346
- const i = param.parent.parameters.indexOf(param);
10347
- Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
10348
- const paramTags = getJSDocTagsWorker(param.parent, noCache).filter(isJSDocParameterTag);
10349
- if (i < paramTags.length) {
10350
- return [paramTags[i]];
10351
- }
10284
+ function getJSDocParameterTagsWorker(node, noCache) {
10285
+ const declaration = getRootDeclaration(node);
10286
+ if (isParameter(declaration)) {
10287
+ const name = node.name;
10288
+ const signatureDeclaration = declaration.parent;
10289
+ const jsDocParameterTags = filter(getJSDocTagsWorker(signatureDeclaration, noCache), isJSDocParameterTag);
10290
+ if (length(jsDocParameterTags) === 0) {
10291
+ return emptyArray;
10292
+ }
10293
+ if (isIdentifier(name)) {
10294
+ return filter(jsDocParameterTags, (tag) => isIdentifier(tag.name) && tag.name.escapedText === name.escapedText);
10295
+ }
10296
+ const i = signatureDeclaration.parameters.indexOf(declaration);
10297
+ Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
10298
+ if (i < length(jsDocParameterTags)) {
10299
+ return [jsDocParameterTags[i]];
10352
10300
  }
10353
10301
  }
10354
10302
  return emptyArray;
10355
10303
  }
10356
- function getJSDocParameterTags(param) {
10304
+ function getJSDocParameterTags(node) {
10357
10305
  return getJSDocParameterTagsWorker(
10358
- param,
10306
+ node,
10359
10307
  /*noCache*/
10360
10308
  false
10361
10309
  );
10362
10310
  }
10363
- function getJSDocParameterTagsNoCache(param) {
10311
+ function getJSDocParameterTagsNoCache(node) {
10364
10312
  return getJSDocParameterTagsWorker(
10365
- param,
10313
+ node,
10366
10314
  /*noCache*/
10367
10315
  true
10368
10316
  );
@@ -12135,13 +12083,8 @@ function canUseOriginalText(node, flags) {
12135
12083
  if (nodeIsSynthesized(node) || !node.parent || flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) {
12136
12084
  return false;
12137
12085
  }
12138
- if (isNumericLiteral(node)) {
12139
- if (node.numericLiteralFlags & 26656 /* IsInvalid */) {
12140
- return false;
12141
- }
12142
- if (node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12143
- return !!(flags & 8 /* AllowNumericSeparator */);
12144
- }
12086
+ if (isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12087
+ return !!(flags & 8 /* AllowNumericSeparator */);
12145
12088
  }
12146
12089
  return !isBigIntLiteral(node);
12147
12090
  }
@@ -12658,6 +12601,15 @@ function isPartOfTypeNode(node) {
12658
12601
  }
12659
12602
  return false;
12660
12603
  }
12604
+ function isChildOfNodeWithKind(node, kind) {
12605
+ while (node) {
12606
+ if (node.kind === kind) {
12607
+ return true;
12608
+ }
12609
+ node = node.parent;
12610
+ }
12611
+ return false;
12612
+ }
12661
12613
  function forEachReturnStatement(body, visitor) {
12662
12614
  return traverse(body);
12663
12615
  function traverse(node) {
@@ -13786,7 +13738,7 @@ function getJSDocCommentsAndTags(hostNode, noCache) {
13786
13738
  if (hasJSDocNodes(node)) {
13787
13739
  result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc)));
13788
13740
  }
13789
- if (node.kind === 167 /* Parameter */) {
13741
+ if (node.kind === 167 /* Parameter */ || node.kind === 206 /* BindingElement */) {
13790
13742
  result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node));
13791
13743
  break;
13792
13744
  }
@@ -19907,7 +19859,7 @@ function createNodeFactory(flags, baseFactory2) {
19907
19859
  return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node;
19908
19860
  }
19909
19861
  function checkTemplateLiteralLikeNode(kind, text, rawText, templateFlags = 0 /* None */) {
19910
- Debug.assert(!(templateFlags & ~7176 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19862
+ Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19911
19863
  let cooked = void 0;
19912
19864
  if (rawText !== void 0 && rawText !== text) {
19913
19865
  cooked = getCookedText(kind, rawText);
@@ -19936,7 +19888,7 @@ function createNodeFactory(flags, baseFactory2) {
19936
19888
  const node = createBaseToken(kind);
19937
19889
  node.text = text;
19938
19890
  node.rawText = rawText;
19939
- node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19891
+ node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19940
19892
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19941
19893
  return node;
19942
19894
  }
@@ -19944,7 +19896,7 @@ function createNodeFactory(flags, baseFactory2) {
19944
19896
  const node = createBaseDeclaration(kind);
19945
19897
  node.text = text;
19946
19898
  node.rawText = rawText;
19947
- node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19899
+ node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19948
19900
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19949
19901
  return node;
19950
19902
  }
@@ -26611,8 +26563,8 @@ var Parser;
26611
26563
  function parseErrorAtRange(range, message, arg0) {
26612
26564
  parseErrorAt(range.pos, range.end, message, arg0);
26613
26565
  }
26614
- function scanError(message, length2, arg0) {
26615
- parseErrorAtPosition(scanner.getTokenEnd(), length2, message, arg0);
26566
+ function scanError(message, length2) {
26567
+ parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
26616
26568
  }
26617
26569
  function getNodePos() {
26618
26570
  return scanner.getTokenFullStart();
@@ -26651,6 +26603,9 @@ var Parser;
26651
26603
  function reScanTemplateToken(isTaggedTemplate) {
26652
26604
  return currentToken = scanner.reScanTemplateToken(isTaggedTemplate);
26653
26605
  }
26606
+ function reScanTemplateHeadOrNoSubstitutionTemplate() {
26607
+ return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate();
26608
+ }
26654
26609
  function reScanLessThanToken() {
26655
26610
  return currentToken = scanner.reScanLessThanToken();
26656
26611
  }
@@ -27717,11 +27672,8 @@ var Parser;
27717
27672
  return parseLiteralLikeNode(token());
27718
27673
  }
27719
27674
  function parseTemplateHead(isTaggedTemplate) {
27720
- if (!isTaggedTemplate && scanner.getTokenFlags() & 26656 /* IsInvalid */) {
27721
- reScanTemplateToken(
27722
- /*isTaggedTemplate*/
27723
- false
27724
- );
27675
+ if (isTaggedTemplate) {
27676
+ reScanTemplateHeadOrNoSubstitutionTemplate();
27725
27677
  }
27726
27678
  const fragment = parseLiteralLikeNode(token());
27727
27679
  Debug.assert(fragment.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
@@ -27739,7 +27691,8 @@ var Parser;
27739
27691
  }
27740
27692
  function parseLiteralLikeNode(kind) {
27741
27693
  const pos = getNodePos();
27742
- const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 7176 /* TemplateLiteralLikeFlags */) : (
27694
+ const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048 /* TemplateLiteralLikeFlags */) : (
27695
+ // Octal literals are not allowed in strict mode or ES5
27743
27696
  // Note that theoretically the following condition would hold true literals like 009,
27744
27697
  // which is not octal. But because of how the scanner separates the tokens, we would
27745
27698
  // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
@@ -29794,10 +29747,7 @@ var Parser;
29794
29747
  const tagExpression = factory2.createTaggedTemplateExpression(
29795
29748
  tag,
29796
29749
  typeArguments,
29797
- token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateToken(
29798
- /*isTaggedTemplate*/
29799
- true
29800
- ), parseLiteralNode()) : parseTemplateExpression(
29750
+ token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression(
29801
29751
  /*isTaggedTemplate*/
29802
29752
  true
29803
29753
  )
@@ -29885,16 +29835,10 @@ var Parser;
29885
29835
  }
29886
29836
  function parsePrimaryExpression() {
29887
29837
  switch (token()) {
29888
- case 14 /* NoSubstitutionTemplateLiteral */:
29889
- if (scanner.getTokenFlags() & 26656 /* IsInvalid */) {
29890
- reScanTemplateToken(
29891
- /*isTaggedTemplate*/
29892
- false
29893
- );
29894
- }
29895
29838
  case 8 /* NumericLiteral */:
29896
29839
  case 9 /* BigIntLiteral */:
29897
29840
  case 10 /* StringLiteral */:
29841
+ case 14 /* NoSubstitutionTemplateLiteral */:
29898
29842
  return parseLiteralNode();
29899
29843
  case 109 /* ThisKeyword */:
29900
29844
  case 107 /* SuperKeyword */:
@@ -40616,6 +40560,11 @@ function createBinder() {
40616
40560
  }
40617
40561
  }
40618
40562
  }
40563
+ function checkStrictModeNumericLiteral(node) {
40564
+ if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
40565
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
40566
+ }
40567
+ }
40619
40568
  function checkStrictModePostfixUnaryExpression(node) {
40620
40569
  if (inStrictMode) {
40621
40570
  checkStrictModeEvalOrArguments(node, node.operand);
@@ -40807,6 +40756,8 @@ function createBinder() {
40807
40756
  return checkStrictModeCatchClause(node);
40808
40757
  case 218 /* DeleteExpression */:
40809
40758
  return checkStrictModeDeleteExpression(node);
40759
+ case 8 /* NumericLiteral */:
40760
+ return checkStrictModeNumericLiteral(node);
40810
40761
  case 223 /* PostfixUnaryExpression */:
40811
40762
  return checkStrictModePostfixUnaryExpression(node);
40812
40763
  case 222 /* PrefixUnaryExpression */:
@@ -82604,6 +82555,25 @@ function createTypeChecker(host) {
82604
82555
  return false;
82605
82556
  }
82606
82557
  function checkGrammarNumericLiteral(node) {
82558
+ if (node.numericLiteralFlags & 32 /* Octal */) {
82559
+ let diagnosticMessage;
82560
+ if (languageVersion >= 1 /* ES5 */) {
82561
+ diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
82562
+ } else if (isChildOfNodeWithKind(node, 199 /* LiteralType */)) {
82563
+ diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
82564
+ } else if (isChildOfNodeWithKind(node, 303 /* EnumMember */)) {
82565
+ diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
82566
+ }
82567
+ if (diagnosticMessage) {
82568
+ const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === 40 /* MinusToken */;
82569
+ const literal = (withMinus ? "-" : "") + "0o" + node.text;
82570
+ return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
82571
+ }
82572
+ }
82573
+ checkNumericLiteralValueSize(node);
82574
+ return false;
82575
+ }
82576
+ function checkNumericLiteralValueSize(node) {
82607
82577
  const isFractional = getTextOfNode(node).indexOf(".") !== -1;
82608
82578
  const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
82609
82579
  if (isFractional || isScientific) {
@@ -85542,7 +85512,7 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
85542
85512
  );
85543
85513
  }
85544
85514
  function createTemplateCooked(factory2, template) {
85545
- return template.templateFlags & 26656 /* IsInvalid */ ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85515
+ return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85546
85516
  }
85547
85517
  function getRawLiteral(factory2, node, currentSourceFile) {
85548
85518
  let text = node.rawText;
@@ -108711,7 +108681,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108711
108681
  /*jsxAttributeEscape*/
108712
108682
  false
108713
108683
  );
108714
- return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !stringContains(text, tokenToString(24 /* DotToken */)) && !stringContains(text, String.fromCharCode(69 /* E */)) && !stringContains(text, String.fromCharCode(101 /* e */));
108684
+ return !expression.numericLiteralFlags && !stringContains(text, tokenToString(24 /* DotToken */));
108715
108685
  } else if (isAccessExpression(expression)) {
108716
108686
  const constantValue = getConstantValue(expression);
108717
108687
  return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue;
@@ -112959,6 +112929,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
112959
112929
  Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
112960
112930
  Diagnostics.Invalid_use_of_0_in_strict_mode.code,
112961
112931
  Diagnostics.A_label_is_not_allowed_here.code,
112932
+ Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
112962
112933
  Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
112963
112934
  // grammar errors
112964
112935
  Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,