@typescript-deploys/pr-build 5.5.0-pr-58361-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/lib.es2015.iterable.d.ts +67 -67
- package/lib/lib.es2018.asynciterable.d.ts +5 -5
- package/lib/lib.es2020.bigint.d.ts +8 -8
- package/lib/lib.es2020.string.d.ts +1 -1
- package/lib/lib.es2020.symbol.wellknown.d.ts +1 -1
- package/lib/lib.es2022.intl.d.ts +1 -1
- package/lib/tsc.js +939 -931
- package/lib/typescript.js +999 -976
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -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.
|
|
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__ */ ((
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
return
|
|
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
|
-
|
|
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 =
|
|
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 (
|
|
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 (
|
|
12392
|
+
if (charCodeUnchecked(pos) === 48 /* _0 */) {
|
|
12380
12393
|
pos++;
|
|
12381
|
-
if (
|
|
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 (
|
|
12419
|
+
if (charCodeUnchecked(pos) === 46 /* dot */) {
|
|
12407
12420
|
pos++;
|
|
12408
12421
|
decimalFragment = scanNumberFragment();
|
|
12409
12422
|
}
|
|
12410
12423
|
let end2 = pos;
|
|
12411
|
-
if (
|
|
12424
|
+
if (charCodeUnchecked(pos) === 69 /* E */ || charCodeUnchecked(pos) === 101 /* e */) {
|
|
12412
12425
|
pos++;
|
|
12413
12426
|
tokenFlags |= 16 /* Scientific */;
|
|
12414
|
-
if (
|
|
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(
|
|
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(
|
|
12474
|
-
if (!isOctalDigit(
|
|
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 =
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 &&
|
|
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 &&
|
|
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 =
|
|
12650
|
+
const ch = charCodeUnchecked(pos);
|
|
12638
12651
|
pos++;
|
|
12639
12652
|
switch (ch) {
|
|
12640
12653
|
case 48 /* _0 */:
|
|
12641
|
-
if (pos >= end || !isDigit(
|
|
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(
|
|
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(
|
|
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 &&
|
|
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(
|
|
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" &&
|
|
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(
|
|
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(
|
|
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 &&
|
|
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 (
|
|
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 &&
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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 (
|
|
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 (
|
|
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 =
|
|
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 &&
|
|
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(
|
|
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 (
|
|
12980
|
-
if (
|
|
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 (
|
|
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 (
|
|
13004
|
-
if (
|
|
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 (
|
|
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 (
|
|
13034
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13022
13035
|
return pos += 2, token = 67 /* AsteriskEqualsToken */;
|
|
13023
13036
|
}
|
|
13024
|
-
if (
|
|
13025
|
-
if (
|
|
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 (
|
|
13050
|
+
if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
|
|
13038
13051
|
return pos += 2, token = 46 /* PlusPlusToken */;
|
|
13039
13052
|
}
|
|
13040
|
-
if (
|
|
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 (
|
|
13062
|
+
if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
|
|
13050
13063
|
return pos += 2, token = 47 /* MinusMinusToken */;
|
|
13051
13064
|
}
|
|
13052
|
-
if (
|
|
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(
|
|
13071
|
+
if (isDigit(charCodeUnchecked(pos + 1))) {
|
|
13059
13072
|
scanNumber();
|
|
13060
13073
|
return token = 9 /* NumericLiteral */;
|
|
13061
13074
|
}
|
|
13062
|
-
if (
|
|
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 (
|
|
13081
|
+
if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
13069
13082
|
pos += 2;
|
|
13070
13083
|
while (pos < end) {
|
|
13071
|
-
if (isLineBreak(
|
|
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 (
|
|
13101
|
+
if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
|
|
13089
13102
|
pos += 2;
|
|
13090
|
-
const isJSDoc2 =
|
|
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 =
|
|
13095
|
-
if (ch2 === 42 /* asterisk */ &&
|
|
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 (
|
|
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 && (
|
|
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 && (
|
|
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 && (
|
|
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 (
|
|
13195
|
-
if (
|
|
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 (
|
|
13213
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13201
13214
|
return pos += 2, token = 33 /* LessThanEqualsToken */;
|
|
13202
13215
|
}
|
|
13203
|
-
if (languageVariant === 1 /* JSX */ &&
|
|
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 (
|
|
13218
|
-
if (
|
|
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 (
|
|
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 (
|
|
13253
|
+
if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
|
|
13241
13254
|
return pos += 2, token = 29 /* QuestionDotToken */;
|
|
13242
13255
|
}
|
|
13243
|
-
if (
|
|
13244
|
-
if (
|
|
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 (
|
|
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 (
|
|
13276
|
-
if (
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 (
|
|
13414
|
-
if (
|
|
13415
|
-
if (
|
|
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 (
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
13505
|
-
pos = p;
|
|
13506
|
-
}
|
|
13507
|
-
tokenStart = saveTokenPos;
|
|
13519
|
+
tokenStart = saveTokenStart;
|
|
13508
13520
|
tokenFlags = saveTokenFlags;
|
|
13509
|
-
|
|
13510
|
-
|
|
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
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
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
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
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 (
|
|
13553
|
-
case
|
|
13554
|
-
case
|
|
13585
|
+
switch (charCodeChecked(pos)) {
|
|
13586
|
+
case 61 /* equals */:
|
|
13587
|
+
case 33 /* exclamation */:
|
|
13555
13588
|
pos++;
|
|
13556
|
-
isPreviousTermQuantifiable =
|
|
13557
|
-
break;
|
|
13558
|
-
default:
|
|
13559
|
-
scanAtomEscape();
|
|
13560
|
-
isPreviousTermQuantifiable = true;
|
|
13589
|
+
isPreviousTermQuantifiable = annexB;
|
|
13561
13590
|
break;
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
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
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
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
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
} else {
|
|
13612
|
-
numberOfCapturingGroups++;
|
|
13613
|
-
isPreviousTermQuantifiable = true;
|
|
13623
|
+
}
|
|
13624
|
+
scanExpectedChar(58 /* colon */);
|
|
13625
|
+
isPreviousTermQuantifiable = true;
|
|
13626
|
+
break;
|
|
13614
13627
|
}
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
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
|
|
13626
|
-
if (
|
|
13627
|
-
pos
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
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
|
-
|
|
13652
|
-
|
|
13653
|
-
case 42 /* asterisk */:
|
|
13654
|
-
case 43 /* plus */:
|
|
13655
|
-
case 63 /* question */:
|
|
13656
|
-
pos++;
|
|
13657
|
-
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
13658
|
-
pos++;
|
|
13658
|
+
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
13659
|
+
error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
13659
13660
|
}
|
|
13660
|
-
|
|
13661
|
-
|
|
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;
|
|
13687
|
-
}
|
|
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
|
-
isPreviousTermQuantifiable = true;
|
|
13693
|
-
break;
|
|
13694
|
-
case 47 /* slash */:
|
|
13695
|
-
case 124 /* bar */:
|
|
13696
|
-
return;
|
|
13697
|
-
default:
|
|
13698
|
-
scanSourceCharacter();
|
|
13699
13665
|
isPreviousTermQuantifiable = true;
|
|
13700
13666
|
break;
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
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 (
|
|
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
|
-
|
|
13741
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
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
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
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
|
-
|
|
13697
|
+
if (isInGroup) {
|
|
13698
|
+
return;
|
|
13699
|
+
}
|
|
13795
13700
|
case 93 /* closeBracket */:
|
|
13796
|
-
case 123 /* openBrace */:
|
|
13797
13701
|
case 125 /* closeBrace */:
|
|
13798
|
-
|
|
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
|
-
|
|
13709
|
+
isPreviousTermQuantifiable = true;
|
|
13710
|
+
break;
|
|
13711
|
+
case 47 /* slash */:
|
|
13712
|
+
case 124 /* bar */:
|
|
13713
|
+
return;
|
|
13801
13714
|
default:
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
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
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
if (
|
|
13820
|
-
|
|
13821
|
-
}
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
error2(Diagnostics.
|
|
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
|
-
|
|
13827
|
-
|
|
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
|
-
|
|
13831
|
-
|
|
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
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
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
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
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
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
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
|
-
|
|
13852
|
-
|
|
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
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
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 (
|
|
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
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
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
|
-
|
|
13879
|
-
|
|
13880
|
-
if (isClassContentExit(ch)) {
|
|
13881
|
-
return;
|
|
14005
|
+
if (isClassContentExit(charCodeChecked(pos))) {
|
|
14006
|
+
break;
|
|
13882
14007
|
}
|
|
13883
|
-
|
|
13884
|
-
|
|
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.
|
|
13889
|
-
|
|
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
|
-
|
|
14017
|
+
operand = scanClassSetOperand();
|
|
13893
14018
|
break;
|
|
13894
14019
|
}
|
|
13895
|
-
|
|
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
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
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
|
-
|
|
13902
|
-
|
|
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
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
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
|
-
|
|
13922
|
-
|
|
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
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
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
|
-
|
|
14075
|
+
scanClassSetOperand();
|
|
14076
|
+
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
14000
14077
|
}
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
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
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
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
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
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
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
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
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
case
|
|
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
|
-
|
|
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
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
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
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
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
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
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
|
|
14170
|
-
|
|
14171
|
-
|
|
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
|
-
|
|
14185
|
-
|
|
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
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
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
|
-
|
|
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
|
|
14229
|
-
const
|
|
14230
|
-
if (
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
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
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
error2(Diagnostics.
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
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
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
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
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
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
|
-
|
|
14291
|
-
|
|
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
|
-
|
|
14319
|
+
value += String.fromCharCode(ch);
|
|
14320
|
+
pos++;
|
|
14294
14321
|
}
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
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));
|
|
14299
14334
|
}
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
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);
|
|
14306
14343
|
}
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
error2(Diagnostics.
|
|
14314
|
-
}
|
|
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
|
-
}
|
|
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);
|
|
14349
|
+
} else {
|
|
14350
|
+
error2(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
|
|
14323
14351
|
}
|
|
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 =
|
|
14426
|
+
let char = charCodeUnchecked(pos);
|
|
14399
14427
|
if (char === 60 /* lessThan */) {
|
|
14400
|
-
if (
|
|
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 =
|
|
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 =
|
|
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 (
|
|
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 =
|
|
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(
|
|
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 =
|
|
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(
|
|
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 (
|
|
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 =
|
|
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) {
|
|
@@ -50582,6 +50613,14 @@ function createTypeChecker(host) {
|
|
|
50582
50613
|
return void 0;
|
|
50583
50614
|
return type;
|
|
50584
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
|
+
},
|
|
50585
50624
|
isSymbolAccessible,
|
|
50586
50625
|
isArrayType,
|
|
50587
50626
|
isTupleType,
|
|
@@ -51052,7 +51091,6 @@ function createTypeChecker(host) {
|
|
|
51052
51091
|
};
|
|
51053
51092
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
|
51054
51093
|
var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
|
|
51055
|
-
var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
|
|
51056
51094
|
var asyncIterationTypesResolver = {
|
|
51057
51095
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
|
51058
51096
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
|
@@ -52931,12 +52969,6 @@ function createTypeChecker(host) {
|
|
|
52931
52969
|
}
|
|
52932
52970
|
}
|
|
52933
52971
|
}
|
|
52934
|
-
function markConstEnumAliasAsReferenced(symbol) {
|
|
52935
|
-
const links = getSymbolLinks(symbol);
|
|
52936
|
-
if (!links.constEnumReferenced) {
|
|
52937
|
-
links.constEnumReferenced = true;
|
|
52938
|
-
}
|
|
52939
|
-
}
|
|
52940
52972
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
52941
52973
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
52942
52974
|
entityName = entityName.parent;
|
|
@@ -55197,7 +55229,36 @@ function createTypeChecker(host) {
|
|
|
55197
55229
|
}
|
|
55198
55230
|
let typeArgumentNodes;
|
|
55199
55231
|
if (typeArguments.length > 0) {
|
|
55200
|
-
|
|
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
|
+
}
|
|
55201
55262
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
55202
55263
|
}
|
|
55203
55264
|
const flags = context.flags;
|
|
@@ -59638,7 +59699,7 @@ function createTypeChecker(host) {
|
|
|
59638
59699
|
}
|
|
59639
59700
|
type = anyType;
|
|
59640
59701
|
}
|
|
59641
|
-
links.type = type;
|
|
59702
|
+
links.type ?? (links.type = type);
|
|
59642
59703
|
}
|
|
59643
59704
|
return links.type;
|
|
59644
59705
|
}
|
|
@@ -59656,7 +59717,7 @@ function createTypeChecker(host) {
|
|
|
59656
59717
|
}
|
|
59657
59718
|
writeType = anyType;
|
|
59658
59719
|
}
|
|
59659
|
-
links.writeType = writeType || getTypeOfAccessors(symbol);
|
|
59720
|
+
links.writeType ?? (links.writeType = writeType || getTypeOfAccessors(symbol));
|
|
59660
59721
|
}
|
|
59661
59722
|
return links.writeType;
|
|
59662
59723
|
}
|
|
@@ -59733,10 +59794,10 @@ function createTypeChecker(host) {
|
|
|
59733
59794
|
true
|
|
59734
59795
|
);
|
|
59735
59796
|
const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
|
|
59736
|
-
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);
|
|
59737
59798
|
if (!popTypeResolution()) {
|
|
59738
59799
|
reportCircularityError(exportSymbol ?? symbol);
|
|
59739
|
-
return links.type = errorType;
|
|
59800
|
+
return links.type ?? (links.type = errorType);
|
|
59740
59801
|
}
|
|
59741
59802
|
}
|
|
59742
59803
|
return links.type;
|
|
@@ -60002,7 +60063,7 @@ function createTypeChecker(host) {
|
|
|
60002
60063
|
}
|
|
60003
60064
|
if (!popTypeResolution()) {
|
|
60004
60065
|
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
60005
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
60066
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
60006
60067
|
}
|
|
60007
60068
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
60008
60069
|
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
@@ -60019,9 +60080,9 @@ function createTypeChecker(host) {
|
|
|
60019
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)));
|
|
60020
60081
|
}
|
|
60021
60082
|
}
|
|
60022
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
60083
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
60023
60084
|
}
|
|
60024
|
-
type.resolvedBaseConstructorType = baseConstructorType;
|
|
60085
|
+
type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = baseConstructorType);
|
|
60025
60086
|
}
|
|
60026
60087
|
return type.resolvedBaseConstructorType;
|
|
60027
60088
|
}
|
|
@@ -60262,7 +60323,7 @@ function createTypeChecker(host) {
|
|
|
60262
60323
|
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
60263
60324
|
}
|
|
60264
60325
|
}
|
|
60265
|
-
links.declaredType = type;
|
|
60326
|
+
links.declaredType ?? (links.declaredType = type);
|
|
60266
60327
|
}
|
|
60267
60328
|
return links.declaredType;
|
|
60268
60329
|
}
|
|
@@ -61380,6 +61441,7 @@ function createTypeChecker(host) {
|
|
|
61380
61441
|
}
|
|
61381
61442
|
}
|
|
61382
61443
|
function getTypeOfMappedSymbol(symbol) {
|
|
61444
|
+
var _a;
|
|
61383
61445
|
if (!symbol.links.type) {
|
|
61384
61446
|
const mappedType = symbol.links.mappedType;
|
|
61385
61447
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -61398,7 +61460,7 @@ function createTypeChecker(host) {
|
|
|
61398
61460
|
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
61399
61461
|
type = errorType;
|
|
61400
61462
|
}
|
|
61401
|
-
symbol.links.type = type;
|
|
61463
|
+
(_a = symbol.links).type ?? (_a.type = type);
|
|
61402
61464
|
}
|
|
61403
61465
|
return symbol.links.type;
|
|
61404
61466
|
}
|
|
@@ -61751,7 +61813,7 @@ function createTypeChecker(host) {
|
|
|
61751
61813
|
}
|
|
61752
61814
|
result = circularConstraintType;
|
|
61753
61815
|
}
|
|
61754
|
-
t.immediateBaseConstraint = result || noConstraintType;
|
|
61816
|
+
t.immediateBaseConstraint ?? (t.immediateBaseConstraint = result || noConstraintType);
|
|
61755
61817
|
}
|
|
61756
61818
|
return t.immediateBaseConstraint;
|
|
61757
61819
|
}
|
|
@@ -62625,7 +62687,7 @@ function createTypeChecker(host) {
|
|
|
62625
62687
|
}
|
|
62626
62688
|
type = anyType;
|
|
62627
62689
|
}
|
|
62628
|
-
signature.resolvedReturnType = type;
|
|
62690
|
+
signature.resolvedReturnType ?? (signature.resolvedReturnType = type);
|
|
62629
62691
|
}
|
|
62630
62692
|
return signature.resolvedReturnType;
|
|
62631
62693
|
}
|
|
@@ -62971,9 +63033,9 @@ function createTypeChecker(host) {
|
|
|
62971
63033
|
const node = type.node;
|
|
62972
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);
|
|
62973
63035
|
if (popTypeResolution()) {
|
|
62974
|
-
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
63036
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
|
|
62975
63037
|
} else {
|
|
62976
|
-
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);
|
|
62977
63039
|
error2(
|
|
62978
63040
|
type.node || currentNode,
|
|
62979
63041
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
@@ -63526,7 +63588,7 @@ function createTypeChecker(host) {
|
|
|
63526
63588
|
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
|
|
63527
63589
|
"AsyncIterable",
|
|
63528
63590
|
/*arity*/
|
|
63529
|
-
|
|
63591
|
+
3,
|
|
63530
63592
|
reportErrors2
|
|
63531
63593
|
)) || emptyGenericType;
|
|
63532
63594
|
}
|
|
@@ -63542,7 +63604,7 @@ function createTypeChecker(host) {
|
|
|
63542
63604
|
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
|
|
63543
63605
|
"AsyncIterableIterator",
|
|
63544
63606
|
/*arity*/
|
|
63545
|
-
|
|
63607
|
+
3,
|
|
63546
63608
|
reportErrors2
|
|
63547
63609
|
)) || emptyGenericType;
|
|
63548
63610
|
}
|
|
@@ -63558,7 +63620,7 @@ function createTypeChecker(host) {
|
|
|
63558
63620
|
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
|
|
63559
63621
|
"Iterable",
|
|
63560
63622
|
/*arity*/
|
|
63561
|
-
|
|
63623
|
+
3,
|
|
63562
63624
|
reportErrors2
|
|
63563
63625
|
)) || emptyGenericType;
|
|
63564
63626
|
}
|
|
@@ -63574,7 +63636,7 @@ function createTypeChecker(host) {
|
|
|
63574
63636
|
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
|
|
63575
63637
|
"IterableIterator",
|
|
63576
63638
|
/*arity*/
|
|
63577
|
-
|
|
63639
|
+
3,
|
|
63578
63640
|
reportErrors2
|
|
63579
63641
|
)) || emptyGenericType;
|
|
63580
63642
|
}
|
|
@@ -63756,7 +63818,7 @@ function createTypeChecker(host) {
|
|
|
63756
63818
|
return createTypeFromGenericGlobalType(getGlobalIterableType(
|
|
63757
63819
|
/*reportErrors*/
|
|
63758
63820
|
true
|
|
63759
|
-
), [iteratedType]);
|
|
63821
|
+
), [iteratedType, voidType, undefinedType]);
|
|
63760
63822
|
}
|
|
63761
63823
|
function createArrayType(elementType, readonly) {
|
|
63762
63824
|
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
|
@@ -70030,6 +70092,7 @@ function createTypeChecker(host) {
|
|
|
70030
70092
|
if (!links.variances) {
|
|
70031
70093
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
70032
70094
|
const oldVarianceComputation = inVarianceComputation;
|
|
70095
|
+
const saveResolutionStart = resolutionStart;
|
|
70033
70096
|
if (!inVarianceComputation) {
|
|
70034
70097
|
inVarianceComputation = true;
|
|
70035
70098
|
resolutionStart = resolutionTargets.length;
|
|
@@ -70064,7 +70127,7 @@ function createTypeChecker(host) {
|
|
|
70064
70127
|
}
|
|
70065
70128
|
if (!oldVarianceComputation) {
|
|
70066
70129
|
inVarianceComputation = false;
|
|
70067
|
-
resolutionStart =
|
|
70130
|
+
resolutionStart = saveResolutionStart;
|
|
70068
70131
|
}
|
|
70069
70132
|
links.variances = variances;
|
|
70070
70133
|
(_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
|
|
@@ -74257,7 +74320,7 @@ function createTypeChecker(host) {
|
|
|
74257
74320
|
reportCircularityError(declaration.symbol);
|
|
74258
74321
|
return true;
|
|
74259
74322
|
}
|
|
74260
|
-
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
74323
|
+
links.parameterInitializerContainsUndefined ?? (links.parameterInitializerContainsUndefined = containsUndefined);
|
|
74261
74324
|
}
|
|
74262
74325
|
return links.parameterInitializerContainsUndefined;
|
|
74263
74326
|
}
|
|
@@ -74319,8 +74382,6 @@ function createTypeChecker(host) {
|
|
|
74319
74382
|
) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
74320
74383
|
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
|
|
74321
74384
|
markAliasSymbolAsReferenced(symbol);
|
|
74322
|
-
} else {
|
|
74323
|
-
markConstEnumAliasAsReferenced(symbol);
|
|
74324
74385
|
}
|
|
74325
74386
|
}
|
|
74326
74387
|
}
|
|
@@ -76064,7 +76125,7 @@ function createTypeChecker(host) {
|
|
|
76064
76125
|
}
|
|
76065
76126
|
function checkGrammarRegularExpressionLiteral(node) {
|
|
76066
76127
|
const sourceFile = getSourceFileOfNode(node);
|
|
76067
|
-
if (!hasParseDiagnostics(sourceFile)) {
|
|
76128
|
+
if (!hasParseDiagnostics(sourceFile) && !node.isUnterminated) {
|
|
76068
76129
|
let lastError;
|
|
76069
76130
|
scanner2 ?? (scanner2 = createScanner(
|
|
76070
76131
|
99 /* ESNext */,
|
|
@@ -79666,8 +79727,13 @@ function createTypeChecker(host) {
|
|
|
79666
79727
|
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
|
79667
79728
|
return cached;
|
|
79668
79729
|
}
|
|
79730
|
+
const saveResolutionStart = resolutionStart;
|
|
79731
|
+
if (!cached) {
|
|
79732
|
+
resolutionStart = resolutionTargets.length;
|
|
79733
|
+
}
|
|
79669
79734
|
links.resolvedSignature = resolvingSignature;
|
|
79670
79735
|
let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
|
|
79736
|
+
resolutionStart = saveResolutionStart;
|
|
79671
79737
|
if (result !== resolvingSignature) {
|
|
79672
79738
|
if (links.resolvedSignature !== resolvingSignature) {
|
|
79673
79739
|
result = links.resolvedSignature;
|
|
@@ -80979,24 +81045,14 @@ function createTypeChecker(host) {
|
|
|
80979
81045
|
void 0
|
|
80980
81046
|
) || unknownType;
|
|
80981
81047
|
if (globalGeneratorType === emptyGenericType) {
|
|
80982
|
-
const
|
|
81048
|
+
const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
|
|
80983
81049
|
/*reportErrors*/
|
|
80984
81050
|
false
|
|
80985
81051
|
);
|
|
80986
|
-
|
|
80987
|
-
|
|
80988
|
-
const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
|
|
80989
|
-
if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
|
|
80990
|
-
if (globalType !== emptyGenericType) {
|
|
80991
|
-
return createTypeFromGenericGlobalType(globalType, [yieldType]);
|
|
80992
|
-
}
|
|
80993
|
-
resolver.getGlobalIterableIteratorType(
|
|
80994
|
-
/*reportErrors*/
|
|
80995
|
-
true
|
|
80996
|
-
);
|
|
80997
|
-
return emptyObjectType;
|
|
81052
|
+
if (globalIterableIteratorType !== emptyGenericType) {
|
|
81053
|
+
return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
|
|
80998
81054
|
}
|
|
80999
|
-
resolver.
|
|
81055
|
+
resolver.getGlobalIterableIteratorType(
|
|
81000
81056
|
/*reportErrors*/
|
|
81001
81057
|
true
|
|
81002
81058
|
);
|
|
@@ -86132,41 +86188,14 @@ function createTypeChecker(host) {
|
|
|
86132
86188
|
function getIterationTypesOfIterableCached(type, resolver) {
|
|
86133
86189
|
return getCachedIterationTypes(type, resolver.iterableCacheKey);
|
|
86134
86190
|
}
|
|
86135
|
-
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
86136
|
-
const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
|
|
86137
|
-
globalType,
|
|
86138
|
-
resolver,
|
|
86139
|
-
/*errorNode*/
|
|
86140
|
-
void 0,
|
|
86141
|
-
/*errorOutputContainer*/
|
|
86142
|
-
void 0,
|
|
86143
|
-
/*noCache*/
|
|
86144
|
-
false
|
|
86145
|
-
);
|
|
86146
|
-
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
86147
|
-
}
|
|
86148
86191
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
86149
|
-
|
|
86150
|
-
if (isReferenceToType2(type, globalType = resolver.getGlobalIterableType(
|
|
86192
|
+
if (isReferenceToType2(type, resolver.getGlobalIterableType(
|
|
86151
86193
|
/*reportErrors*/
|
|
86152
86194
|
false
|
|
86153
|
-
)) || isReferenceToType2(type,
|
|
86195
|
+
)) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
|
|
86154
86196
|
/*reportErrors*/
|
|
86155
86197
|
false
|
|
86156
|
-
))
|
|
86157
|
-
const [yieldType] = getTypeArguments(type);
|
|
86158
|
-
const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
|
|
86159
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
|
|
86160
|
-
yieldType,
|
|
86161
|
-
/*errorNode*/
|
|
86162
|
-
void 0
|
|
86163
|
-
) || yieldType, resolver.resolveIterationType(
|
|
86164
|
-
returnType,
|
|
86165
|
-
/*errorNode*/
|
|
86166
|
-
void 0
|
|
86167
|
-
) || returnType, nextType));
|
|
86168
|
-
}
|
|
86169
|
-
if (isReferenceToType2(type, resolver.getGlobalGeneratorType(
|
|
86198
|
+
)) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
|
|
86170
86199
|
/*reportErrors*/
|
|
86171
86200
|
false
|
|
86172
86201
|
))) {
|
|
@@ -86211,10 +86240,10 @@ function createTypeChecker(host) {
|
|
|
86211
86240
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
86212
86241
|
/*reportErrors*/
|
|
86213
86242
|
false
|
|
86214
|
-
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
86243
|
+
) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
|
|
86215
86244
|
/*reportErrors*/
|
|
86216
86245
|
false
|
|
86217
|
-
))
|
|
86246
|
+
), [anyType, anyType, anyType]))
|
|
86218
86247
|
);
|
|
86219
86248
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
86220
86249
|
}
|
|
@@ -86244,26 +86273,10 @@ function createTypeChecker(host) {
|
|
|
86244
86273
|
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
|
|
86245
86274
|
}
|
|
86246
86275
|
function getIterationTypesOfIteratorFast(type, resolver) {
|
|
86247
|
-
|
|
86276
|
+
if (isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
|
|
86248
86277
|
/*reportErrors*/
|
|
86249
86278
|
false
|
|
86250
|
-
)
|
|
86251
|
-
if (isReferenceToType2(type, globalType)) {
|
|
86252
|
-
const [yieldType] = getTypeArguments(type);
|
|
86253
|
-
const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
|
|
86254
|
-
globalType,
|
|
86255
|
-
resolver,
|
|
86256
|
-
/*errorNode*/
|
|
86257
|
-
void 0,
|
|
86258
|
-
/*errorOutputContainer*/
|
|
86259
|
-
void 0,
|
|
86260
|
-
/*noCache*/
|
|
86261
|
-
false
|
|
86262
|
-
);
|
|
86263
|
-
const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
86264
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
86265
|
-
}
|
|
86266
|
-
if (isReferenceToType2(type, resolver.getGlobalIteratorType(
|
|
86279
|
+
)) || isReferenceToType2(type, resolver.getGlobalIteratorType(
|
|
86267
86280
|
/*reportErrors*/
|
|
86268
86281
|
false
|
|
86269
86282
|
)) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
|
|
@@ -124043,6 +124056,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124043
124056
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
124044
124057
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
124045
124058
|
let { oldProgram } = createProgramOptions;
|
|
124059
|
+
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
124046
124060
|
let processingDefaultLibFiles;
|
|
124047
124061
|
let processingOtherFiles;
|
|
124048
124062
|
let files;
|
|
@@ -124329,7 +124343,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124329
124343
|
resolvedLibProcessing = void 0;
|
|
124330
124344
|
resolvedModulesProcessing = void 0;
|
|
124331
124345
|
resolvedTypeReferenceDirectiveNamesProcessing = void 0;
|
|
124332
|
-
let ignoreDeprecationsVersion;
|
|
124333
124346
|
const program = {
|
|
124334
124347
|
getRootFileNames: () => rootNames,
|
|
124335
124348
|
getSourceFile,
|
|
@@ -126581,26 +126594,22 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126581
126594
|
}
|
|
126582
126595
|
}
|
|
126583
126596
|
function getIgnoreDeprecationsVersion() {
|
|
126584
|
-
|
|
126585
|
-
|
|
126586
|
-
|
|
126587
|
-
|
|
126588
|
-
if (ignoreDeprecations === "5.0") {
|
|
126589
|
-
ignoreDeprecationsVersion = new Version(ignoreDeprecations);
|
|
126590
|
-
} else {
|
|
126591
|
-
createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations);
|
|
126592
|
-
}
|
|
126597
|
+
const ignoreDeprecations = options.ignoreDeprecations;
|
|
126598
|
+
if (ignoreDeprecations) {
|
|
126599
|
+
if (ignoreDeprecations === "5.0") {
|
|
126600
|
+
return new Version(ignoreDeprecations);
|
|
126593
126601
|
}
|
|
126602
|
+
reportInvalidIgnoreDeprecations();
|
|
126594
126603
|
}
|
|
126595
|
-
return
|
|
126604
|
+
return Version.zero;
|
|
126596
126605
|
}
|
|
126597
126606
|
function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) {
|
|
126598
126607
|
const deprecatedInVersion = new Version(deprecatedIn);
|
|
126599
126608
|
const removedInVersion = new Version(removedIn);
|
|
126600
126609
|
const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor);
|
|
126601
|
-
const
|
|
126610
|
+
const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion();
|
|
126602
126611
|
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
|
126603
|
-
const canBeSilenced = !mustBeRemoved &&
|
|
126612
|
+
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
|
126604
126613
|
if (mustBeRemoved || canBeSilenced) {
|
|
126605
126614
|
fn((name, value, useInstead) => {
|
|
126606
126615
|
if (mustBeRemoved) {
|
|
@@ -151892,7 +151901,9 @@ function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSit
|
|
|
151892
151901
|
if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
|
|
151893
151902
|
const exprType = checker.getTypeAtLocation(insertionSite);
|
|
151894
151903
|
const asyncIter = checker.getAsyncIterableType();
|
|
151895
|
-
|
|
151904
|
+
const anyType = checker.getAnyType();
|
|
151905
|
+
const asyncIterInstantiation = asyncIter && checker.createTypeReference(asyncIter, [anyType, anyType, anyType]);
|
|
151906
|
+
if (asyncIterInstantiation && checker.isTypeAssignableTo(exprType, asyncIterInstantiation)) {
|
|
151896
151907
|
const forOf = insertionSite.parent;
|
|
151897
151908
|
changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
|
|
151898
151909
|
return;
|
|
@@ -157738,7 +157749,7 @@ registerCodeFix({
|
|
|
157738
157749
|
actions2,
|
|
157739
157750
|
createCodeFixAction(
|
|
157740
157751
|
addMissingParamFixId,
|
|
157741
|
-
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.
|
|
157752
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newParameters)),
|
|
157742
157753
|
[length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name],
|
|
157743
157754
|
addMissingParamFixId,
|
|
157744
157755
|
Diagnostics.Add_all_missing_parameters
|
|
@@ -157750,7 +157761,7 @@ registerCodeFix({
|
|
|
157750
157761
|
actions2,
|
|
157751
157762
|
createCodeFixAction(
|
|
157752
157763
|
addOptionalParamFixId,
|
|
157753
|
-
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.
|
|
157764
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newOptionalParameters)),
|
|
157754
157765
|
[length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name],
|
|
157755
157766
|
addOptionalParamFixId,
|
|
157756
157767
|
Diagnostics.Add_all_optional_parameters
|
|
@@ -157764,10 +157775,10 @@ registerCodeFix({
|
|
|
157764
157775
|
if (info) {
|
|
157765
157776
|
const { declarations, newParameters, newOptionalParameters } = info;
|
|
157766
157777
|
if (context.fixId === addMissingParamFixId) {
|
|
157767
|
-
doChange19(changes, context.
|
|
157778
|
+
doChange19(changes, context.program, context.preferences, context.host, declarations, newParameters);
|
|
157768
157779
|
}
|
|
157769
157780
|
if (context.fixId === addOptionalParamFixId) {
|
|
157770
|
-
doChange19(changes, context.
|
|
157781
|
+
doChange19(changes, context.program, context.preferences, context.host, declarations, newOptionalParameters);
|
|
157771
157782
|
}
|
|
157772
157783
|
}
|
|
157773
157784
|
})
|
|
@@ -157847,14 +157858,17 @@ function tryGetName2(node) {
|
|
|
157847
157858
|
function typeToTypeNode(checker, type, enclosingDeclaration) {
|
|
157848
157859
|
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
157849
157860
|
}
|
|
157850
|
-
function doChange19(changes,
|
|
157861
|
+
function doChange19(changes, program, preferences, host, declarations, newParameters) {
|
|
157862
|
+
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
157851
157863
|
forEach(declarations, (declaration) => {
|
|
157864
|
+
const sourceFile = getSourceFileOfNode(declaration);
|
|
157865
|
+
const importAdder = createImportAdder(sourceFile, program, preferences, host);
|
|
157852
157866
|
if (length(declaration.parameters)) {
|
|
157853
157867
|
changes.replaceNodeRangeWithNodes(
|
|
157854
157868
|
sourceFile,
|
|
157855
157869
|
first(declaration.parameters),
|
|
157856
157870
|
last(declaration.parameters),
|
|
157857
|
-
updateParameters(declaration, newParameters),
|
|
157871
|
+
updateParameters(importAdder, scriptTarget, declaration, newParameters),
|
|
157858
157872
|
{
|
|
157859
157873
|
joiner: ", ",
|
|
157860
157874
|
indentation: 0,
|
|
@@ -157863,7 +157877,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
|
157863
157877
|
}
|
|
157864
157878
|
);
|
|
157865
157879
|
} else {
|
|
157866
|
-
forEach(updateParameters(declaration, newParameters), (parameter, index) => {
|
|
157880
|
+
forEach(updateParameters(importAdder, scriptTarget, declaration, newParameters), (parameter, index) => {
|
|
157867
157881
|
if (length(declaration.parameters) === 0 && index === 0) {
|
|
157868
157882
|
changes.insertNodeAt(sourceFile, declaration.parameters.end, parameter);
|
|
157869
157883
|
} else {
|
|
@@ -157871,6 +157885,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
|
157871
157885
|
}
|
|
157872
157886
|
});
|
|
157873
157887
|
}
|
|
157888
|
+
importAdder.writeFixes(changes);
|
|
157874
157889
|
});
|
|
157875
157890
|
}
|
|
157876
157891
|
function isConvertibleSignatureDeclaration(node) {
|
|
@@ -157884,7 +157899,7 @@ function isConvertibleSignatureDeclaration(node) {
|
|
|
157884
157899
|
return false;
|
|
157885
157900
|
}
|
|
157886
157901
|
}
|
|
157887
|
-
function updateParameters(node, newParameters) {
|
|
157902
|
+
function updateParameters(importAdder, scriptTarget, node, newParameters) {
|
|
157888
157903
|
const parameters = map(node.parameters, (p) => factory.createParameterDeclaration(
|
|
157889
157904
|
p.modifiers,
|
|
157890
157905
|
p.dotDotDotToken,
|
|
@@ -157904,7 +157919,7 @@ function updateParameters(node, newParameters) {
|
|
|
157904
157919
|
declaration.dotDotDotToken,
|
|
157905
157920
|
declaration.name,
|
|
157906
157921
|
prev && prev.questionToken ? factory.createToken(58 /* QuestionToken */) : declaration.questionToken,
|
|
157907
|
-
declaration.type,
|
|
157922
|
+
getParameterType(importAdder, declaration.type, scriptTarget),
|
|
157908
157923
|
declaration.initializer
|
|
157909
157924
|
)
|
|
157910
157925
|
);
|
|
@@ -157945,6 +157960,14 @@ function createParameter(name, type, questionToken) {
|
|
|
157945
157960
|
function isOptionalPos(declarations, pos) {
|
|
157946
157961
|
return length(declarations) && some(declarations, (d) => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === void 0);
|
|
157947
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
|
+
}
|
|
157948
157971
|
|
|
157949
157972
|
// src/services/codefixes/fixCannotFindModule.ts
|
|
157950
157973
|
var fixName2 = "fixCannotFindModule";
|
|
@@ -181000,7 +181023,7 @@ __export(ts_server_protocol_exports, {
|
|
|
181000
181023
|
NewLineKind: () => NewLineKind2,
|
|
181001
181024
|
OrganizeImportsMode: () => OrganizeImportsMode,
|
|
181002
181025
|
PollingWatchKind: () => PollingWatchKind2,
|
|
181003
|
-
ScriptTarget: () =>
|
|
181026
|
+
ScriptTarget: () => ScriptTarget11,
|
|
181004
181027
|
SemicolonPreference: () => SemicolonPreference,
|
|
181005
181028
|
WatchDirectoryKind: () => WatchDirectoryKind2,
|
|
181006
181029
|
WatchFileKind: () => WatchFileKind2
|
|
@@ -181189,24 +181212,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
181189
181212
|
NewLineKind3["Lf"] = "Lf";
|
|
181190
181213
|
return NewLineKind3;
|
|
181191
181214
|
})(NewLineKind2 || {});
|
|
181192
|
-
var
|
|
181193
|
-
|
|
181194
|
-
|
|
181195
|
-
|
|
181196
|
-
|
|
181197
|
-
|
|
181198
|
-
|
|
181199
|
-
|
|
181200
|
-
|
|
181201
|
-
|
|
181202
|
-
|
|
181203
|
-
|
|
181204
|
-
|
|
181205
|
-
|
|
181206
|
-
|
|
181207
|
-
|
|
181208
|
-
return
|
|
181209
|
-
})(
|
|
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 || {});
|
|
181210
181233
|
{
|
|
181211
181234
|
}
|
|
181212
181235
|
|