@typescript-deploys/pr-build 5.5.0-pr-58352-3 → 5.5.0-pr-58243-49

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/typescript.js CHANGED
@@ -572,7 +572,6 @@ __export(typescript_exports, {
572
572
  factory: () => factory,
573
573
  fileExtensionIs: () => fileExtensionIs,
574
574
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
575
- fileIncludeReasonIsEqual: () => fileIncludeReasonIsEqual,
576
575
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
577
576
  fileShouldUseJavaScriptRequire: () => fileShouldUseJavaScriptRequire,
578
577
  filter: () => filter,
@@ -686,6 +685,7 @@ __export(typescript_exports, {
686
685
  getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
687
686
  getBuilderCreationParameters: () => getBuilderCreationParameters,
688
687
  getBuilderFileEmit: () => getBuilderFileEmit,
688
+ getCanonicalDiagnostic: () => getCanonicalDiagnostic,
689
689
  getCheckFlags: () => getCheckFlags,
690
690
  getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
691
691
  getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
@@ -2362,7 +2362,7 @@ module.exports = __toCommonJS(typescript_exports);
2362
2362
 
2363
2363
  // src/compiler/corePublic.ts
2364
2364
  var versionMajorMinor = "5.5";
2365
- var version = `${versionMajorMinor}.0-insiders.20240429`;
2365
+ var version = `${versionMajorMinor}.0-insiders.20240430`;
2366
2366
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2367
2367
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2368
2368
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6996,22 +6996,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
6996
6996
  ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
6997
6997
  return ScriptKind7;
6998
6998
  })(ScriptKind || {});
6999
- var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
7000
- ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
7001
- ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
7002
- ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
7003
- ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
7004
- ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
7005
- ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
7006
- ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
7007
- ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
7008
- ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
7009
- ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
7010
- ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
7011
- ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
7012
- ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
7013
- ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
7014
- return ScriptTarget11;
6999
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
7000
+ ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
7001
+ ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
7002
+ ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
7003
+ ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
7004
+ ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
7005
+ ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
7006
+ ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
7007
+ ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
7008
+ ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
7009
+ ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
7010
+ ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
7011
+ ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
7012
+ ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
7013
+ ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
7014
+ return ScriptTarget12;
7015
7015
  })(ScriptTarget || {});
7016
7016
  var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
7017
7017
  LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -7024,6 +7024,7 @@ var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
7024
7024
  return WatchDirectoryFlags3;
7025
7025
  })(WatchDirectoryFlags || {});
7026
7026
  var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
7027
+ CharacterCodes2[CharacterCodes2["EOF"] = -1] = "EOF";
7027
7028
  CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
7028
7029
  CharacterCodes2[CharacterCodes2["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
7029
7030
  CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
@@ -9816,7 +9817,7 @@ var Diagnostics = {
9816
9817
  Range_out_of_order_in_character_class: diag(1517, 1 /* Error */, "Range_out_of_order_in_character_class_1517", "Range out of order in character class."),
9817
9818
  Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class: diag(1518, 1 /* Error */, "Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_characte_1518", "Anything that would possibly match more than a single character is invalid inside a negated character class."),
9818
9819
  Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead: diag(1519, 1 /* Error */, "Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead_1519", "Operators must not be mixed within a character class. Wrap it in a nested class instead."),
9819
- Expected_a_class_set_oprand: diag(1520, 1 /* Error */, "Expected_a_class_set_oprand_1520", "Expected a class set oprand."),
9820
+ Expected_a_class_set_operand: diag(1520, 1 /* Error */, "Expected_a_class_set_operand_1520", "Expected a class set operand."),
9820
9821
  q_must_be_followed_by_string_alternatives_enclosed_in_braces: diag(1521, 1 /* Error */, "q_must_be_followed_by_string_alternatives_enclosed_in_braces_1521", "'\\q' must be followed by string alternatives enclosed in braces."),
9821
9822
  A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash: diag(1522, 1 /* Error */, "A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backs_1522", "A character class must not contain a reserved double punctuator. Did you mean to escape it with backslash?"),
9822
9823
  Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
@@ -12326,6 +12327,18 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12326
12327
  });
12327
12328
  }
12328
12329
  return scanner2;
12330
+ function codePointUnchecked(pos2) {
12331
+ return codePointAt(text, pos2);
12332
+ }
12333
+ function codePointChecked(pos2) {
12334
+ return pos2 >= 0 && pos2 < end ? codePointUnchecked(pos2) : -1 /* EOF */;
12335
+ }
12336
+ function charCodeUnchecked(pos2) {
12337
+ return text.charCodeAt(pos2);
12338
+ }
12339
+ function charCodeChecked(pos2) {
12340
+ return pos2 >= 0 && pos2 < end ? charCodeUnchecked(pos2) : -1 /* EOF */;
12341
+ }
12329
12342
  function error2(message, errPos = pos, length3, arg0) {
12330
12343
  if (onError) {
12331
12344
  const oldPos = pos;
@@ -12340,7 +12353,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12340
12353
  let isPreviousTokenSeparator = false;
12341
12354
  let result = "";
12342
12355
  while (true) {
12343
- const ch = text.charCodeAt(pos);
12356
+ const ch = charCodeUnchecked(pos);
12344
12357
  if (ch === 95 /* _ */) {
12345
12358
  tokenFlags |= 512 /* ContainsSeparator */;
12346
12359
  if (allowSeparator) {
@@ -12367,7 +12380,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12367
12380
  }
12368
12381
  break;
12369
12382
  }
12370
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
12383
+ if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
12371
12384
  tokenFlags |= 16384 /* ContainsInvalidSeparator */;
12372
12385
  error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
12373
12386
  }
@@ -12376,9 +12389,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12376
12389
  function scanNumber() {
12377
12390
  let start2 = pos;
12378
12391
  let mainFragment;
12379
- if (text.charCodeAt(pos) === 48 /* _0 */) {
12392
+ if (charCodeUnchecked(pos) === 48 /* _0 */) {
12380
12393
  pos++;
12381
- if (text.charCodeAt(pos) === 95 /* _ */) {
12394
+ if (charCodeUnchecked(pos) === 95 /* _ */) {
12382
12395
  tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
12383
12396
  error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
12384
12397
  pos--;
@@ -12403,15 +12416,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12403
12416
  }
12404
12417
  let decimalFragment;
12405
12418
  let scientificFragment;
12406
- if (text.charCodeAt(pos) === 46 /* dot */) {
12419
+ if (charCodeUnchecked(pos) === 46 /* dot */) {
12407
12420
  pos++;
12408
12421
  decimalFragment = scanNumberFragment();
12409
12422
  }
12410
12423
  let end2 = pos;
12411
- if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) {
12424
+ if (charCodeUnchecked(pos) === 69 /* E */ || charCodeUnchecked(pos) === 101 /* e */) {
12412
12425
  pos++;
12413
12426
  tokenFlags |= 16 /* Scientific */;
12414
- if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */)
12427
+ if (charCodeUnchecked(pos) === 43 /* plus */ || charCodeUnchecked(pos) === 45 /* minus */)
12415
12428
  pos++;
12416
12429
  const preNumericPart = pos;
12417
12430
  const finalFragment = scanNumberFragment();
@@ -12451,7 +12464,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12451
12464
  }
12452
12465
  }
12453
12466
  function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
12454
- if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
12467
+ if (!isIdentifierStart(codePointUnchecked(pos), languageVersion)) {
12455
12468
  return;
12456
12469
  }
12457
12470
  const identifierStart = pos;
@@ -12470,8 +12483,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12470
12483
  function scanDigits() {
12471
12484
  const start2 = pos;
12472
12485
  let isOctal = true;
12473
- while (isDigit(text.charCodeAt(pos))) {
12474
- if (!isOctalDigit(text.charCodeAt(pos))) {
12486
+ while (isDigit(charCodeChecked(pos))) {
12487
+ if (!isOctalDigit(charCodeUnchecked(pos))) {
12475
12488
  isOctal = false;
12476
12489
  }
12477
12490
  pos++;
@@ -12503,7 +12516,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12503
12516
  let allowSeparator = false;
12504
12517
  let isPreviousTokenSeparator = false;
12505
12518
  while (valueChars.length < minCount || scanAsManyAsPossible) {
12506
- let ch = text.charCodeAt(pos);
12519
+ let ch = charCodeUnchecked(pos);
12507
12520
  if (canHaveSeparators && ch === 95 /* _ */) {
12508
12521
  tokenFlags |= 512 /* ContainsSeparator */;
12509
12522
  if (allowSeparator) {
@@ -12530,13 +12543,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12530
12543
  if (valueChars.length < minCount) {
12531
12544
  valueChars = [];
12532
12545
  }
12533
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
12546
+ if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
12534
12547
  error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
12535
12548
  }
12536
12549
  return String.fromCharCode(...valueChars);
12537
12550
  }
12538
12551
  function scanString(jsxAttributeString = false) {
12539
- const quote2 = text.charCodeAt(pos);
12552
+ const quote2 = charCodeUnchecked(pos);
12540
12553
  pos++;
12541
12554
  let result = "";
12542
12555
  let start2 = pos;
@@ -12547,7 +12560,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12547
12560
  error2(Diagnostics.Unterminated_string_literal);
12548
12561
  break;
12549
12562
  }
12550
- const ch = text.charCodeAt(pos);
12563
+ const ch = charCodeUnchecked(pos);
12551
12564
  if (ch === quote2) {
12552
12565
  result += text.substring(start2, pos);
12553
12566
  pos++;
@@ -12575,7 +12588,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12575
12588
  return result;
12576
12589
  }
12577
12590
  function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
12578
- const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
12591
+ const startedWithBacktick = charCodeUnchecked(pos) === 96 /* backtick */;
12579
12592
  pos++;
12580
12593
  let start2 = pos;
12581
12594
  let contents = "";
@@ -12588,14 +12601,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12588
12601
  resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
12589
12602
  break;
12590
12603
  }
12591
- const currChar = text.charCodeAt(pos);
12604
+ const currChar = charCodeUnchecked(pos);
12592
12605
  if (currChar === 96 /* backtick */) {
12593
12606
  contents += text.substring(start2, pos);
12594
12607
  pos++;
12595
12608
  resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
12596
12609
  break;
12597
12610
  }
12598
- if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) {
12611
+ if (currChar === 36 /* $ */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 123 /* openBrace */) {
12599
12612
  contents += text.substring(start2, pos);
12600
12613
  pos += 2;
12601
12614
  resultingToken = startedWithBacktick ? 16 /* TemplateHead */ : 17 /* TemplateMiddle */;
@@ -12614,7 +12627,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12614
12627
  if (currChar === 13 /* carriageReturn */) {
12615
12628
  contents += text.substring(start2, pos);
12616
12629
  pos++;
12617
- if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
12630
+ if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
12618
12631
  pos++;
12619
12632
  }
12620
12633
  contents += "\n";
@@ -12634,24 +12647,24 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12634
12647
  error2(Diagnostics.Unexpected_end_of_text);
12635
12648
  return "";
12636
12649
  }
12637
- const ch = text.charCodeAt(pos);
12650
+ const ch = charCodeUnchecked(pos);
12638
12651
  pos++;
12639
12652
  switch (ch) {
12640
12653
  case 48 /* _0 */:
12641
- if (pos >= end || !isDigit(text.charCodeAt(pos))) {
12654
+ if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
12642
12655
  return "\0";
12643
12656
  }
12644
12657
  case 49 /* _1 */:
12645
12658
  case 50 /* _2 */:
12646
12659
  case 51 /* _3 */:
12647
- if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
12660
+ if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
12648
12661
  pos++;
12649
12662
  }
12650
12663
  case 52 /* _4 */:
12651
12664
  case 53 /* _5 */:
12652
12665
  case 54 /* _6 */:
12653
12666
  case 55 /* _7 */:
12654
- if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
12667
+ if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
12655
12668
  pos++;
12656
12669
  }
12657
12670
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
@@ -12688,12 +12701,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12688
12701
  case 34 /* doubleQuote */:
12689
12702
  return '"';
12690
12703
  case 117 /* u */:
12691
- if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
12704
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
12692
12705
  pos -= 2;
12693
12706
  return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
12694
12707
  }
12695
12708
  for (; pos < start2 + 6; pos++) {
12696
- if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12709
+ if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
12697
12710
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12698
12711
  if (isRegularExpression || shouldEmitInvalidEscapeError) {
12699
12712
  error2(Diagnostics.Hexadecimal_digit_expected);
@@ -12704,11 +12717,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12704
12717
  tokenFlags |= 1024 /* UnicodeEscape */;
12705
12718
  const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
12706
12719
  const escapedValueString = String.fromCharCode(escapedValue);
12707
- if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
12720
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
12708
12721
  const nextStart = pos;
12709
12722
  let nextPos = pos + 2;
12710
12723
  for (; nextPos < nextStart + 6; nextPos++) {
12711
- if (!isHexDigit(text.charCodeAt(pos))) {
12724
+ if (!isHexDigit(charCodeUnchecked(pos))) {
12712
12725
  return escapedValueString;
12713
12726
  }
12714
12727
  }
@@ -12721,7 +12734,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12721
12734
  return escapedValueString;
12722
12735
  case 120 /* x */:
12723
12736
  for (; pos < start2 + 4; pos++) {
12724
- if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12737
+ if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
12725
12738
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12726
12739
  if (isRegularExpression || shouldEmitInvalidEscapeError) {
12727
12740
  error2(Diagnostics.Hexadecimal_digit_expected);
@@ -12732,7 +12745,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12732
12745
  tokenFlags |= 4096 /* HexEscape */;
12733
12746
  return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
12734
12747
  case 13 /* carriageReturn */:
12735
- if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
12748
+ if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
12736
12749
  pos++;
12737
12750
  }
12738
12751
  case 10 /* lineFeed */:
@@ -12773,7 +12786,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12773
12786
  error2(Diagnostics.Unexpected_end_of_text);
12774
12787
  }
12775
12788
  isInvalidExtendedEscape = true;
12776
- } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
12789
+ } else if (charCodeUnchecked(pos) === 125 /* closeBrace */) {
12777
12790
  pos++;
12778
12791
  } else {
12779
12792
  if (shouldEmitInvalidEscapeError) {
@@ -12789,7 +12802,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12789
12802
  return utf16EncodeAsString(escapedValue);
12790
12803
  }
12791
12804
  function peekUnicodeEscape() {
12792
- if (pos + 5 < end && text.charCodeAt(pos + 1) === 117 /* u */) {
12805
+ if (pos + 5 < end && charCodeUnchecked(pos + 1) === 117 /* u */) {
12793
12806
  const start2 = pos;
12794
12807
  pos += 2;
12795
12808
  const value = scanExactNumberOfHexDigits(
@@ -12803,7 +12816,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12803
12816
  return -1;
12804
12817
  }
12805
12818
  function peekExtendedUnicodeEscape() {
12806
- if (codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
12819
+ if (codePointUnchecked(pos + 1) === 117 /* u */ && codePointUnchecked(pos + 2) === 123 /* openBrace */) {
12807
12820
  const start2 = pos;
12808
12821
  pos += 3;
12809
12822
  const escapedValueString = scanMinimumNumberOfHexDigits(
@@ -12821,7 +12834,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12821
12834
  let result = "";
12822
12835
  let start2 = pos;
12823
12836
  while (pos < end) {
12824
- let ch = codePointAt(text, pos);
12837
+ let ch = codePointUnchecked(pos);
12825
12838
  if (isIdentifierPart(ch, languageVersion)) {
12826
12839
  pos += charSize(ch);
12827
12840
  } else if (ch === 92 /* backslash */) {
@@ -12868,7 +12881,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12868
12881
  let separatorAllowed = false;
12869
12882
  let isPreviousTokenSeparator = false;
12870
12883
  while (true) {
12871
- const ch = text.charCodeAt(pos);
12884
+ const ch = charCodeUnchecked(pos);
12872
12885
  if (ch === 95 /* _ */) {
12873
12886
  tokenFlags |= 512 /* ContainsSeparator */;
12874
12887
  if (separatorAllowed) {
@@ -12890,13 +12903,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12890
12903
  pos++;
12891
12904
  isPreviousTokenSeparator = false;
12892
12905
  }
12893
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
12906
+ if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
12894
12907
  error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
12895
12908
  }
12896
12909
  return value;
12897
12910
  }
12898
12911
  function checkBigIntSuffix() {
12899
- if (text.charCodeAt(pos) === 110 /* n */) {
12912
+ if (charCodeUnchecked(pos) === 110 /* n */) {
12900
12913
  tokenValue += "n";
12901
12914
  if (tokenFlags & 384 /* BinaryOrOctalSpecifier */) {
12902
12915
  tokenValue = parsePseudoBigInt(tokenValue) + "n";
@@ -12918,7 +12931,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12918
12931
  if (pos >= end) {
12919
12932
  return token = 1 /* EndOfFileToken */;
12920
12933
  }
12921
- const ch = codePointAt(text, pos);
12934
+ const ch = codePointUnchecked(pos);
12922
12935
  if (pos === 0) {
12923
12936
  if (ch === 35 /* hash */ && isShebangTrivia(text, pos)) {
12924
12937
  pos = scanShebangTrivia(text, pos);
@@ -12937,7 +12950,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12937
12950
  pos++;
12938
12951
  continue;
12939
12952
  } else {
12940
- if (ch === 13 /* carriageReturn */ && pos + 1 < end && text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
12953
+ if (ch === 13 /* carriageReturn */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 10 /* lineFeed */) {
12941
12954
  pos += 2;
12942
12955
  } else {
12943
12956
  pos++;
@@ -12970,14 +12983,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12970
12983
  pos++;
12971
12984
  continue;
12972
12985
  } else {
12973
- while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
12986
+ while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
12974
12987
  pos++;
12975
12988
  }
12976
12989
  return token = 5 /* WhitespaceTrivia */;
12977
12990
  }
12978
12991
  case 33 /* exclamation */:
12979
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
12980
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
12992
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
12993
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
12981
12994
  return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */;
12982
12995
  }
12983
12996
  return pos += 2, token = 36 /* ExclamationEqualsToken */;
@@ -12994,19 +13007,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12994
13007
  false
12995
13008
  );
12996
13009
  case 37 /* percent */:
12997
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13010
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
12998
13011
  return pos += 2, token = 70 /* PercentEqualsToken */;
12999
13012
  }
13000
13013
  pos++;
13001
13014
  return token = 45 /* PercentToken */;
13002
13015
  case 38 /* ampersand */:
13003
- if (text.charCodeAt(pos + 1) === 38 /* ampersand */) {
13004
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13016
+ if (charCodeUnchecked(pos + 1) === 38 /* ampersand */) {
13017
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13005
13018
  return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */;
13006
13019
  }
13007
13020
  return pos += 2, token = 56 /* AmpersandAmpersandToken */;
13008
13021
  }
13009
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13022
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13010
13023
  return pos += 2, token = 74 /* AmpersandEqualsToken */;
13011
13024
  }
13012
13025
  pos++;
@@ -13018,11 +13031,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13018
13031
  pos++;
13019
13032
  return token = 22 /* CloseParenToken */;
13020
13033
  case 42 /* asterisk */:
13021
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13034
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13022
13035
  return pos += 2, token = 67 /* AsteriskEqualsToken */;
13023
13036
  }
13024
- if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
13025
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13037
+ if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
13038
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13026
13039
  return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */;
13027
13040
  }
13028
13041
  return pos += 2, token = 43 /* AsteriskAsteriskToken */;
@@ -13034,10 +13047,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13034
13047
  }
13035
13048
  return token = 42 /* AsteriskToken */;
13036
13049
  case 43 /* plus */:
13037
- if (text.charCodeAt(pos + 1) === 43 /* plus */) {
13050
+ if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
13038
13051
  return pos += 2, token = 46 /* PlusPlusToken */;
13039
13052
  }
13040
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13053
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13041
13054
  return pos += 2, token = 65 /* PlusEqualsToken */;
13042
13055
  }
13043
13056
  pos++;
@@ -13046,29 +13059,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13046
13059
  pos++;
13047
13060
  return token = 28 /* CommaToken */;
13048
13061
  case 45 /* minus */:
13049
- if (text.charCodeAt(pos + 1) === 45 /* minus */) {
13062
+ if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
13050
13063
  return pos += 2, token = 47 /* MinusMinusToken */;
13051
13064
  }
13052
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13065
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13053
13066
  return pos += 2, token = 66 /* MinusEqualsToken */;
13054
13067
  }
13055
13068
  pos++;
13056
13069
  return token = 41 /* MinusToken */;
13057
13070
  case 46 /* dot */:
13058
- if (isDigit(text.charCodeAt(pos + 1))) {
13071
+ if (isDigit(charCodeUnchecked(pos + 1))) {
13059
13072
  scanNumber();
13060
13073
  return token = 9 /* NumericLiteral */;
13061
13074
  }
13062
- if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) {
13075
+ if (charCodeUnchecked(pos + 1) === 46 /* dot */ && charCodeUnchecked(pos + 2) === 46 /* dot */) {
13063
13076
  return pos += 3, token = 26 /* DotDotDotToken */;
13064
13077
  }
13065
13078
  pos++;
13066
13079
  return token = 25 /* DotToken */;
13067
13080
  case 47 /* slash */:
13068
- if (text.charCodeAt(pos + 1) === 47 /* slash */) {
13081
+ if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
13069
13082
  pos += 2;
13070
13083
  while (pos < end) {
13071
- if (isLineBreak(text.charCodeAt(pos))) {
13084
+ if (isLineBreak(charCodeUnchecked(pos))) {
13072
13085
  break;
13073
13086
  }
13074
13087
  pos++;
@@ -13085,14 +13098,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13085
13098
  return token = 2 /* SingleLineCommentTrivia */;
13086
13099
  }
13087
13100
  }
13088
- if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
13101
+ if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
13089
13102
  pos += 2;
13090
- const isJSDoc2 = text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) !== 47 /* slash */;
13103
+ const isJSDoc2 = charCodeUnchecked(pos) === 42 /* asterisk */ && charCodeUnchecked(pos + 1) !== 47 /* slash */;
13091
13104
  let commentClosed = false;
13092
13105
  let lastLineStart = tokenStart;
13093
13106
  while (pos < end) {
13094
- const ch2 = text.charCodeAt(pos);
13095
- if (ch2 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
13107
+ const ch2 = charCodeUnchecked(pos);
13108
+ if (ch2 === 42 /* asterisk */ && charCodeUnchecked(pos + 1) === 47 /* slash */) {
13096
13109
  pos += 2;
13097
13110
  commentClosed = true;
13098
13111
  break;
@@ -13119,13 +13132,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13119
13132
  return token = 3 /* MultiLineCommentTrivia */;
13120
13133
  }
13121
13134
  }
13122
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13135
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13123
13136
  return pos += 2, token = 69 /* SlashEqualsToken */;
13124
13137
  }
13125
13138
  pos++;
13126
13139
  return token = 44 /* SlashToken */;
13127
13140
  case 48 /* _0 */:
13128
- if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) {
13141
+ if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 88 /* X */ || charCodeUnchecked(pos + 1) === 120 /* x */)) {
13129
13142
  pos += 2;
13130
13143
  tokenValue = scanMinimumNumberOfHexDigits(
13131
13144
  1,
@@ -13139,7 +13152,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13139
13152
  tokenValue = "0x" + tokenValue;
13140
13153
  tokenFlags |= 64 /* HexSpecifier */;
13141
13154
  return token = checkBigIntSuffix();
13142
- } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) {
13155
+ } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 66 /* B */ || charCodeUnchecked(pos + 1) === 98 /* b */)) {
13143
13156
  pos += 2;
13144
13157
  tokenValue = scanBinaryOrOctalDigits(
13145
13158
  /* base */
@@ -13152,7 +13165,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13152
13165
  tokenValue = "0b" + tokenValue;
13153
13166
  tokenFlags |= 128 /* BinarySpecifier */;
13154
13167
  return token = checkBigIntSuffix();
13155
- } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) {
13168
+ } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 79 /* O */ || charCodeUnchecked(pos + 1) === 111 /* o */)) {
13156
13169
  pos += 2;
13157
13170
  tokenValue = scanBinaryOrOctalDigits(
13158
13171
  /* base */
@@ -13191,16 +13204,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13191
13204
  return token = 7 /* ConflictMarkerTrivia */;
13192
13205
  }
13193
13206
  }
13194
- if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
13195
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13207
+ if (charCodeUnchecked(pos + 1) === 60 /* lessThan */) {
13208
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13196
13209
  return pos += 3, token = 71 /* LessThanLessThanEqualsToken */;
13197
13210
  }
13198
13211
  return pos += 2, token = 48 /* LessThanLessThanToken */;
13199
13212
  }
13200
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13213
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13201
13214
  return pos += 2, token = 33 /* LessThanEqualsToken */;
13202
13215
  }
13203
- if (languageVariant === 1 /* JSX */ && text.charCodeAt(pos + 1) === 47 /* slash */ && text.charCodeAt(pos + 2) !== 42 /* asterisk */) {
13216
+ if (languageVariant === 1 /* JSX */ && charCodeUnchecked(pos + 1) === 47 /* slash */ && charCodeUnchecked(pos + 2) !== 42 /* asterisk */) {
13204
13217
  return pos += 2, token = 31 /* LessThanSlashToken */;
13205
13218
  }
13206
13219
  pos++;
@@ -13214,13 +13227,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13214
13227
  return token = 7 /* ConflictMarkerTrivia */;
13215
13228
  }
13216
13229
  }
13217
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13218
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13230
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13231
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13219
13232
  return pos += 3, token = 37 /* EqualsEqualsEqualsToken */;
13220
13233
  }
13221
13234
  return pos += 2, token = 35 /* EqualsEqualsToken */;
13222
13235
  }
13223
- if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
13236
+ if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
13224
13237
  return pos += 2, token = 39 /* EqualsGreaterThanToken */;
13225
13238
  }
13226
13239
  pos++;
@@ -13237,11 +13250,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13237
13250
  pos++;
13238
13251
  return token = 32 /* GreaterThanToken */;
13239
13252
  case 63 /* question */:
13240
- if (text.charCodeAt(pos + 1) === 46 /* dot */ && !isDigit(text.charCodeAt(pos + 2))) {
13253
+ if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
13241
13254
  return pos += 2, token = 29 /* QuestionDotToken */;
13242
13255
  }
13243
- if (text.charCodeAt(pos + 1) === 63 /* question */) {
13244
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13256
+ if (charCodeUnchecked(pos + 1) === 63 /* question */) {
13257
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13245
13258
  return pos += 3, token = 78 /* QuestionQuestionEqualsToken */;
13246
13259
  }
13247
13260
  return pos += 2, token = 61 /* QuestionQuestionToken */;
@@ -13255,7 +13268,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13255
13268
  pos++;
13256
13269
  return token = 24 /* CloseBracketToken */;
13257
13270
  case 94 /* caret */:
13258
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13271
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13259
13272
  return pos += 2, token = 79 /* CaretEqualsToken */;
13260
13273
  }
13261
13274
  pos++;
@@ -13272,13 +13285,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13272
13285
  return token = 7 /* ConflictMarkerTrivia */;
13273
13286
  }
13274
13287
  }
13275
- if (text.charCodeAt(pos + 1) === 124 /* bar */) {
13276
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13288
+ if (charCodeUnchecked(pos + 1) === 124 /* bar */) {
13289
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13277
13290
  return pos += 3, token = 76 /* BarBarEqualsToken */;
13278
13291
  }
13279
13292
  return pos += 2, token = 57 /* BarBarToken */;
13280
13293
  }
13281
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13294
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13282
13295
  return pos += 2, token = 75 /* BarEqualsToken */;
13283
13296
  }
13284
13297
  pos++;
@@ -13317,7 +13330,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13317
13330
  pos++;
13318
13331
  return token = 0 /* Unknown */;
13319
13332
  }
13320
- const charAfterHash = codePointAt(text, pos + 1);
13333
+ const charAfterHash = codePointUnchecked(pos + 1);
13321
13334
  if (charAfterHash === 92 /* backslash */) {
13322
13335
  pos++;
13323
13336
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
@@ -13387,7 +13400,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13387
13400
  Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
13388
13401
  pos = tokenStart = fullStartPos;
13389
13402
  tokenFlags = 0;
13390
- const ch = codePointAt(text, pos);
13403
+ const ch = codePointUnchecked(pos);
13391
13404
  const identifierKind = scanIdentifier(ch, 99 /* ESNext */);
13392
13405
  if (identifierKind) {
13393
13406
  return token = identifierKind;
@@ -13399,7 +13412,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13399
13412
  let ch = startCharacter;
13400
13413
  if (isIdentifierStart(ch, languageVersion2)) {
13401
13414
  pos += charSize(ch);
13402
- while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion2))
13415
+ while (pos < end && isIdentifierPart(ch = codePointUnchecked(pos), languageVersion2))
13403
13416
  pos += charSize(ch);
13404
13417
  tokenValue = text.substring(tokenStart, pos);
13405
13418
  if (ch === 92 /* backslash */) {
@@ -13410,20 +13423,20 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13410
13423
  }
13411
13424
  function reScanGreaterToken() {
13412
13425
  if (token === 32 /* GreaterThanToken */) {
13413
- if (text.charCodeAt(pos) === 62 /* greaterThan */) {
13414
- if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
13415
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
13426
+ if (charCodeUnchecked(pos) === 62 /* greaterThan */) {
13427
+ if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
13428
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
13416
13429
  return pos += 3, token = 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
13417
13430
  }
13418
13431
  return pos += 2, token = 50 /* GreaterThanGreaterThanGreaterThanToken */;
13419
13432
  }
13420
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
13433
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
13421
13434
  return pos += 2, token = 72 /* GreaterThanGreaterThanEqualsToken */;
13422
13435
  }
13423
13436
  pos++;
13424
13437
  return token = 49 /* GreaterThanGreaterThanToken */;
13425
13438
  }
13426
- if (text.charCodeAt(pos) === 61 /* equals */) {
13439
+ if (charCodeUnchecked(pos) === 61 /* equals */) {
13427
13440
  pos++;
13428
13441
  return token = 34 /* GreaterThanEqualsToken */;
13429
13442
  }
@@ -13446,7 +13459,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13446
13459
  error2(Diagnostics.Unterminated_regular_expression_literal);
13447
13460
  break;
13448
13461
  }
13449
- const ch = text.charCodeAt(p);
13462
+ const ch = charCodeUnchecked(p);
13450
13463
  if (isLineBreak(ch)) {
13451
13464
  tokenFlags |= 4 /* Unterminated */;
13452
13465
  error2(Diagnostics.Unterminated_regular_expression_literal);
@@ -13470,7 +13483,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13470
13483
  const endOfBody = p - (isUnterminated ? 0 : 1);
13471
13484
  let regExpFlags = 0 /* None */;
13472
13485
  while (p < end) {
13473
- const ch = text.charCodeAt(p);
13486
+ const ch = charCodeUnchecked(p);
13474
13487
  if (!isIdentifierPart(ch, languageVersion)) {
13475
13488
  break;
13476
13489
  }
@@ -13489,845 +13502,860 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13489
13502
  }
13490
13503
  p++;
13491
13504
  }
13505
+ pos = p;
13492
13506
  if (reportErrors2) {
13493
- pos = tokenStart + 1;
13494
- const saveTokenPos = tokenStart;
13507
+ const saveTokenStart = tokenStart;
13495
13508
  const saveTokenFlags = tokenFlags;
13509
+ const savePos = pos;
13510
+ const saveEnd = end;
13511
+ pos = tokenStart + 1;
13512
+ end = endOfBody;
13496
13513
  scanRegularExpressionWorker(
13497
- text,
13498
- endOfBody,
13499
13514
  regExpFlags,
13500
13515
  isUnterminated,
13501
13516
  /*annexB*/
13502
13517
  true
13503
13518
  );
13504
- if (!isUnterminated) {
13505
- pos = p;
13506
- }
13507
- tokenStart = saveTokenPos;
13519
+ tokenStart = saveTokenStart;
13508
13520
  tokenFlags = saveTokenFlags;
13509
- } else {
13510
- pos = p;
13521
+ pos = savePos;
13522
+ end = saveEnd;
13511
13523
  }
13512
13524
  tokenValue = text.substring(tokenStart, pos);
13513
13525
  token = 14 /* RegularExpressionLiteral */;
13514
13526
  }
13515
13527
  return token;
13516
- function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated, annexB) {
13517
- const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13518
- const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
13519
- if (unicodeMode) {
13520
- annexB = false;
13521
- }
13522
- let mayContainStrings = false;
13523
- let numberOfCapturingGroups = 0;
13524
- const groupSpecifiers = /* @__PURE__ */ new Set();
13525
- const groupNameReferences = [];
13526
- const decimalEscapes = [];
13527
- const namedCapturingGroups = [];
13528
- function scanDisjunction(isInGroup) {
13529
- while (true) {
13530
- namedCapturingGroups.push(/* @__PURE__ */ new Set());
13531
- scanAlternative(isInGroup);
13532
- namedCapturingGroups.pop();
13533
- if (text2.charCodeAt(pos) !== 124 /* bar */) {
13534
- return;
13535
- }
13536
- pos++;
13528
+ }
13529
+ function scanRegularExpressionWorker(regExpFlags, isUnterminated, annexB) {
13530
+ var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13531
+ var unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
13532
+ if (unicodeMode) {
13533
+ annexB = false;
13534
+ }
13535
+ var mayContainStrings = false;
13536
+ var numberOfCapturingGroups = 0;
13537
+ var groupSpecifiers;
13538
+ var groupNameReferences;
13539
+ var decimalEscapes;
13540
+ var namedCapturingGroupsScopeStack = [];
13541
+ var topNamedCapturingGroupsScope;
13542
+ function scanDisjunction(isInGroup) {
13543
+ while (true) {
13544
+ namedCapturingGroupsScopeStack.push(topNamedCapturingGroupsScope);
13545
+ topNamedCapturingGroupsScope = void 0;
13546
+ scanAlternative(isInGroup);
13547
+ topNamedCapturingGroupsScope = namedCapturingGroupsScopeStack.pop();
13548
+ if (charCodeChecked(pos) !== 124 /* bar */) {
13549
+ return;
13537
13550
  }
13551
+ pos++;
13538
13552
  }
13539
- function scanAlternative(isInGroup) {
13540
- let isPreviousTermQuantifiable = false;
13541
- while (pos < end2) {
13542
- const start2 = pos;
13543
- const ch = text2.charCodeAt(pos);
13544
- switch (ch) {
13545
- case 94 /* caret */:
13546
- case 36 /* $ */:
13547
- pos++;
13548
- isPreviousTermQuantifiable = false;
13549
- break;
13550
- case 92 /* backslash */:
13553
+ }
13554
+ function scanAlternative(isInGroup) {
13555
+ let isPreviousTermQuantifiable = false;
13556
+ while (true) {
13557
+ const start2 = pos;
13558
+ const ch = charCodeChecked(pos);
13559
+ switch (ch) {
13560
+ case -1 /* EOF */:
13561
+ return;
13562
+ case 94 /* caret */:
13563
+ case 36 /* $ */:
13564
+ pos++;
13565
+ isPreviousTermQuantifiable = false;
13566
+ break;
13567
+ case 92 /* backslash */:
13568
+ pos++;
13569
+ switch (charCodeChecked(pos)) {
13570
+ case 98 /* b */:
13571
+ case 66 /* B */:
13572
+ pos++;
13573
+ isPreviousTermQuantifiable = false;
13574
+ break;
13575
+ default:
13576
+ scanAtomEscape();
13577
+ isPreviousTermQuantifiable = true;
13578
+ break;
13579
+ }
13580
+ break;
13581
+ case 40 /* openParen */:
13582
+ pos++;
13583
+ if (charCodeChecked(pos) === 63 /* question */) {
13551
13584
  pos++;
13552
- switch (text2.charCodeAt(pos)) {
13553
- case 98 /* b */:
13554
- case 66 /* B */:
13585
+ switch (charCodeChecked(pos)) {
13586
+ case 61 /* equals */:
13587
+ case 33 /* exclamation */:
13555
13588
  pos++;
13556
- isPreviousTermQuantifiable = false;
13589
+ isPreviousTermQuantifiable = annexB;
13557
13590
  break;
13558
- default:
13559
- scanAtomEscape();
13560
- isPreviousTermQuantifiable = true;
13561
- break;
13562
- }
13563
- break;
13564
- case 40 /* openParen */:
13565
- pos++;
13566
- if (text2.charCodeAt(pos) === 63 /* question */) {
13567
- pos++;
13568
- switch (text2.charCodeAt(pos)) {
13569
- case 61 /* equals */:
13570
- case 33 /* exclamation */:
13571
- pos++;
13572
- isPreviousTermQuantifiable = annexB;
13573
- break;
13574
- case 60 /* lessThan */:
13575
- const groupNameStart = pos;
13576
- pos++;
13577
- switch (text2.charCodeAt(pos)) {
13578
- case 61 /* equals */:
13579
- case 33 /* exclamation */:
13580
- pos++;
13581
- isPreviousTermQuantifiable = false;
13582
- break;
13583
- default:
13584
- scanGroupName(
13585
- /*isReference*/
13586
- false
13587
- );
13588
- scanExpectedChar(62 /* greaterThan */);
13589
- if (languageVersion < 5 /* ES2018 */) {
13590
- error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
13591
- }
13592
- numberOfCapturingGroups++;
13593
- isPreviousTermQuantifiable = true;
13594
- break;
13595
- }
13596
- break;
13597
- default:
13598
- const start3 = pos;
13599
- const setFlags = scanPatternModifiers(0 /* None */);
13600
- if (text2.charCodeAt(pos) === 45 /* minus */) {
13591
+ case 60 /* lessThan */:
13592
+ const groupNameStart = pos;
13593
+ pos++;
13594
+ switch (charCodeChecked(pos)) {
13595
+ case 61 /* equals */:
13596
+ case 33 /* exclamation */:
13601
13597
  pos++;
13602
- scanPatternModifiers(setFlags);
13603
- if (pos === start3 + 1) {
13604
- error2(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
13598
+ isPreviousTermQuantifiable = false;
13599
+ break;
13600
+ default:
13601
+ scanGroupName(
13602
+ /*isReference*/
13603
+ false
13604
+ );
13605
+ scanExpectedChar(62 /* greaterThan */);
13606
+ if (languageVersion < 5 /* ES2018 */) {
13607
+ error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
13605
13608
  }
13609
+ numberOfCapturingGroups++;
13610
+ isPreviousTermQuantifiable = true;
13611
+ break;
13612
+ }
13613
+ break;
13614
+ default:
13615
+ const start3 = pos;
13616
+ const setFlags = scanPatternModifiers(0 /* None */);
13617
+ if (charCodeChecked(pos) === 45 /* minus */) {
13618
+ pos++;
13619
+ scanPatternModifiers(setFlags);
13620
+ if (pos === start3 + 1) {
13621
+ error2(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
13606
13622
  }
13607
- scanExpectedChar(58 /* colon */);
13608
- isPreviousTermQuantifiable = true;
13609
- break;
13610
- }
13611
- } else {
13612
- numberOfCapturingGroups++;
13613
- isPreviousTermQuantifiable = true;
13623
+ }
13624
+ scanExpectedChar(58 /* colon */);
13625
+ isPreviousTermQuantifiable = true;
13626
+ break;
13614
13627
  }
13615
- scanDisjunction(
13616
- /*isInGroup*/
13617
- true
13618
- );
13619
- scanExpectedChar(41 /* closeParen */);
13620
- break;
13621
- case 123 /* openBrace */:
13628
+ } else {
13629
+ numberOfCapturingGroups++;
13630
+ isPreviousTermQuantifiable = true;
13631
+ }
13632
+ scanDisjunction(
13633
+ /*isInGroup*/
13634
+ true
13635
+ );
13636
+ scanExpectedChar(41 /* closeParen */);
13637
+ break;
13638
+ case 123 /* openBrace */:
13639
+ pos++;
13640
+ const digitsStart = pos;
13641
+ scanDigits();
13642
+ const min2 = tokenValue;
13643
+ if (charCodeChecked(pos) === 44 /* comma */) {
13622
13644
  pos++;
13623
- const digitsStart = pos;
13624
13645
  scanDigits();
13625
- const min2 = tokenValue;
13626
- if (text2.charCodeAt(pos) === 44 /* comma */) {
13627
- pos++;
13628
- scanDigits();
13629
- const max = tokenValue;
13630
- if (!min2) {
13631
- if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
13632
- error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13633
- } else {
13634
- if (unicodeMode) {
13635
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13636
- }
13637
- isPreviousTermQuantifiable = true;
13638
- break;
13646
+ const max = tokenValue;
13647
+ if (!min2) {
13648
+ if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
13649
+ error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13650
+ } else {
13651
+ if (unicodeMode) {
13652
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13639
13653
  }
13654
+ isPreviousTermQuantifiable = true;
13655
+ break;
13640
13656
  }
13641
- if (max && Number.parseInt(min2) > Number.parseInt(max)) {
13642
- error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13643
- }
13644
- } else if (!min2) {
13645
- if (unicodeMode) {
13646
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13647
- }
13648
- isPreviousTermQuantifiable = true;
13649
- break;
13650
13657
  }
13651
- scanExpectedChar(125 /* closeBrace */);
13652
- pos--;
13653
- case 42 /* asterisk */:
13654
- case 43 /* plus */:
13655
- case 63 /* question */:
13656
- pos++;
13657
- if (text2.charCodeAt(pos) === 63 /* question */) {
13658
- pos++;
13659
- }
13660
- if (!isPreviousTermQuantifiable) {
13661
- error2(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
13662
- }
13663
- isPreviousTermQuantifiable = false;
13664
- break;
13665
- case 46 /* dot */:
13666
- pos++;
13667
- isPreviousTermQuantifiable = true;
13668
- break;
13669
- case 91 /* openBracket */:
13670
- pos++;
13671
- if (unicodeSetsMode) {
13672
- scanClassSetExpression();
13673
- } else {
13674
- scanClassRanges();
13675
- }
13676
- scanExpectedChar(93 /* closeBracket */);
13677
- isPreviousTermQuantifiable = true;
13678
- break;
13679
- case 41 /* closeParen */:
13680
- if (isInGroup) {
13681
- return;
13682
- }
13683
- case 93 /* closeBracket */:
13684
- case 125 /* closeBrace */:
13685
- if (isUnterminated && !isInGroup) {
13686
- return;
13658
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
13659
+ error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13687
13660
  }
13688
- if (unicodeMode || ch === 41 /* closeParen */) {
13689
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13661
+ } else if (!min2) {
13662
+ if (unicodeMode) {
13663
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13690
13664
  }
13691
- pos++;
13692
13665
  isPreviousTermQuantifiable = true;
13693
13666
  break;
13694
- case 47 /* slash */:
13695
- case 124 /* bar */:
13696
- return;
13697
- default:
13698
- scanSourceCharacter();
13699
- isPreviousTermQuantifiable = true;
13700
- break;
13701
- }
13702
- }
13703
- }
13704
- function scanPatternModifiers(currFlags) {
13705
- while (pos < end2) {
13706
- const ch = text2.charCodeAt(pos);
13707
- if (!isIdentifierPart(ch, languageVersion)) {
13708
- break;
13709
- }
13710
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13711
- if (flag === void 0) {
13712
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13713
- } else if (currFlags & flag) {
13714
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13715
- } else if (!(flag & 28 /* Modifiers */)) {
13716
- error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
13717
- } else {
13718
- currFlags |= flag;
13719
- checkRegularExpressionFlagAvailable(flag, pos);
13720
- }
13721
- pos++;
13722
- }
13723
- return currFlags;
13724
- }
13725
- function scanAtomEscape() {
13726
- Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13727
- switch (text2.charCodeAt(pos)) {
13728
- case 107 /* k */:
13667
+ }
13668
+ scanExpectedChar(125 /* closeBrace */);
13669
+ pos--;
13670
+ case 42 /* asterisk */:
13671
+ case 43 /* plus */:
13672
+ case 63 /* question */:
13729
13673
  pos++;
13730
- if (text2.charCodeAt(pos) === 60 /* lessThan */) {
13674
+ if (charCodeChecked(pos) === 63 /* question */) {
13731
13675
  pos++;
13732
- scanGroupName(
13733
- /*isReference*/
13734
- true
13735
- );
13736
- scanExpectedChar(62 /* greaterThan */);
13737
- } else if (unicodeMode) {
13738
- error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13739
13676
  }
13740
- break;
13741
- case 113 /* q */:
13742
- if (unicodeSetsMode) {
13743
- pos++;
13744
- error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13745
- break;
13677
+ if (!isPreviousTermQuantifiable) {
13678
+ error2(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
13746
13679
  }
13747
- default:
13748
- Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
13749
- /*atomEscape*/
13750
- true
13751
- ));
13680
+ isPreviousTermQuantifiable = false;
13752
13681
  break;
13753
- }
13754
- }
13755
- function scanDecimalEscape() {
13756
- Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13757
- const ch = text2.charCodeAt(pos);
13758
- if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
13759
- const start2 = pos;
13760
- scanDigits();
13761
- decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
13762
- return true;
13763
- }
13764
- return false;
13765
- }
13766
- function scanCharacterEscape(atomEscape) {
13767
- Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13768
- let ch = text2.charCodeAt(pos);
13769
- switch (ch) {
13770
- case 99 /* c */:
13682
+ case 46 /* dot */:
13771
13683
  pos++;
13772
- ch = text2.charCodeAt(pos);
13773
- if (isASCIILetter(ch)) {
13774
- pos++;
13775
- return String.fromCharCode(ch & 31);
13776
- }
13777
- if (unicodeMode) {
13778
- error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13779
- } else if (atomEscape && annexB) {
13780
- pos--;
13781
- return "\\";
13684
+ isPreviousTermQuantifiable = true;
13685
+ break;
13686
+ case 91 /* openBracket */:
13687
+ pos++;
13688
+ if (unicodeSetsMode) {
13689
+ scanClassSetExpression();
13690
+ } else {
13691
+ scanClassRanges();
13782
13692
  }
13783
- return String.fromCharCode(ch);
13784
- case 94 /* caret */:
13785
- case 36 /* $ */:
13786
- case 47 /* slash */:
13787
- case 92 /* backslash */:
13788
- case 46 /* dot */:
13789
- case 42 /* asterisk */:
13790
- case 43 /* plus */:
13791
- case 63 /* question */:
13792
- case 40 /* openParen */:
13693
+ scanExpectedChar(93 /* closeBracket */);
13694
+ isPreviousTermQuantifiable = true;
13695
+ break;
13793
13696
  case 41 /* closeParen */:
13794
- case 91 /* openBracket */:
13697
+ if (isInGroup) {
13698
+ return;
13699
+ }
13795
13700
  case 93 /* closeBracket */:
13796
- case 123 /* openBrace */:
13797
13701
  case 125 /* closeBrace */:
13798
- case 124 /* bar */:
13702
+ if (isUnterminated && !isInGroup) {
13703
+ return;
13704
+ }
13705
+ if (unicodeMode || ch === 41 /* closeParen */) {
13706
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13707
+ }
13799
13708
  pos++;
13800
- return String.fromCharCode(ch);
13709
+ isPreviousTermQuantifiable = true;
13710
+ break;
13711
+ case 47 /* slash */:
13712
+ case 124 /* bar */:
13713
+ return;
13801
13714
  default:
13802
- if (pos >= end2) {
13803
- error2(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
13804
- return "\\";
13805
- }
13806
- pos--;
13807
- return scanEscapeSequence(
13808
- /*shouldEmitInvalidEscapeError*/
13809
- unicodeMode,
13810
- /*isRegularExpression*/
13811
- annexB ? "annex-b" : true
13812
- );
13715
+ scanSourceCharacter();
13716
+ isPreviousTermQuantifiable = true;
13717
+ break;
13813
13718
  }
13814
13719
  }
13815
- function scanGroupName(isReference) {
13816
- Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
13817
- tokenStart = pos;
13818
- scanIdentifier(codePointAt(text2, pos), languageVersion);
13819
- if (pos === tokenStart) {
13820
- error2(Diagnostics.Expected_a_capturing_group_name);
13821
- } else if (isReference) {
13822
- groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
13823
- } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
13824
- error2(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
13720
+ }
13721
+ function scanPatternModifiers(currFlags) {
13722
+ while (true) {
13723
+ const ch = charCodeChecked(pos);
13724
+ if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13725
+ break;
13726
+ }
13727
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13728
+ if (flag === void 0) {
13729
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13730
+ } else if (currFlags & flag) {
13731
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13732
+ } else if (!(flag & 28 /* Modifiers */)) {
13733
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
13825
13734
  } else {
13826
- last(namedCapturingGroups).add(tokenValue);
13827
- groupSpecifiers.add(tokenValue);
13735
+ currFlags |= flag;
13736
+ checkRegularExpressionFlagAvailable(flag, pos);
13828
13737
  }
13738
+ pos++;
13739
+ }
13740
+ return currFlags;
13741
+ }
13742
+ function scanAtomEscape() {
13743
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
13744
+ switch (charCodeChecked(pos)) {
13745
+ case 107 /* k */:
13746
+ pos++;
13747
+ if (charCodeChecked(pos) === 60 /* lessThan */) {
13748
+ pos++;
13749
+ scanGroupName(
13750
+ /*isReference*/
13751
+ true
13752
+ );
13753
+ scanExpectedChar(62 /* greaterThan */);
13754
+ } else if (unicodeMode) {
13755
+ error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13756
+ }
13757
+ break;
13758
+ case 113 /* q */:
13759
+ if (unicodeSetsMode) {
13760
+ pos++;
13761
+ error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13762
+ break;
13763
+ }
13764
+ default:
13765
+ Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
13766
+ /*atomEscape*/
13767
+ true
13768
+ ));
13769
+ break;
13829
13770
  }
13830
- function isClassContentExit(ch) {
13831
- return ch === 93 /* closeBracket */ || pos >= end2;
13771
+ }
13772
+ function scanDecimalEscape() {
13773
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
13774
+ const ch = charCodeChecked(pos);
13775
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
13776
+ const start2 = pos;
13777
+ scanDigits();
13778
+ decimalEscapes = append(decimalEscapes, { pos: start2, end: pos, value: +tokenValue });
13779
+ return true;
13832
13780
  }
13833
- function scanClassRanges() {
13834
- Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13835
- if (text2.charCodeAt(pos) === 94 /* caret */) {
13781
+ return false;
13782
+ }
13783
+ function scanCharacterEscape(atomEscape) {
13784
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
13785
+ let ch = charCodeChecked(pos);
13786
+ switch (ch) {
13787
+ case 99 /* c */:
13788
+ pos++;
13789
+ ch = charCodeChecked(pos);
13790
+ if (isASCIILetter(ch)) {
13791
+ pos++;
13792
+ return String.fromCharCode(ch & 31);
13793
+ }
13794
+ if (unicodeMode) {
13795
+ error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13796
+ } else if (atomEscape && annexB) {
13797
+ pos--;
13798
+ return "\\";
13799
+ }
13800
+ return String.fromCharCode(ch);
13801
+ case 94 /* caret */:
13802
+ case 36 /* $ */:
13803
+ case 47 /* slash */:
13804
+ case 92 /* backslash */:
13805
+ case 46 /* dot */:
13806
+ case 42 /* asterisk */:
13807
+ case 43 /* plus */:
13808
+ case 63 /* question */:
13809
+ case 40 /* openParen */:
13810
+ case 41 /* closeParen */:
13811
+ case 91 /* openBracket */:
13812
+ case 93 /* closeBracket */:
13813
+ case 123 /* openBrace */:
13814
+ case 125 /* closeBrace */:
13815
+ case 124 /* bar */:
13836
13816
  pos++;
13817
+ return String.fromCharCode(ch);
13818
+ default:
13819
+ if (pos >= end) {
13820
+ error2(Diagnostics.Undetermined_character_escape, pos - 1, 1);
13821
+ return "\\";
13822
+ }
13823
+ pos--;
13824
+ return scanEscapeSequence(
13825
+ /*shouldEmitInvalidEscapeError*/
13826
+ unicodeMode,
13827
+ /*isRegularExpression*/
13828
+ annexB ? "annex-b" : true
13829
+ );
13830
+ }
13831
+ }
13832
+ function scanGroupName(isReference) {
13833
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 60 /* lessThan */);
13834
+ tokenStart = pos;
13835
+ scanIdentifier(codePointChecked(pos), languageVersion);
13836
+ if (pos === tokenStart) {
13837
+ error2(Diagnostics.Expected_a_capturing_group_name);
13838
+ } else if (isReference) {
13839
+ groupNameReferences = append(groupNameReferences, { pos: tokenStart, end: pos, name: tokenValue });
13840
+ } else if ((topNamedCapturingGroupsScope == null ? void 0 : topNamedCapturingGroupsScope.has(tokenValue)) || namedCapturingGroupsScopeStack.some((group2) => group2 == null ? void 0 : group2.has(tokenValue))) {
13841
+ error2(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
13842
+ } else {
13843
+ topNamedCapturingGroupsScope ?? (topNamedCapturingGroupsScope = /* @__PURE__ */ new Set());
13844
+ topNamedCapturingGroupsScope.add(tokenValue);
13845
+ groupSpecifiers ?? (groupSpecifiers = /* @__PURE__ */ new Set());
13846
+ groupSpecifiers.add(tokenValue);
13847
+ }
13848
+ }
13849
+ function isClassContentExit(ch) {
13850
+ return ch === 93 /* closeBracket */ || ch === -1 /* EOF */ || pos >= end;
13851
+ }
13852
+ function scanClassRanges() {
13853
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 91 /* openBracket */);
13854
+ if (charCodeChecked(pos) === 94 /* caret */) {
13855
+ pos++;
13856
+ }
13857
+ while (true) {
13858
+ const ch = charCodeChecked(pos);
13859
+ if (isClassContentExit(ch)) {
13860
+ return;
13837
13861
  }
13838
- while (pos < end2) {
13839
- const ch = text2.charCodeAt(pos);
13840
- if (isClassContentExit(ch)) {
13862
+ const minStart = pos;
13863
+ const minCharacter = scanClassAtom();
13864
+ if (charCodeChecked(pos) === 45 /* minus */) {
13865
+ pos++;
13866
+ const ch2 = charCodeChecked(pos);
13867
+ if (isClassContentExit(ch2)) {
13841
13868
  return;
13842
13869
  }
13843
- const minStart = pos;
13844
- const minCharacter = scanClassAtom();
13845
- if (text2.charCodeAt(pos) === 45 /* minus */) {
13846
- pos++;
13847
- const ch2 = text2.charCodeAt(pos);
13848
- if (isClassContentExit(ch2)) {
13849
- return;
13870
+ if (!minCharacter && !annexB) {
13871
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
13872
+ }
13873
+ const maxStart = pos;
13874
+ const maxCharacter = scanClassAtom();
13875
+ if (!maxCharacter && !annexB) {
13876
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
13877
+ continue;
13878
+ }
13879
+ if (!minCharacter) {
13880
+ continue;
13881
+ }
13882
+ const minCharacterValue = codePointAt(minCharacter, 0);
13883
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
13884
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13885
+ error2(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
13886
+ }
13887
+ }
13888
+ }
13889
+ }
13890
+ function scanClassSetExpression() {
13891
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 91 /* openBracket */);
13892
+ let isCharacterComplement = false;
13893
+ if (charCodeChecked(pos) === 94 /* caret */) {
13894
+ pos++;
13895
+ isCharacterComplement = true;
13896
+ }
13897
+ let expressionMayContainStrings = false;
13898
+ let ch = charCodeChecked(pos);
13899
+ if (isClassContentExit(ch)) {
13900
+ return;
13901
+ }
13902
+ let start2 = pos;
13903
+ let operand;
13904
+ switch (text.slice(pos, pos + 2)) {
13905
+ case "--":
13906
+ case "&&":
13907
+ error2(Diagnostics.Expected_a_class_set_operand);
13908
+ mayContainStrings = false;
13909
+ break;
13910
+ default:
13911
+ operand = scanClassSetOperand();
13912
+ break;
13913
+ }
13914
+ switch (charCodeChecked(pos)) {
13915
+ case 45 /* minus */:
13916
+ if (charCodeChecked(pos + 1) === 45 /* minus */) {
13917
+ if (isCharacterComplement && mayContainStrings) {
13918
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13850
13919
  }
13851
- if (!minCharacter && !annexB) {
13852
- error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
13920
+ expressionMayContainStrings = mayContainStrings;
13921
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
13922
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13923
+ return;
13924
+ }
13925
+ break;
13926
+ case 38 /* ampersand */:
13927
+ if (charCodeChecked(pos + 1) === 38 /* ampersand */) {
13928
+ scanClassSetSubExpression(2 /* ClassIntersection */);
13929
+ if (isCharacterComplement && mayContainStrings) {
13930
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13853
13931
  }
13854
- const maxStart = pos;
13855
- const maxCharacter = scanClassAtom();
13856
- if (!maxCharacter && !annexB) {
13857
- error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
13858
- continue;
13932
+ expressionMayContainStrings = mayContainStrings;
13933
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13934
+ return;
13935
+ } else {
13936
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13937
+ }
13938
+ break;
13939
+ default:
13940
+ if (isCharacterComplement && mayContainStrings) {
13941
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
13942
+ }
13943
+ expressionMayContainStrings = mayContainStrings;
13944
+ break;
13945
+ }
13946
+ while (true) {
13947
+ ch = charCodeChecked(pos);
13948
+ if (ch === -1 /* EOF */) {
13949
+ break;
13950
+ }
13951
+ switch (ch) {
13952
+ case 45 /* minus */:
13953
+ pos++;
13954
+ ch = charCodeChecked(pos);
13955
+ if (isClassContentExit(ch)) {
13956
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13957
+ return;
13859
13958
  }
13860
- if (!minCharacter) {
13959
+ if (ch === 45 /* minus */) {
13960
+ pos++;
13961
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13962
+ start2 = pos - 2;
13963
+ operand = text.slice(start2, pos);
13861
13964
  continue;
13965
+ } else {
13966
+ if (!operand) {
13967
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
13968
+ }
13969
+ const secondStart = pos;
13970
+ const secondOperand = scanClassSetOperand();
13971
+ if (isCharacterComplement && mayContainStrings) {
13972
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
13973
+ }
13974
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
13975
+ if (!secondOperand) {
13976
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
13977
+ break;
13978
+ }
13979
+ if (!operand) {
13980
+ break;
13981
+ }
13982
+ const minCharacterValue = codePointAt(operand, 0);
13983
+ const maxCharacterValue = codePointAt(secondOperand, 0);
13984
+ if (operand.length === charSize(minCharacterValue) && secondOperand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13985
+ error2(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
13986
+ }
13862
13987
  }
13863
- const minCharacterValue = codePointAt(minCharacter, 0);
13864
- const maxCharacterValue = codePointAt(maxCharacter, 0);
13865
- if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13866
- error2(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
13988
+ break;
13989
+ case 38 /* ampersand */:
13990
+ start2 = pos;
13991
+ pos++;
13992
+ if (charCodeChecked(pos) === 38 /* ampersand */) {
13993
+ pos++;
13994
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13995
+ if (charCodeChecked(pos) === 38 /* ampersand */) {
13996
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13997
+ pos++;
13998
+ }
13999
+ } else {
14000
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13867
14001
  }
13868
- }
13869
- }
13870
- }
13871
- function scanClassSetExpression() {
13872
- Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13873
- let isCharacterComplement = false;
13874
- if (text2.charCodeAt(pos) === 94 /* caret */) {
13875
- pos++;
13876
- isCharacterComplement = true;
14002
+ operand = text.slice(start2, pos);
14003
+ continue;
13877
14004
  }
13878
- let expressionMayContainStrings = false;
13879
- let ch = text2.charCodeAt(pos);
13880
- if (isClassContentExit(ch)) {
13881
- return;
14005
+ if (isClassContentExit(charCodeChecked(pos))) {
14006
+ break;
13882
14007
  }
13883
- let start2 = pos;
13884
- let oprand;
13885
- switch (text2.slice(pos, pos + 2)) {
14008
+ start2 = pos;
14009
+ switch (text.slice(pos, pos + 2)) {
13886
14010
  case "--":
13887
14011
  case "&&":
13888
- error2(Diagnostics.Expected_a_class_set_oprand);
13889
- mayContainStrings = false;
14012
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
14013
+ pos += 2;
14014
+ operand = text.slice(start2, pos);
13890
14015
  break;
13891
14016
  default:
13892
- oprand = scanClassSetOprand();
14017
+ operand = scanClassSetOperand();
13893
14018
  break;
13894
14019
  }
13895
- switch (text2.charCodeAt(pos)) {
14020
+ }
14021
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
14022
+ }
14023
+ function scanClassSetSubExpression(expressionType) {
14024
+ let expressionMayContainStrings = mayContainStrings;
14025
+ while (true) {
14026
+ let ch = charCodeChecked(pos);
14027
+ if (isClassContentExit(ch)) {
14028
+ break;
14029
+ }
14030
+ switch (ch) {
13896
14031
  case 45 /* minus */:
13897
- if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
13898
- if (isCharacterComplement && mayContainStrings) {
13899
- error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
14032
+ pos++;
14033
+ if (charCodeChecked(pos) === 45 /* minus */) {
14034
+ pos++;
14035
+ if (expressionType !== 3 /* ClassSubtraction */) {
14036
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13900
14037
  }
13901
- expressionMayContainStrings = mayContainStrings;
13902
- scanClassSetSubExpression(3 /* ClassSubtraction */);
13903
- mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13904
- return;
14038
+ } else {
14039
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
13905
14040
  }
13906
14041
  break;
13907
14042
  case 38 /* ampersand */:
13908
- if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
13909
- scanClassSetSubExpression(2 /* ClassIntersection */);
13910
- if (isCharacterComplement && mayContainStrings) {
13911
- error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
14043
+ pos++;
14044
+ if (charCodeChecked(pos) === 38 /* ampersand */) {
14045
+ pos++;
14046
+ if (expressionType !== 2 /* ClassIntersection */) {
14047
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
14048
+ }
14049
+ if (charCodeChecked(pos) === 38 /* ampersand */) {
14050
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14051
+ pos++;
13912
14052
  }
13913
- expressionMayContainStrings = mayContainStrings;
13914
- mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13915
- return;
13916
14053
  } else {
13917
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14054
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13918
14055
  }
13919
14056
  break;
13920
14057
  default:
13921
- if (isCharacterComplement && mayContainStrings) {
13922
- error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
14058
+ switch (expressionType) {
14059
+ case 3 /* ClassSubtraction */:
14060
+ error2(Diagnostics._0_expected, pos, 0, "--");
14061
+ break;
14062
+ case 2 /* ClassIntersection */:
14063
+ error2(Diagnostics._0_expected, pos, 0, "&&");
14064
+ break;
14065
+ default:
14066
+ break;
13923
14067
  }
13924
- expressionMayContainStrings = mayContainStrings;
13925
14068
  break;
13926
14069
  }
13927
- while (pos < end2) {
13928
- ch = text2.charCodeAt(pos);
13929
- switch (ch) {
13930
- case 45 /* minus */:
13931
- pos++;
13932
- ch = text2.charCodeAt(pos);
13933
- if (isClassContentExit(ch)) {
13934
- mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13935
- return;
13936
- }
13937
- if (ch === 45 /* minus */) {
13938
- pos++;
13939
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13940
- start2 = pos - 2;
13941
- oprand = text2.slice(start2, pos);
13942
- continue;
13943
- } else {
13944
- if (!oprand) {
13945
- error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
13946
- }
13947
- const secondStart = pos;
13948
- const secondOprand = scanClassSetOprand();
13949
- if (isCharacterComplement && mayContainStrings) {
13950
- error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
13951
- }
13952
- expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
13953
- if (!secondOprand) {
13954
- error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
13955
- break;
13956
- }
13957
- if (!oprand) {
13958
- break;
13959
- }
13960
- const minCharacterValue = codePointAt(oprand, 0);
13961
- const maxCharacterValue = codePointAt(secondOprand, 0);
13962
- if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13963
- error2(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
13964
- }
13965
- }
13966
- break;
13967
- case 38 /* ampersand */:
13968
- start2 = pos;
13969
- pos++;
13970
- if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13971
- pos++;
13972
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13973
- if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13974
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13975
- pos++;
13976
- }
13977
- } else {
13978
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13979
- }
13980
- oprand = text2.slice(start2, pos);
13981
- continue;
13982
- }
13983
- if (isClassContentExit(text2.charCodeAt(pos))) {
13984
- break;
13985
- }
13986
- start2 = pos;
13987
- switch (text2.slice(pos, pos + 2)) {
13988
- case "--":
13989
- case "&&":
13990
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
13991
- pos += 2;
13992
- oprand = text2.slice(start2, pos);
13993
- break;
13994
- default:
13995
- oprand = scanClassSetOprand();
13996
- break;
13997
- }
14070
+ ch = charCodeChecked(pos);
14071
+ if (isClassContentExit(ch)) {
14072
+ error2(Diagnostics.Expected_a_class_set_operand);
14073
+ break;
13998
14074
  }
13999
- mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
14075
+ scanClassSetOperand();
14076
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
14000
14077
  }
14001
- function scanClassSetSubExpression(expressionType) {
14002
- let expressionMayContainStrings = mayContainStrings;
14003
- while (pos < end2) {
14004
- let ch = text2.charCodeAt(pos);
14005
- if (isClassContentExit(ch)) {
14006
- break;
14007
- }
14008
- switch (ch) {
14009
- case 45 /* minus */:
14010
- pos++;
14011
- if (text2.charCodeAt(pos) === 45 /* minus */) {
14012
- pos++;
14013
- if (expressionType !== 3 /* ClassSubtraction */) {
14014
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
14015
- }
14016
- } else {
14017
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
14018
- }
14019
- break;
14020
- case 38 /* ampersand */:
14078
+ mayContainStrings = expressionMayContainStrings;
14079
+ }
14080
+ function scanClassSetOperand() {
14081
+ mayContainStrings = false;
14082
+ switch (charCodeChecked(pos)) {
14083
+ case -1 /* EOF */:
14084
+ return "";
14085
+ case 91 /* openBracket */:
14086
+ pos++;
14087
+ scanClassSetExpression();
14088
+ scanExpectedChar(93 /* closeBracket */);
14089
+ return "";
14090
+ case 92 /* backslash */:
14091
+ pos++;
14092
+ if (scanCharacterClassEscape()) {
14093
+ return "";
14094
+ } else if (charCodeChecked(pos) === 113 /* q */) {
14095
+ pos++;
14096
+ if (charCodeChecked(pos) === 123 /* openBrace */) {
14021
14097
  pos++;
14022
- if (text2.charCodeAt(pos) === 38 /* ampersand */) {
14023
- pos++;
14024
- if (expressionType !== 2 /* ClassIntersection */) {
14025
- error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
14026
- }
14027
- if (text2.charCodeAt(pos) === 38 /* ampersand */) {
14028
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14029
- pos++;
14030
- }
14031
- } else {
14032
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
14033
- }
14034
- break;
14035
- default:
14036
- switch (expressionType) {
14037
- case 3 /* ClassSubtraction */:
14038
- error2(Diagnostics._0_expected, pos, 0, "--");
14039
- break;
14040
- case 2 /* ClassIntersection */:
14041
- error2(Diagnostics._0_expected, pos, 0, "&&");
14042
- break;
14043
- default:
14044
- break;
14045
- }
14046
- break;
14098
+ scanClassStringDisjunctionContents();
14099
+ scanExpectedChar(125 /* closeBrace */);
14100
+ return "";
14101
+ } else {
14102
+ error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
14103
+ return "q";
14104
+ }
14047
14105
  }
14048
- ch = text2.charCodeAt(pos);
14049
- if (isClassContentExit(ch)) {
14050
- error2(Diagnostics.Expected_a_class_set_oprand);
14106
+ pos--;
14107
+ default:
14108
+ return scanClassSetCharacter();
14109
+ }
14110
+ }
14111
+ function scanClassStringDisjunctionContents() {
14112
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 123 /* openBrace */);
14113
+ let characterCount = 0;
14114
+ while (true) {
14115
+ const ch = charCodeChecked(pos);
14116
+ switch (ch) {
14117
+ case -1 /* EOF */:
14118
+ return;
14119
+ case 125 /* closeBrace */:
14120
+ if (characterCount !== 1) {
14121
+ mayContainStrings = true;
14122
+ }
14123
+ return;
14124
+ case 124 /* bar */:
14125
+ if (characterCount !== 1) {
14126
+ mayContainStrings = true;
14127
+ }
14128
+ pos++;
14129
+ start = pos;
14130
+ characterCount = 0;
14131
+ break;
14132
+ default:
14133
+ scanClassSetCharacter();
14134
+ characterCount++;
14051
14135
  break;
14052
- }
14053
- scanClassSetOprand();
14054
- expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
14055
14136
  }
14056
- mayContainStrings = expressionMayContainStrings;
14057
14137
  }
14058
- function scanClassSetOprand() {
14059
- mayContainStrings = false;
14060
- switch (text2.charCodeAt(pos)) {
14061
- case 91 /* openBracket */:
14138
+ }
14139
+ function scanClassSetCharacter() {
14140
+ const ch = charCodeChecked(pos);
14141
+ if (ch === -1 /* EOF */) {
14142
+ return "";
14143
+ }
14144
+ if (ch === 92 /* backslash */) {
14145
+ pos++;
14146
+ const ch2 = charCodeChecked(pos);
14147
+ switch (ch2) {
14148
+ case 98 /* b */:
14062
14149
  pos++;
14063
- scanClassSetExpression();
14064
- scanExpectedChar(93 /* closeBracket */);
14065
- return "";
14066
- case 92 /* backslash */:
14150
+ return "\b";
14151
+ case 38 /* ampersand */:
14152
+ case 45 /* minus */:
14153
+ case 33 /* exclamation */:
14154
+ case 35 /* hash */:
14155
+ case 37 /* percent */:
14156
+ case 44 /* comma */:
14157
+ case 58 /* colon */:
14158
+ case 59 /* semicolon */:
14159
+ case 60 /* lessThan */:
14160
+ case 61 /* equals */:
14161
+ case 62 /* greaterThan */:
14162
+ case 64 /* at */:
14163
+ case 96 /* backtick */:
14164
+ case 126 /* tilde */:
14067
14165
  pos++;
14068
- if (scanCharacterClassEscape()) {
14069
- return "";
14070
- } else if (text2.charCodeAt(pos) === 113 /* q */) {
14071
- pos++;
14072
- if (text2.charCodeAt(pos) === 123 /* openBrace */) {
14073
- pos++;
14074
- scanClassStringDisjunctionContents();
14075
- scanExpectedChar(125 /* closeBrace */);
14076
- return "";
14077
- } else {
14078
- error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
14079
- return "q";
14080
- }
14081
- }
14082
- pos--;
14166
+ return String.fromCharCode(ch2);
14083
14167
  default:
14084
- return scanClassSetCharacter();
14085
- }
14086
- }
14087
- function scanClassStringDisjunctionContents() {
14088
- Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
14089
- let characterCount = 0;
14090
- while (pos < end2) {
14091
- const ch = text2.charCodeAt(pos);
14092
- switch (ch) {
14093
- case 125 /* closeBrace */:
14094
- if (characterCount !== 1) {
14095
- mayContainStrings = true;
14096
- }
14097
- return;
14098
- case 124 /* bar */:
14099
- if (characterCount !== 1) {
14100
- mayContainStrings = true;
14101
- }
14102
- pos++;
14103
- start = pos;
14104
- characterCount = 0;
14105
- break;
14106
- default:
14107
- scanClassSetCharacter();
14108
- characterCount++;
14109
- break;
14110
- }
14168
+ return scanCharacterEscape(
14169
+ /*atomEscape*/
14170
+ false
14171
+ );
14172
+ }
14173
+ } else if (ch === charCodeChecked(pos + 1)) {
14174
+ switch (ch) {
14175
+ case 38 /* ampersand */:
14176
+ case 33 /* exclamation */:
14177
+ case 35 /* hash */:
14178
+ case 37 /* percent */:
14179
+ case 42 /* asterisk */:
14180
+ case 43 /* plus */:
14181
+ case 44 /* comma */:
14182
+ case 46 /* dot */:
14183
+ case 58 /* colon */:
14184
+ case 59 /* semicolon */:
14185
+ case 60 /* lessThan */:
14186
+ case 61 /* equals */:
14187
+ case 62 /* greaterThan */:
14188
+ case 63 /* question */:
14189
+ case 64 /* at */:
14190
+ case 96 /* backtick */:
14191
+ case 126 /* tilde */:
14192
+ error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
14193
+ pos += 2;
14194
+ return text.substring(pos - 2, pos);
14111
14195
  }
14112
14196
  }
14113
- function scanClassSetCharacter() {
14114
- const ch = text2.charCodeAt(pos);
14115
- if (ch === 92 /* backslash */) {
14197
+ switch (ch) {
14198
+ case 47 /* slash */:
14199
+ case 40 /* openParen */:
14200
+ case 41 /* closeParen */:
14201
+ case 91 /* openBracket */:
14202
+ case 93 /* closeBracket */:
14203
+ case 123 /* openBrace */:
14204
+ case 125 /* closeBrace */:
14205
+ case 45 /* minus */:
14206
+ case 124 /* bar */:
14207
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14116
14208
  pos++;
14117
- const ch2 = text2.charCodeAt(pos);
14118
- switch (ch2) {
14119
- case 98 /* b */:
14120
- pos++;
14121
- return "\b";
14122
- case 38 /* ampersand */:
14123
- case 45 /* minus */:
14124
- case 33 /* exclamation */:
14125
- case 35 /* hash */:
14126
- case 37 /* percent */:
14127
- case 44 /* comma */:
14128
- case 58 /* colon */:
14129
- case 59 /* semicolon */:
14130
- case 60 /* lessThan */:
14131
- case 61 /* equals */:
14132
- case 62 /* greaterThan */:
14133
- case 64 /* at */:
14134
- case 96 /* backtick */:
14135
- case 126 /* tilde */:
14136
- pos++;
14137
- return String.fromCharCode(ch2);
14138
- default:
14139
- return scanCharacterEscape(
14140
- /*atomEscape*/
14141
- false
14142
- );
14143
- }
14144
- } else if (ch === text2.charCodeAt(pos + 1)) {
14145
- switch (ch) {
14146
- case 38 /* ampersand */:
14147
- case 33 /* exclamation */:
14148
- case 35 /* hash */:
14149
- case 37 /* percent */:
14150
- case 42 /* asterisk */:
14151
- case 43 /* plus */:
14152
- case 44 /* comma */:
14153
- case 46 /* dot */:
14154
- case 58 /* colon */:
14155
- case 59 /* semicolon */:
14156
- case 60 /* lessThan */:
14157
- case 61 /* equals */:
14158
- case 62 /* greaterThan */:
14159
- case 63 /* question */:
14160
- case 64 /* at */:
14161
- case 96 /* backtick */:
14162
- case 126 /* tilde */:
14163
- error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
14164
- pos += 2;
14165
- return text2.substring(pos - 2, pos);
14166
- }
14167
- }
14209
+ return String.fromCharCode(ch);
14210
+ }
14211
+ return scanSourceCharacter();
14212
+ }
14213
+ function scanClassAtom() {
14214
+ if (charCodeChecked(pos) === 92 /* backslash */) {
14215
+ pos++;
14216
+ const ch = charCodeChecked(pos);
14168
14217
  switch (ch) {
14169
- case 47 /* slash */:
14170
- case 40 /* openParen */:
14171
- case 41 /* closeParen */:
14172
- case 91 /* openBracket */:
14173
- case 93 /* closeBracket */:
14174
- case 123 /* openBrace */:
14175
- case 125 /* closeBrace */:
14218
+ case 98 /* b */:
14219
+ pos++;
14220
+ return "\b";
14176
14221
  case 45 /* minus */:
14177
- case 124 /* bar */:
14178
- error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
14179
14222
  pos++;
14180
14223
  return String.fromCharCode(ch);
14224
+ default:
14225
+ if (scanCharacterClassEscape()) {
14226
+ return "";
14227
+ }
14228
+ return scanCharacterEscape(
14229
+ /*atomEscape*/
14230
+ false
14231
+ );
14181
14232
  }
14233
+ } else {
14182
14234
  return scanSourceCharacter();
14183
14235
  }
14184
- function scanClassAtom() {
14185
- if (text2.charCodeAt(pos) === 92 /* backslash */) {
14236
+ }
14237
+ function scanCharacterClassEscape() {
14238
+ Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
14239
+ let isCharacterComplement = false;
14240
+ const start2 = pos - 1;
14241
+ const ch = charCodeChecked(pos);
14242
+ switch (ch) {
14243
+ case 100 /* d */:
14244
+ case 68 /* D */:
14245
+ case 115 /* s */:
14246
+ case 83 /* S */:
14247
+ case 119 /* w */:
14248
+ case 87 /* W */:
14186
14249
  pos++;
14187
- const ch = text2.charCodeAt(pos);
14188
- switch (ch) {
14189
- case 98 /* b */:
14190
- pos++;
14191
- return "\b";
14192
- case 45 /* minus */:
14193
- pos++;
14194
- return String.fromCharCode(ch);
14195
- default:
14196
- if (scanCharacterClassEscape()) {
14197
- return "";
14198
- }
14199
- return scanCharacterEscape(
14200
- /*atomEscape*/
14201
- false
14202
- );
14203
- }
14204
- } else {
14205
- return scanSourceCharacter();
14206
- }
14207
- }
14208
- function scanCharacterClassEscape() {
14209
- Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
14210
- let isCharacterComplement = false;
14211
- const start2 = pos - 1;
14212
- const ch = text2.charCodeAt(pos);
14213
- switch (ch) {
14214
- case 100 /* d */:
14215
- case 68 /* D */:
14216
- case 115 /* s */:
14217
- case 83 /* S */:
14218
- case 119 /* w */:
14219
- case 87 /* W */:
14220
- pos++;
14221
- return true;
14222
- case 80 /* P */:
14223
- isCharacterComplement = true;
14224
- case 112 /* p */:
14250
+ return true;
14251
+ case 80 /* P */:
14252
+ isCharacterComplement = true;
14253
+ case 112 /* p */:
14254
+ pos++;
14255
+ if (charCodeChecked(pos) === 123 /* openBrace */) {
14225
14256
  pos++;
14226
- if (text2.charCodeAt(pos) === 123 /* openBrace */) {
14257
+ const propertyNameOrValueStart = pos;
14258
+ const propertyNameOrValue = scanWordCharacters();
14259
+ if (charCodeChecked(pos) === 61 /* equals */) {
14260
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
14261
+ if (pos === propertyNameOrValueStart) {
14262
+ error2(Diagnostics.Expected_a_Unicode_property_name);
14263
+ } else if (propertyName === void 0) {
14264
+ error2(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14265
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
14266
+ if (suggestion) {
14267
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14268
+ }
14269
+ }
14227
14270
  pos++;
14228
- const propertyNameOrValueStart = pos;
14229
- const propertyNameOrValue = scanWordCharacters();
14230
- if (text2.charCodeAt(pos) === 61 /* equals */) {
14231
- const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
14232
- if (pos === propertyNameOrValueStart) {
14233
- error2(Diagnostics.Expected_a_Unicode_property_name);
14234
- } else if (propertyName === void 0) {
14235
- error2(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14236
- const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
14237
- if (suggestion) {
14238
- error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14239
- }
14271
+ const propertyValueStart = pos;
14272
+ const propertyValue = scanWordCharacters();
14273
+ if (pos === propertyValueStart) {
14274
+ error2(Diagnostics.Expected_a_Unicode_property_value);
14275
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
14276
+ error2(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
14277
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
14278
+ if (suggestion) {
14279
+ error2(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
14240
14280
  }
14241
- pos++;
14242
- const propertyValueStart = pos;
14243
- const propertyValue = scanWordCharacters();
14244
- if (pos === propertyValueStart) {
14245
- error2(Diagnostics.Expected_a_Unicode_property_value);
14246
- } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
14247
- error2(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
14248
- const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
14249
- if (suggestion) {
14250
- error2(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
14251
- }
14281
+ }
14282
+ } else {
14283
+ if (pos === propertyNameOrValueStart) {
14284
+ error2(Diagnostics.Expected_a_Unicode_property_name_or_value);
14285
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
14286
+ if (!unicodeSetsMode) {
14287
+ error2(Diagnostics.Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14288
+ } else if (isCharacterComplement) {
14289
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14290
+ } else {
14291
+ mayContainStrings = true;
14252
14292
  }
14253
- } else {
14254
- if (pos === propertyNameOrValueStart) {
14255
- error2(Diagnostics.Expected_a_Unicode_property_name_or_value);
14256
- } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
14257
- if (!unicodeSetsMode) {
14258
- error2(Diagnostics.Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14259
- } else if (isCharacterComplement) {
14260
- error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14261
- } else {
14262
- mayContainStrings = true;
14263
- }
14264
- } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
14265
- error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14266
- const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
14267
- if (suggestion) {
14268
- error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14269
- }
14293
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
14294
+ error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
14295
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
14296
+ if (suggestion) {
14297
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14270
14298
  }
14271
14299
  }
14272
- scanExpectedChar(125 /* closeBrace */);
14273
- if (!unicodeMode) {
14274
- error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
14275
- }
14276
- } else if (unicodeMode) {
14277
- error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14278
14300
  }
14279
- return true;
14280
- }
14281
- return false;
14282
- }
14283
- function scanWordCharacters() {
14284
- let value = "";
14285
- while (pos < end2) {
14286
- const ch = text2.charCodeAt(pos);
14287
- if (!isWordCharacter(ch)) {
14288
- break;
14301
+ scanExpectedChar(125 /* closeBrace */);
14302
+ if (!unicodeMode) {
14303
+ error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
14304
+ }
14305
+ } else if (unicodeMode) {
14306
+ error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14289
14307
  }
14290
- value += String.fromCharCode(ch);
14291
- pos++;
14308
+ return true;
14309
+ }
14310
+ return false;
14311
+ }
14312
+ function scanWordCharacters() {
14313
+ let value = "";
14314
+ while (true) {
14315
+ const ch = charCodeChecked(pos);
14316
+ if (ch === -1 /* EOF */ || !isWordCharacter(ch)) {
14317
+ break;
14292
14318
  }
14293
- return value;
14319
+ value += String.fromCharCode(ch);
14320
+ pos++;
14321
+ }
14322
+ return value;
14323
+ }
14324
+ function scanSourceCharacter() {
14325
+ const size = unicodeMode ? charSize(charCodeChecked(pos)) : 1;
14326
+ pos += size;
14327
+ return size > 0 ? text.substring(pos - size, pos) : "";
14328
+ }
14329
+ function scanExpectedChar(ch) {
14330
+ if (charCodeChecked(pos) === ch) {
14331
+ pos++;
14332
+ } else {
14333
+ error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
14294
14334
  }
14295
- function scanSourceCharacter() {
14296
- const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
14297
- pos += size;
14298
- return text2.substring(pos - size, pos);
14335
+ }
14336
+ scanDisjunction(
14337
+ /*isInGroup*/
14338
+ false
14339
+ );
14340
+ forEach(groupNameReferences, (reference) => {
14341
+ if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
14342
+ error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
14299
14343
  }
14300
- function scanExpectedChar(ch) {
14301
- if (text2.charCodeAt(pos) === ch) {
14302
- pos++;
14344
+ });
14345
+ forEach(decimalEscapes, (escape) => {
14346
+ if (!annexB && escape.value > numberOfCapturingGroups) {
14347
+ if (numberOfCapturingGroups) {
14348
+ error2(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
14303
14349
  } else {
14304
- error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
14305
- }
14306
- }
14307
- scanDisjunction(
14308
- /*isInGroup*/
14309
- false
14310
- );
14311
- forEach(groupNameReferences, (reference) => {
14312
- if (!groupSpecifiers.has(reference.name)) {
14313
- error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
14350
+ error2(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
14314
14351
  }
14315
- });
14316
- forEach(decimalEscapes, (escape) => {
14317
- if (!annexB && escape.value > numberOfCapturingGroups) {
14318
- if (numberOfCapturingGroups) {
14319
- error2(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
14320
- } else {
14321
- error2(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
14322
- }
14323
- }
14324
- });
14325
- }
14326
- function checkRegularExpressionFlagAvailable(flag, pos2) {
14327
- const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
14328
- if (availableFrom && languageVersion < availableFrom) {
14329
- error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
14330
14352
  }
14353
+ });
14354
+ }
14355
+ function checkRegularExpressionFlagAvailable(flag, pos2) {
14356
+ const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
14357
+ if (availableFrom && languageVersion < availableFrom) {
14358
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
14331
14359
  }
14332
14360
  }
14333
14361
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
@@ -14395,9 +14423,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14395
14423
  if (pos >= end) {
14396
14424
  return token = 1 /* EndOfFileToken */;
14397
14425
  }
14398
- let char = text.charCodeAt(pos);
14426
+ let char = charCodeUnchecked(pos);
14399
14427
  if (char === 60 /* lessThan */) {
14400
- if (text.charCodeAt(pos + 1) === 47 /* slash */) {
14428
+ if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
14401
14429
  pos += 2;
14402
14430
  return token = 31 /* LessThanSlashToken */;
14403
14431
  }
@@ -14410,7 +14438,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14410
14438
  }
14411
14439
  let firstNonWhitespace = 0;
14412
14440
  while (pos < end) {
14413
- char = text.charCodeAt(pos);
14441
+ char = charCodeUnchecked(pos);
14414
14442
  if (char === 123 /* openBrace */) {
14415
14443
  break;
14416
14444
  }
@@ -14442,7 +14470,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14442
14470
  function scanJsxIdentifier() {
14443
14471
  if (tokenIsIdentifierOrKeyword(token)) {
14444
14472
  while (pos < end) {
14445
- const ch = text.charCodeAt(pos);
14473
+ const ch = charCodeUnchecked(pos);
14446
14474
  if (ch === 45 /* minus */) {
14447
14475
  tokenValue += "-";
14448
14476
  pos++;
@@ -14460,7 +14488,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14460
14488
  }
14461
14489
  function scanJsxAttributeValue() {
14462
14490
  fullStartPos = pos;
14463
- switch (text.charCodeAt(pos)) {
14491
+ switch (charCodeUnchecked(pos)) {
14464
14492
  case 34 /* doubleQuote */:
14465
14493
  case 39 /* singleQuote */:
14466
14494
  tokenValue = scanString(
@@ -14482,11 +14510,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14482
14510
  if (pos >= end) {
14483
14511
  return token = 1 /* EndOfFileToken */;
14484
14512
  }
14485
- for (let ch = text.charCodeAt(pos); pos < end && (!isLineBreak(ch) && ch !== 96 /* backtick */); ch = codePointAt(text, ++pos)) {
14513
+ for (let ch = charCodeUnchecked(pos); pos < end && (!isLineBreak(ch) && ch !== 96 /* backtick */); ch = codePointUnchecked(++pos)) {
14486
14514
  if (!inBackticks) {
14487
14515
  if (ch === 123 /* openBrace */) {
14488
14516
  break;
14489
- } else if (ch === 64 /* at */ && pos - 1 >= 0 && isWhiteSpaceSingleLine(text.charCodeAt(pos - 1)) && !(pos + 1 < end && isWhiteSpaceLike(text.charCodeAt(pos + 1)))) {
14517
+ } else if (ch === 64 /* at */ && pos - 1 >= 0 && isWhiteSpaceSingleLine(charCodeUnchecked(pos - 1)) && !(pos + 1 < end && isWhiteSpaceLike(charCodeUnchecked(pos + 1)))) {
14490
14518
  break;
14491
14519
  }
14492
14520
  }
@@ -14503,21 +14531,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14503
14531
  if (pos >= end) {
14504
14532
  return token = 1 /* EndOfFileToken */;
14505
14533
  }
14506
- const ch = codePointAt(text, pos);
14534
+ const ch = codePointUnchecked(pos);
14507
14535
  pos += charSize(ch);
14508
14536
  switch (ch) {
14509
14537
  case 9 /* tab */:
14510
14538
  case 11 /* verticalTab */:
14511
14539
  case 12 /* formFeed */:
14512
14540
  case 32 /* space */:
14513
- while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
14541
+ while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
14514
14542
  pos++;
14515
14543
  }
14516
14544
  return token = 5 /* WhitespaceTrivia */;
14517
14545
  case 64 /* at */:
14518
14546
  return token = 60 /* AtToken */;
14519
14547
  case 13 /* carriageReturn */:
14520
- if (text.charCodeAt(pos) === 10 /* lineFeed */) {
14548
+ if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
14521
14549
  pos++;
14522
14550
  }
14523
14551
  case 10 /* lineFeed */:
@@ -14573,7 +14601,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14573
14601
  }
14574
14602
  if (isIdentifierStart(ch, languageVersion)) {
14575
14603
  let char = ch;
14576
- while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === 45 /* minus */)
14604
+ while (pos < end && isIdentifierPart(char = codePointUnchecked(pos), languageVersion) || char === 45 /* minus */)
14577
14605
  pos += charSize(char);
14578
14606
  tokenValue = text.substring(tokenStart, pos);
14579
14607
  if (char === 92 /* backslash */) {
@@ -14683,6 +14711,9 @@ function charSize(ch) {
14683
14711
  if (ch >= 65536) {
14684
14712
  return 2;
14685
14713
  }
14714
+ if (ch === -1 /* EOF */) {
14715
+ return 0;
14716
+ }
14686
14717
  return 1;
14687
14718
  }
14688
14719
  function utf16EncodeAsStringFallback(codePoint) {
@@ -16442,35 +16473,6 @@ function packageIdToString(packageId) {
16442
16473
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
16443
16474
  return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
16444
16475
  }
16445
- function fileIncludeReasonIsEqual(a, b) {
16446
- if (a === b)
16447
- return true;
16448
- if (a.kind !== b.kind)
16449
- return false;
16450
- switch (a.kind) {
16451
- case 0 /* RootFile */:
16452
- Debug.type(b);
16453
- return a.index === b.index;
16454
- case 6 /* LibFile */:
16455
- Debug.type(b);
16456
- return a.index === b.index;
16457
- case 1 /* SourceFromProjectReference */:
16458
- case 2 /* OutputFromProjectReference */:
16459
- Debug.type(b);
16460
- return a.index === b.index;
16461
- case 3 /* Import */:
16462
- case 4 /* ReferenceFile */:
16463
- case 5 /* TypeReferenceDirective */:
16464
- case 7 /* LibReferenceDirective */:
16465
- Debug.type(b);
16466
- return a.file === b.file && a.index === b.index;
16467
- case 8 /* AutomaticTypeDirectiveFile */:
16468
- Debug.type(b);
16469
- return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
16470
- default:
16471
- return Debug.assertNever(a);
16472
- }
16473
- }
16474
16476
  function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
16475
16477
  Debug.assert(names.length === newResolutions.length);
16476
16478
  for (let i = 0; i < names.length; i++) {
@@ -17490,7 +17492,8 @@ function createFileDiagnosticFromMessageChain(file, start, length2, messageChain
17490
17492
  code: messageChain.code,
17491
17493
  category: messageChain.category,
17492
17494
  messageText: messageChain.next ? messageChain : messageChain.messageText,
17493
- relatedInformation
17495
+ relatedInformation,
17496
+ canonicalHead: messageChain.canonicalHead
17494
17497
  };
17495
17498
  }
17496
17499
  function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
@@ -17522,6 +17525,12 @@ function createDiagnosticForRange(sourceFile, range, message) {
17522
17525
  messageText: message.message
17523
17526
  };
17524
17527
  }
17528
+ function getCanonicalDiagnostic(message, ...args) {
17529
+ return {
17530
+ code: message.code,
17531
+ messageText: formatMessage(message, ...args)
17532
+ };
17533
+ }
17525
17534
  function getSpanOfTokenAtPosition(sourceFile, pos) {
17526
17535
  const scanner2 = createScanner(
17527
17536
  sourceFile.languageVersion,
@@ -21655,7 +21664,9 @@ function compareDiagnostics(d1, d2) {
21655
21664
  return compareDiagnosticsSkipRelatedInformation(d1, d2) || compareRelatedInformation(d1, d2) || 0 /* EqualTo */;
21656
21665
  }
21657
21666
  function compareDiagnosticsSkipRelatedInformation(d1, d2) {
21658
- return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */;
21667
+ const code1 = getDiagnosticCode(d1);
21668
+ const code2 = getDiagnosticCode(d2);
21669
+ return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(code1, code2) || compareMessageText(d1, d2) || 0 /* EqualTo */;
21659
21670
  }
21660
21671
  function compareRelatedInformation(d1, d2) {
21661
21672
  if (!d1.relatedInformation && !d2.relatedInformation) {
@@ -21669,21 +21680,32 @@ function compareRelatedInformation(d1, d2) {
21669
21680
  }
21670
21681
  return d1.relatedInformation ? -1 /* LessThan */ : 1 /* GreaterThan */;
21671
21682
  }
21672
- function compareMessageText(t1, t2) {
21673
- if (typeof t1 === "string" && typeof t2 === "string") {
21674
- return compareStringsCaseSensitive(t1, t2);
21683
+ function compareMessageText(d1, d2) {
21684
+ let headMsg1 = getDiagnosticMessage(d1);
21685
+ let headMsg2 = getDiagnosticMessage(d2);
21686
+ if (typeof headMsg1 !== "string") {
21687
+ headMsg1 = headMsg1.messageText;
21675
21688
  }
21676
- if (typeof t1 === "string") {
21677
- t1 = { messageText: t1 };
21689
+ if (typeof headMsg2 !== "string") {
21690
+ headMsg2 = headMsg2.messageText;
21678
21691
  }
21679
- if (typeof t2 === "string") {
21680
- t2 = { messageText: t2 };
21692
+ const chain1 = typeof d1.messageText !== "string" ? d1.messageText.next : void 0;
21693
+ const chain2 = typeof d2.messageText !== "string" ? d2.messageText.next : void 0;
21694
+ let res = compareStringsCaseSensitive(headMsg1, headMsg2);
21695
+ if (res) {
21696
+ return res;
21681
21697
  }
21682
- const res = compareStringsCaseSensitive(t1.messageText, t2.messageText);
21698
+ res = compareMessageChain(chain1, chain2);
21683
21699
  if (res) {
21684
21700
  return res;
21685
21701
  }
21686
- return compareMessageChain(t1.next, t2.next);
21702
+ if (d1.canonicalHead && !d2.canonicalHead) {
21703
+ return -1 /* LessThan */;
21704
+ }
21705
+ if (d2.canonicalHead && !d1.canonicalHead) {
21706
+ return 1 /* GreaterThan */;
21707
+ }
21708
+ return 0 /* EqualTo */;
21687
21709
  }
21688
21710
  function compareMessageChain(c1, c2) {
21689
21711
  if (c1 === void 0 && c2 === void 0) {
@@ -21737,7 +21759,19 @@ function compareMessageChainContent(c1, c2) {
21737
21759
  return 0 /* EqualTo */;
21738
21760
  }
21739
21761
  function diagnosticsEqualityComparer(d1, d2) {
21740
- return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) === 0 /* EqualTo */ && compareValues(d1.start, d2.start) === 0 /* EqualTo */ && compareValues(d1.length, d2.length) === 0 /* EqualTo */ && compareValues(d1.code, d2.code) === 0 /* EqualTo */ && messageTextEqualityComparer(d1.messageText, d2.messageText);
21762
+ const code1 = getDiagnosticCode(d1);
21763
+ const code2 = getDiagnosticCode(d2);
21764
+ const msg1 = getDiagnosticMessage(d1);
21765
+ const msg2 = getDiagnosticMessage(d2);
21766
+ return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) === 0 /* EqualTo */ && compareValues(d1.start, d2.start) === 0 /* EqualTo */ && compareValues(d1.length, d2.length) === 0 /* EqualTo */ && compareValues(code1, code2) === 0 /* EqualTo */ && messageTextEqualityComparer(msg1, msg2);
21767
+ }
21768
+ function getDiagnosticCode(d) {
21769
+ var _a;
21770
+ return ((_a = d.canonicalHead) == null ? void 0 : _a.code) || d.code;
21771
+ }
21772
+ function getDiagnosticMessage(d) {
21773
+ var _a;
21774
+ return ((_a = d.canonicalHead) == null ? void 0 : _a.messageText) || d.messageText;
21741
21775
  }
21742
21776
  function messageTextEqualityComparer(m1, m2) {
21743
21777
  const t1 = typeof m1 === "string" ? m1 : m1.messageText;
@@ -50579,6 +50613,14 @@ function createTypeChecker(host) {
50579
50613
  return void 0;
50580
50614
  return type;
50581
50615
  },
50616
+ createTypeReference: (target, typeArguments) => {
50617
+ if (target !== emptyGenericType && getObjectFlags(target) & 3 /* ClassOrInterface */) {
50618
+ const interfaceType = target;
50619
+ if (some(interfaceType.typeParameters)) {
50620
+ return createTypeReference(interfaceType, typeArguments);
50621
+ }
50622
+ }
50623
+ },
50582
50624
  isSymbolAccessible,
50583
50625
  isArrayType,
50584
50626
  isTupleType,
@@ -51049,7 +51091,6 @@ function createTypeChecker(host) {
51049
51091
  };
51050
51092
  var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
51051
51093
  var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
51052
- var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
51053
51094
  var asyncIterationTypesResolver = {
51054
51095
  iterableCacheKey: "iterationTypesOfAsyncIterable",
51055
51096
  iteratorCacheKey: "iterationTypesOfAsyncIterator",
@@ -51856,6 +51897,7 @@ function createTypeChecker(host) {
51856
51897
  );
51857
51898
  const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
51858
51899
  const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
51900
+ diagnostic.canonicalHead = getCanonicalDiagnostic(nameNotFoundMessage, diagnosticName(nameArg));
51859
51901
  addErrorOrSuggestion(!isUncheckedJS, diagnostic);
51860
51902
  if (suggestion.valueDeclaration) {
51861
51903
  addRelatedInfo(
@@ -52927,12 +52969,6 @@ function createTypeChecker(host) {
52927
52969
  }
52928
52970
  }
52929
52971
  }
52930
- function markConstEnumAliasAsReferenced(symbol) {
52931
- const links = getSymbolLinks(symbol);
52932
- if (!links.constEnumReferenced) {
52933
- links.constEnumReferenced = true;
52934
- }
52935
- }
52936
52972
  function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
52937
52973
  if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
52938
52974
  entityName = entityName.parent;
@@ -55193,7 +55229,36 @@ function createTypeChecker(host) {
55193
55229
  }
55194
55230
  let typeArgumentNodes;
55195
55231
  if (typeArguments.length > 0) {
55196
- const typeParameterCount = (type2.target.typeParameters || emptyArray).length;
55232
+ let typeParameterCount;
55233
+ if (type2.target.typeParameters) {
55234
+ typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
55235
+ if (isReferenceToType2(type2, getGlobalIterableType(
55236
+ /*reportErrors*/
55237
+ false
55238
+ )) || isReferenceToType2(type2, getGlobalIterableIteratorType(
55239
+ /*reportErrors*/
55240
+ false
55241
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableType(
55242
+ /*reportErrors*/
55243
+ false
55244
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableIteratorType(
55245
+ /*reportErrors*/
55246
+ false
55247
+ ))) {
55248
+ if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
55249
+ while (typeParameterCount > 0) {
55250
+ const typeArgument = typeArguments[typeParameterCount - 1];
55251
+ const defaultType = getDefaultFromTypeParameter(type2.target.typeParameters[typeParameterCount - 1]);
55252
+ if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
55253
+ break;
55254
+ }
55255
+ typeParameterCount--;
55256
+ }
55257
+ }
55258
+ }
55259
+ } else {
55260
+ typeParameterCount = 0;
55261
+ }
55197
55262
  typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
55198
55263
  }
55199
55264
  const flags = context.flags;
@@ -59634,7 +59699,7 @@ function createTypeChecker(host) {
59634
59699
  }
59635
59700
  type = anyType;
59636
59701
  }
59637
- links.type = type;
59702
+ links.type ?? (links.type = type);
59638
59703
  }
59639
59704
  return links.type;
59640
59705
  }
@@ -59652,7 +59717,7 @@ function createTypeChecker(host) {
59652
59717
  }
59653
59718
  writeType = anyType;
59654
59719
  }
59655
- links.writeType = writeType || getTypeOfAccessors(symbol);
59720
+ links.writeType ?? (links.writeType = writeType || getTypeOfAccessors(symbol));
59656
59721
  }
59657
59722
  return links.writeType;
59658
59723
  }
@@ -59729,10 +59794,10 @@ function createTypeChecker(host) {
59729
59794
  true
59730
59795
  );
59731
59796
  const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
59732
- links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType;
59797
+ links.type ?? (links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType);
59733
59798
  if (!popTypeResolution()) {
59734
59799
  reportCircularityError(exportSymbol ?? symbol);
59735
- return links.type = errorType;
59800
+ return links.type ?? (links.type = errorType);
59736
59801
  }
59737
59802
  }
59738
59803
  return links.type;
@@ -59998,7 +60063,7 @@ function createTypeChecker(host) {
59998
60063
  }
59999
60064
  if (!popTypeResolution()) {
60000
60065
  error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
60001
- return type.resolvedBaseConstructorType = errorType;
60066
+ return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
60002
60067
  }
60003
60068
  if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
60004
60069
  const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
@@ -60015,9 +60080,9 @@ function createTypeChecker(host) {
60015
60080
  addRelatedInfo(err, createDiagnosticForNode(baseConstructorType.symbol.declarations[0], Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
60016
60081
  }
60017
60082
  }
60018
- return type.resolvedBaseConstructorType = errorType;
60083
+ return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
60019
60084
  }
60020
- type.resolvedBaseConstructorType = baseConstructorType;
60085
+ type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = baseConstructorType);
60021
60086
  }
60022
60087
  return type.resolvedBaseConstructorType;
60023
60088
  }
@@ -60258,7 +60323,7 @@ function createTypeChecker(host) {
60258
60323
  error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
60259
60324
  }
60260
60325
  }
60261
- links.declaredType = type;
60326
+ links.declaredType ?? (links.declaredType = type);
60262
60327
  }
60263
60328
  return links.declaredType;
60264
60329
  }
@@ -61376,6 +61441,7 @@ function createTypeChecker(host) {
61376
61441
  }
61377
61442
  }
61378
61443
  function getTypeOfMappedSymbol(symbol) {
61444
+ var _a;
61379
61445
  if (!symbol.links.type) {
61380
61446
  const mappedType = symbol.links.mappedType;
61381
61447
  if (!pushTypeResolution(symbol, 0 /* Type */)) {
@@ -61394,7 +61460,7 @@ function createTypeChecker(host) {
61394
61460
  error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
61395
61461
  type = errorType;
61396
61462
  }
61397
- symbol.links.type = type;
61463
+ (_a = symbol.links).type ?? (_a.type = type);
61398
61464
  }
61399
61465
  return symbol.links.type;
61400
61466
  }
@@ -61747,7 +61813,7 @@ function createTypeChecker(host) {
61747
61813
  }
61748
61814
  result = circularConstraintType;
61749
61815
  }
61750
- t.immediateBaseConstraint = result || noConstraintType;
61816
+ t.immediateBaseConstraint ?? (t.immediateBaseConstraint = result || noConstraintType);
61751
61817
  }
61752
61818
  return t.immediateBaseConstraint;
61753
61819
  }
@@ -62621,7 +62687,7 @@ function createTypeChecker(host) {
62621
62687
  }
62622
62688
  type = anyType;
62623
62689
  }
62624
- signature.resolvedReturnType = type;
62690
+ signature.resolvedReturnType ?? (signature.resolvedReturnType = type);
62625
62691
  }
62626
62692
  return signature.resolvedReturnType;
62627
62693
  }
@@ -62967,9 +63033,9 @@ function createTypeChecker(host) {
62967
63033
  const node = type.node;
62968
63034
  const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
62969
63035
  if (popTypeResolution()) {
62970
- type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
63036
+ type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
62971
63037
  } else {
62972
- type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
63038
+ type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
62973
63039
  error2(
62974
63040
  type.node || currentNode,
62975
63041
  type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
@@ -63522,7 +63588,7 @@ function createTypeChecker(host) {
63522
63588
  return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
63523
63589
  "AsyncIterable",
63524
63590
  /*arity*/
63525
- 1,
63591
+ 3,
63526
63592
  reportErrors2
63527
63593
  )) || emptyGenericType;
63528
63594
  }
@@ -63538,7 +63604,7 @@ function createTypeChecker(host) {
63538
63604
  return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
63539
63605
  "AsyncIterableIterator",
63540
63606
  /*arity*/
63541
- 1,
63607
+ 3,
63542
63608
  reportErrors2
63543
63609
  )) || emptyGenericType;
63544
63610
  }
@@ -63554,7 +63620,7 @@ function createTypeChecker(host) {
63554
63620
  return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
63555
63621
  "Iterable",
63556
63622
  /*arity*/
63557
- 1,
63623
+ 3,
63558
63624
  reportErrors2
63559
63625
  )) || emptyGenericType;
63560
63626
  }
@@ -63570,7 +63636,7 @@ function createTypeChecker(host) {
63570
63636
  return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
63571
63637
  "IterableIterator",
63572
63638
  /*arity*/
63573
- 1,
63639
+ 3,
63574
63640
  reportErrors2
63575
63641
  )) || emptyGenericType;
63576
63642
  }
@@ -63752,7 +63818,7 @@ function createTypeChecker(host) {
63752
63818
  return createTypeFromGenericGlobalType(getGlobalIterableType(
63753
63819
  /*reportErrors*/
63754
63820
  true
63755
- ), [iteratedType]);
63821
+ ), [iteratedType, voidType, undefinedType]);
63756
63822
  }
63757
63823
  function createArrayType(elementType, readonly) {
63758
63824
  return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
@@ -68028,6 +68094,16 @@ function createTypeChecker(host) {
68028
68094
  errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
68029
68095
  }
68030
68096
  if (!headMessage2 && maybeSuppress) {
68097
+ const savedErrorState = captureErrorCalculationState();
68098
+ reportRelationError(headMessage2, source2, target2);
68099
+ let canonical;
68100
+ if (errorInfo && errorInfo !== savedErrorState.errorInfo) {
68101
+ canonical = { code: errorInfo.code, messageText: errorInfo.messageText };
68102
+ }
68103
+ resetErrorInfo(savedErrorState);
68104
+ if (canonical && errorInfo) {
68105
+ errorInfo.canonicalHead = canonical;
68106
+ }
68031
68107
  lastSkippedInfo = [source2, target2];
68032
68108
  return;
68033
68109
  }
@@ -70016,6 +70092,7 @@ function createTypeChecker(host) {
70016
70092
  if (!links.variances) {
70017
70093
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
70018
70094
  const oldVarianceComputation = inVarianceComputation;
70095
+ const saveResolutionStart = resolutionStart;
70019
70096
  if (!inVarianceComputation) {
70020
70097
  inVarianceComputation = true;
70021
70098
  resolutionStart = resolutionTargets.length;
@@ -70050,7 +70127,7 @@ function createTypeChecker(host) {
70050
70127
  }
70051
70128
  if (!oldVarianceComputation) {
70052
70129
  inVarianceComputation = false;
70053
- resolutionStart = 0;
70130
+ resolutionStart = saveResolutionStart;
70054
70131
  }
70055
70132
  links.variances = variances;
70056
70133
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
@@ -74243,7 +74320,7 @@ function createTypeChecker(host) {
74243
74320
  reportCircularityError(declaration.symbol);
74244
74321
  return true;
74245
74322
  }
74246
- links.parameterInitializerContainsUndefined = containsUndefined;
74323
+ links.parameterInitializerContainsUndefined ?? (links.parameterInitializerContainsUndefined = containsUndefined);
74247
74324
  }
74248
74325
  return links.parameterInitializerContainsUndefined;
74249
74326
  }
@@ -74305,8 +74382,6 @@ function createTypeChecker(host) {
74305
74382
  ) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
74306
74383
  if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
74307
74384
  markAliasSymbolAsReferenced(symbol);
74308
- } else {
74309
- markConstEnumAliasAsReferenced(symbol);
74310
74385
  }
74311
74386
  }
74312
74387
  }
@@ -76050,7 +76125,7 @@ function createTypeChecker(host) {
76050
76125
  }
76051
76126
  function checkGrammarRegularExpressionLiteral(node) {
76052
76127
  const sourceFile = getSourceFileOfNode(node);
76053
- if (!hasParseDiagnostics(sourceFile)) {
76128
+ if (!hasParseDiagnostics(sourceFile) && !node.isUnterminated) {
76054
76129
  let lastError;
76055
76130
  scanner2 ?? (scanner2 = createScanner(
76056
76131
  99 /* ESNext */,
@@ -79652,8 +79727,13 @@ function createTypeChecker(host) {
79652
79727
  if (cached && cached !== resolvingSignature && !candidatesOutArray) {
79653
79728
  return cached;
79654
79729
  }
79730
+ const saveResolutionStart = resolutionStart;
79731
+ if (!cached) {
79732
+ resolutionStart = resolutionTargets.length;
79733
+ }
79655
79734
  links.resolvedSignature = resolvingSignature;
79656
79735
  let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
79736
+ resolutionStart = saveResolutionStart;
79657
79737
  if (result !== resolvingSignature) {
79658
79738
  if (links.resolvedSignature !== resolvingSignature) {
79659
79739
  result = links.resolvedSignature;
@@ -80965,24 +81045,14 @@ function createTypeChecker(host) {
80965
81045
  void 0
80966
81046
  ) || unknownType;
80967
81047
  if (globalGeneratorType === emptyGenericType) {
80968
- const globalType = resolver.getGlobalIterableIteratorType(
81048
+ const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
80969
81049
  /*reportErrors*/
80970
81050
  false
80971
81051
  );
80972
- const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0;
80973
- const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
80974
- const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
80975
- if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
80976
- if (globalType !== emptyGenericType) {
80977
- return createTypeFromGenericGlobalType(globalType, [yieldType]);
80978
- }
80979
- resolver.getGlobalIterableIteratorType(
80980
- /*reportErrors*/
80981
- true
80982
- );
80983
- return emptyObjectType;
81052
+ if (globalIterableIteratorType !== emptyGenericType) {
81053
+ return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
80984
81054
  }
80985
- resolver.getGlobalGeneratorType(
81055
+ resolver.getGlobalIterableIteratorType(
80986
81056
  /*reportErrors*/
80987
81057
  true
80988
81058
  );
@@ -86118,41 +86188,14 @@ function createTypeChecker(host) {
86118
86188
  function getIterationTypesOfIterableCached(type, resolver) {
86119
86189
  return getCachedIterationTypes(type, resolver.iterableCacheKey);
86120
86190
  }
86121
- function getIterationTypesOfGlobalIterableType(globalType, resolver) {
86122
- const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
86123
- globalType,
86124
- resolver,
86125
- /*errorNode*/
86126
- void 0,
86127
- /*errorOutputContainer*/
86128
- void 0,
86129
- /*noCache*/
86130
- false
86131
- );
86132
- return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
86133
- }
86134
86191
  function getIterationTypesOfIterableFast(type, resolver) {
86135
- let globalType;
86136
- if (isReferenceToType2(type, globalType = resolver.getGlobalIterableType(
86192
+ if (isReferenceToType2(type, resolver.getGlobalIterableType(
86137
86193
  /*reportErrors*/
86138
86194
  false
86139
- )) || isReferenceToType2(type, globalType = resolver.getGlobalIterableIteratorType(
86195
+ )) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
86140
86196
  /*reportErrors*/
86141
86197
  false
86142
- ))) {
86143
- const [yieldType] = getTypeArguments(type);
86144
- const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
86145
- return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
86146
- yieldType,
86147
- /*errorNode*/
86148
- void 0
86149
- ) || yieldType, resolver.resolveIterationType(
86150
- returnType,
86151
- /*errorNode*/
86152
- void 0
86153
- ) || returnType, nextType));
86154
- }
86155
- if (isReferenceToType2(type, resolver.getGlobalGeneratorType(
86198
+ )) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
86156
86199
  /*reportErrors*/
86157
86200
  false
86158
86201
  ))) {
@@ -86197,10 +86240,10 @@ function createTypeChecker(host) {
86197
86240
  !!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
86198
86241
  /*reportErrors*/
86199
86242
  false
86200
- ) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
86243
+ ) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
86201
86244
  /*reportErrors*/
86202
86245
  false
86203
- ))
86246
+ ), [anyType, anyType, anyType]))
86204
86247
  );
86205
86248
  return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
86206
86249
  }
@@ -86230,26 +86273,10 @@ function createTypeChecker(host) {
86230
86273
  return getCachedIterationTypes(type, resolver.iteratorCacheKey);
86231
86274
  }
86232
86275
  function getIterationTypesOfIteratorFast(type, resolver) {
86233
- const globalType = resolver.getGlobalIterableIteratorType(
86276
+ if (isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
86234
86277
  /*reportErrors*/
86235
86278
  false
86236
- );
86237
- if (isReferenceToType2(type, globalType)) {
86238
- const [yieldType] = getTypeArguments(type);
86239
- const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
86240
- globalType,
86241
- resolver,
86242
- /*errorNode*/
86243
- void 0,
86244
- /*errorOutputContainer*/
86245
- void 0,
86246
- /*noCache*/
86247
- false
86248
- );
86249
- const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
86250
- return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
86251
- }
86252
- if (isReferenceToType2(type, resolver.getGlobalIteratorType(
86279
+ )) || isReferenceToType2(type, resolver.getGlobalIteratorType(
86253
86280
  /*reportErrors*/
86254
86281
  false
86255
86282
  )) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
@@ -125886,12 +125913,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125886
125913
  return file;
125887
125914
  }
125888
125915
  function addFileIncludeReason(file, reason) {
125889
- if (file) {
125890
- const existing = fileReasons.get(file.path);
125891
- if (some(existing, (r) => fileIncludeReasonIsEqual(r, reason)))
125892
- return;
125916
+ if (file)
125893
125917
  fileReasons.add(file.path, reason);
125894
- }
125895
125918
  }
125896
125919
  function addFileToFilesByName(file, path, fileName, redirectedPath) {
125897
125920
  if (redirectedPath) {
@@ -151878,7 +151901,9 @@ function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSit
151878
151901
  if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
151879
151902
  const exprType = checker.getTypeAtLocation(insertionSite);
151880
151903
  const asyncIter = checker.getAsyncIterableType();
151881
- if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
151904
+ const anyType = checker.getAnyType();
151905
+ const asyncIterInstantiation = asyncIter && checker.createTypeReference(asyncIter, [anyType, anyType, anyType]);
151906
+ if (asyncIterInstantiation && checker.isTypeAssignableTo(exprType, asyncIterInstantiation)) {
151882
151907
  const forOf = insertionSite.parent;
151883
151908
  changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
151884
151909
  return;
@@ -157724,7 +157749,7 @@ registerCodeFix({
157724
157749
  actions2,
157725
157750
  createCodeFixAction(
157726
157751
  addMissingParamFixId,
157727
- ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newParameters)),
157752
+ ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newParameters)),
157728
157753
  [length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name],
157729
157754
  addMissingParamFixId,
157730
157755
  Diagnostics.Add_all_missing_parameters
@@ -157736,7 +157761,7 @@ registerCodeFix({
157736
157761
  actions2,
157737
157762
  createCodeFixAction(
157738
157763
  addOptionalParamFixId,
157739
- ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newOptionalParameters)),
157764
+ ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newOptionalParameters)),
157740
157765
  [length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name],
157741
157766
  addOptionalParamFixId,
157742
157767
  Diagnostics.Add_all_optional_parameters
@@ -157750,10 +157775,10 @@ registerCodeFix({
157750
157775
  if (info) {
157751
157776
  const { declarations, newParameters, newOptionalParameters } = info;
157752
157777
  if (context.fixId === addMissingParamFixId) {
157753
- doChange19(changes, context.sourceFile, declarations, newParameters);
157778
+ doChange19(changes, context.program, context.preferences, context.host, declarations, newParameters);
157754
157779
  }
157755
157780
  if (context.fixId === addOptionalParamFixId) {
157756
- doChange19(changes, context.sourceFile, declarations, newOptionalParameters);
157781
+ doChange19(changes, context.program, context.preferences, context.host, declarations, newOptionalParameters);
157757
157782
  }
157758
157783
  }
157759
157784
  })
@@ -157833,14 +157858,17 @@ function tryGetName2(node) {
157833
157858
  function typeToTypeNode(checker, type, enclosingDeclaration) {
157834
157859
  return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
157835
157860
  }
157836
- function doChange19(changes, sourceFile, declarations, newParameters) {
157861
+ function doChange19(changes, program, preferences, host, declarations, newParameters) {
157862
+ const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
157837
157863
  forEach(declarations, (declaration) => {
157864
+ const sourceFile = getSourceFileOfNode(declaration);
157865
+ const importAdder = createImportAdder(sourceFile, program, preferences, host);
157838
157866
  if (length(declaration.parameters)) {
157839
157867
  changes.replaceNodeRangeWithNodes(
157840
157868
  sourceFile,
157841
157869
  first(declaration.parameters),
157842
157870
  last(declaration.parameters),
157843
- updateParameters(declaration, newParameters),
157871
+ updateParameters(importAdder, scriptTarget, declaration, newParameters),
157844
157872
  {
157845
157873
  joiner: ", ",
157846
157874
  indentation: 0,
@@ -157849,7 +157877,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
157849
157877
  }
157850
157878
  );
157851
157879
  } else {
157852
- forEach(updateParameters(declaration, newParameters), (parameter, index) => {
157880
+ forEach(updateParameters(importAdder, scriptTarget, declaration, newParameters), (parameter, index) => {
157853
157881
  if (length(declaration.parameters) === 0 && index === 0) {
157854
157882
  changes.insertNodeAt(sourceFile, declaration.parameters.end, parameter);
157855
157883
  } else {
@@ -157857,6 +157885,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
157857
157885
  }
157858
157886
  });
157859
157887
  }
157888
+ importAdder.writeFixes(changes);
157860
157889
  });
157861
157890
  }
157862
157891
  function isConvertibleSignatureDeclaration(node) {
@@ -157870,7 +157899,7 @@ function isConvertibleSignatureDeclaration(node) {
157870
157899
  return false;
157871
157900
  }
157872
157901
  }
157873
- function updateParameters(node, newParameters) {
157902
+ function updateParameters(importAdder, scriptTarget, node, newParameters) {
157874
157903
  const parameters = map(node.parameters, (p) => factory.createParameterDeclaration(
157875
157904
  p.modifiers,
157876
157905
  p.dotDotDotToken,
@@ -157890,7 +157919,7 @@ function updateParameters(node, newParameters) {
157890
157919
  declaration.dotDotDotToken,
157891
157920
  declaration.name,
157892
157921
  prev && prev.questionToken ? factory.createToken(58 /* QuestionToken */) : declaration.questionToken,
157893
- declaration.type,
157922
+ getParameterType(importAdder, declaration.type, scriptTarget),
157894
157923
  declaration.initializer
157895
157924
  )
157896
157925
  );
@@ -157931,6 +157960,14 @@ function createParameter(name, type, questionToken) {
157931
157960
  function isOptionalPos(declarations, pos) {
157932
157961
  return length(declarations) && some(declarations, (d) => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === void 0);
157933
157962
  }
157963
+ function getParameterType(importAdder, typeNode, scriptTarget) {
157964
+ const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
157965
+ if (importableReference) {
157966
+ importSymbols(importAdder, importableReference.symbols);
157967
+ return importableReference.typeNode;
157968
+ }
157969
+ return typeNode;
157970
+ }
157934
157971
 
157935
157972
  // src/services/codefixes/fixCannotFindModule.ts
157936
157973
  var fixName2 = "fixCannotFindModule";
@@ -178385,7 +178422,6 @@ __export(ts_exports2, {
178385
178422
  factory: () => factory,
178386
178423
  fileExtensionIs: () => fileExtensionIs,
178387
178424
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
178388
- fileIncludeReasonIsEqual: () => fileIncludeReasonIsEqual,
178389
178425
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
178390
178426
  fileShouldUseJavaScriptRequire: () => fileShouldUseJavaScriptRequire,
178391
178427
  filter: () => filter,
@@ -178499,6 +178535,7 @@ __export(ts_exports2, {
178499
178535
  getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
178500
178536
  getBuilderCreationParameters: () => getBuilderCreationParameters,
178501
178537
  getBuilderFileEmit: () => getBuilderFileEmit,
178538
+ getCanonicalDiagnostic: () => getCanonicalDiagnostic,
178502
178539
  getCheckFlags: () => getCheckFlags,
178503
178540
  getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
178504
178541
  getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
@@ -180986,7 +181023,7 @@ __export(ts_server_protocol_exports, {
180986
181023
  NewLineKind: () => NewLineKind2,
180987
181024
  OrganizeImportsMode: () => OrganizeImportsMode,
180988
181025
  PollingWatchKind: () => PollingWatchKind2,
180989
- ScriptTarget: () => ScriptTarget10,
181026
+ ScriptTarget: () => ScriptTarget11,
180990
181027
  SemicolonPreference: () => SemicolonPreference,
180991
181028
  WatchDirectoryKind: () => WatchDirectoryKind2,
180992
181029
  WatchFileKind: () => WatchFileKind2
@@ -181175,24 +181212,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
181175
181212
  NewLineKind3["Lf"] = "Lf";
181176
181213
  return NewLineKind3;
181177
181214
  })(NewLineKind2 || {});
181178
- var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
181179
- ScriptTarget11["ES3"] = "es3";
181180
- ScriptTarget11["ES5"] = "es5";
181181
- ScriptTarget11["ES6"] = "es6";
181182
- ScriptTarget11["ES2015"] = "es2015";
181183
- ScriptTarget11["ES2016"] = "es2016";
181184
- ScriptTarget11["ES2017"] = "es2017";
181185
- ScriptTarget11["ES2018"] = "es2018";
181186
- ScriptTarget11["ES2019"] = "es2019";
181187
- ScriptTarget11["ES2020"] = "es2020";
181188
- ScriptTarget11["ES2021"] = "es2021";
181189
- ScriptTarget11["ES2022"] = "es2022";
181190
- ScriptTarget11["ES2023"] = "es2023";
181191
- ScriptTarget11["ESNext"] = "esnext";
181192
- ScriptTarget11["JSON"] = "json";
181193
- ScriptTarget11["Latest"] = "esnext" /* ESNext */;
181194
- return ScriptTarget11;
181195
- })(ScriptTarget10 || {});
181215
+ var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
181216
+ ScriptTarget12["ES3"] = "es3";
181217
+ ScriptTarget12["ES5"] = "es5";
181218
+ ScriptTarget12["ES6"] = "es6";
181219
+ ScriptTarget12["ES2015"] = "es2015";
181220
+ ScriptTarget12["ES2016"] = "es2016";
181221
+ ScriptTarget12["ES2017"] = "es2017";
181222
+ ScriptTarget12["ES2018"] = "es2018";
181223
+ ScriptTarget12["ES2019"] = "es2019";
181224
+ ScriptTarget12["ES2020"] = "es2020";
181225
+ ScriptTarget12["ES2021"] = "es2021";
181226
+ ScriptTarget12["ES2022"] = "es2022";
181227
+ ScriptTarget12["ES2023"] = "es2023";
181228
+ ScriptTarget12["ESNext"] = "esnext";
181229
+ ScriptTarget12["JSON"] = "json";
181230
+ ScriptTarget12["Latest"] = "esnext" /* ESNext */;
181231
+ return ScriptTarget12;
181232
+ })(ScriptTarget11 || {});
181196
181233
  {
181197
181234
  }
181198
181235
 
@@ -192813,7 +192850,6 @@ if (typeof console !== "undefined") {
192813
192850
  factory,
192814
192851
  fileExtensionIs,
192815
192852
  fileExtensionIsOneOf,
192816
- fileIncludeReasonIsEqual,
192817
192853
  fileIncludeReasonToDiagnostics,
192818
192854
  fileShouldUseJavaScriptRequire,
192819
192855
  filter,
@@ -192927,6 +192963,7 @@ if (typeof console !== "undefined") {
192927
192963
  getBuildOrderFromAnyBuildOrder,
192928
192964
  getBuilderCreationParameters,
192929
192965
  getBuilderFileEmit,
192966
+ getCanonicalDiagnostic,
192930
192967
  getCheckFlags,
192931
192968
  getClassExtendsHeritageElement,
192932
192969
  getClassLikeDeclarationOfSymbol,