typescript 5.5.0-dev.20240428 → 5.5.0-dev.20240430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +931 -851
- package/lib/typescript.js +991 -895
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -685,6 +685,7 @@ __export(typescript_exports, {
|
|
|
685
685
|
getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
|
|
686
686
|
getBuilderCreationParameters: () => getBuilderCreationParameters,
|
|
687
687
|
getBuilderFileEmit: () => getBuilderFileEmit,
|
|
688
|
+
getCanonicalDiagnostic: () => getCanonicalDiagnostic,
|
|
688
689
|
getCheckFlags: () => getCheckFlags,
|
|
689
690
|
getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
|
|
690
691
|
getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
|
|
@@ -2361,7 +2362,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2361
2362
|
|
|
2362
2363
|
// src/compiler/corePublic.ts
|
|
2363
2364
|
var versionMajorMinor = "5.5";
|
|
2364
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2365
|
+
var version = `${versionMajorMinor}.0-dev.20240430`;
|
|
2365
2366
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2366
2367
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2367
2368
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6995,22 +6996,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
|
6995
6996
|
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
6996
6997
|
return ScriptKind7;
|
|
6997
6998
|
})(ScriptKind || {});
|
|
6998
|
-
var ScriptTarget = /* @__PURE__ */ ((
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
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;
|
|
7014
7015
|
})(ScriptTarget || {});
|
|
7015
7016
|
var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
7016
7017
|
LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
|
|
@@ -7023,6 +7024,7 @@ var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
|
|
|
7023
7024
|
return WatchDirectoryFlags3;
|
|
7024
7025
|
})(WatchDirectoryFlags || {});
|
|
7025
7026
|
var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
7027
|
+
CharacterCodes2[CharacterCodes2["EOF"] = -1] = "EOF";
|
|
7026
7028
|
CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
|
|
7027
7029
|
CharacterCodes2[CharacterCodes2["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
|
|
7028
7030
|
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
@@ -9815,7 +9817,7 @@ var Diagnostics = {
|
|
|
9815
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."),
|
|
9816
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."),
|
|
9817
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."),
|
|
9818
|
-
|
|
9820
|
+
Expected_a_class_set_operand: diag(1520, 1 /* Error */, "Expected_a_class_set_operand_1520", "Expected a class set operand."),
|
|
9819
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."),
|
|
9820
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?"),
|
|
9821
9823
|
Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
|
|
@@ -12325,6 +12327,18 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12325
12327
|
});
|
|
12326
12328
|
}
|
|
12327
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
|
+
}
|
|
12328
12342
|
function error2(message, errPos = pos, length3, arg0) {
|
|
12329
12343
|
if (onError) {
|
|
12330
12344
|
const oldPos = pos;
|
|
@@ -12339,7 +12353,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12339
12353
|
let isPreviousTokenSeparator = false;
|
|
12340
12354
|
let result = "";
|
|
12341
12355
|
while (true) {
|
|
12342
|
-
const ch =
|
|
12356
|
+
const ch = charCodeUnchecked(pos);
|
|
12343
12357
|
if (ch === 95 /* _ */) {
|
|
12344
12358
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
12345
12359
|
if (allowSeparator) {
|
|
@@ -12366,7 +12380,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12366
12380
|
}
|
|
12367
12381
|
break;
|
|
12368
12382
|
}
|
|
12369
|
-
if (
|
|
12383
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
12370
12384
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
12371
12385
|
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12372
12386
|
}
|
|
@@ -12375,9 +12389,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12375
12389
|
function scanNumber() {
|
|
12376
12390
|
let start2 = pos;
|
|
12377
12391
|
let mainFragment;
|
|
12378
|
-
if (
|
|
12392
|
+
if (charCodeUnchecked(pos) === 48 /* _0 */) {
|
|
12379
12393
|
pos++;
|
|
12380
|
-
if (
|
|
12394
|
+
if (charCodeUnchecked(pos) === 95 /* _ */) {
|
|
12381
12395
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
12382
12396
|
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12383
12397
|
pos--;
|
|
@@ -12402,15 +12416,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12402
12416
|
}
|
|
12403
12417
|
let decimalFragment;
|
|
12404
12418
|
let scientificFragment;
|
|
12405
|
-
if (
|
|
12419
|
+
if (charCodeUnchecked(pos) === 46 /* dot */) {
|
|
12406
12420
|
pos++;
|
|
12407
12421
|
decimalFragment = scanNumberFragment();
|
|
12408
12422
|
}
|
|
12409
12423
|
let end2 = pos;
|
|
12410
|
-
if (
|
|
12424
|
+
if (charCodeUnchecked(pos) === 69 /* E */ || charCodeUnchecked(pos) === 101 /* e */) {
|
|
12411
12425
|
pos++;
|
|
12412
12426
|
tokenFlags |= 16 /* Scientific */;
|
|
12413
|
-
if (
|
|
12427
|
+
if (charCodeUnchecked(pos) === 43 /* plus */ || charCodeUnchecked(pos) === 45 /* minus */)
|
|
12414
12428
|
pos++;
|
|
12415
12429
|
const preNumericPart = pos;
|
|
12416
12430
|
const finalFragment = scanNumberFragment();
|
|
@@ -12450,7 +12464,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12450
12464
|
}
|
|
12451
12465
|
}
|
|
12452
12466
|
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
|
|
12453
|
-
if (!isIdentifierStart(
|
|
12467
|
+
if (!isIdentifierStart(codePointUnchecked(pos), languageVersion)) {
|
|
12454
12468
|
return;
|
|
12455
12469
|
}
|
|
12456
12470
|
const identifierStart = pos;
|
|
@@ -12469,8 +12483,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12469
12483
|
function scanDigits() {
|
|
12470
12484
|
const start2 = pos;
|
|
12471
12485
|
let isOctal = true;
|
|
12472
|
-
while (isDigit(
|
|
12473
|
-
if (!isOctalDigit(
|
|
12486
|
+
while (isDigit(charCodeChecked(pos))) {
|
|
12487
|
+
if (!isOctalDigit(charCodeUnchecked(pos))) {
|
|
12474
12488
|
isOctal = false;
|
|
12475
12489
|
}
|
|
12476
12490
|
pos++;
|
|
@@ -12502,7 +12516,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12502
12516
|
let allowSeparator = false;
|
|
12503
12517
|
let isPreviousTokenSeparator = false;
|
|
12504
12518
|
while (valueChars.length < minCount || scanAsManyAsPossible) {
|
|
12505
|
-
let ch =
|
|
12519
|
+
let ch = charCodeUnchecked(pos);
|
|
12506
12520
|
if (canHaveSeparators && ch === 95 /* _ */) {
|
|
12507
12521
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
12508
12522
|
if (allowSeparator) {
|
|
@@ -12529,13 +12543,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12529
12543
|
if (valueChars.length < minCount) {
|
|
12530
12544
|
valueChars = [];
|
|
12531
12545
|
}
|
|
12532
|
-
if (
|
|
12546
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
12533
12547
|
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12534
12548
|
}
|
|
12535
12549
|
return String.fromCharCode(...valueChars);
|
|
12536
12550
|
}
|
|
12537
12551
|
function scanString(jsxAttributeString = false) {
|
|
12538
|
-
const quote2 =
|
|
12552
|
+
const quote2 = charCodeUnchecked(pos);
|
|
12539
12553
|
pos++;
|
|
12540
12554
|
let result = "";
|
|
12541
12555
|
let start2 = pos;
|
|
@@ -12546,7 +12560,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12546
12560
|
error2(Diagnostics.Unterminated_string_literal);
|
|
12547
12561
|
break;
|
|
12548
12562
|
}
|
|
12549
|
-
const ch =
|
|
12563
|
+
const ch = charCodeUnchecked(pos);
|
|
12550
12564
|
if (ch === quote2) {
|
|
12551
12565
|
result += text.substring(start2, pos);
|
|
12552
12566
|
pos++;
|
|
@@ -12574,7 +12588,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12574
12588
|
return result;
|
|
12575
12589
|
}
|
|
12576
12590
|
function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
|
|
12577
|
-
const startedWithBacktick =
|
|
12591
|
+
const startedWithBacktick = charCodeUnchecked(pos) === 96 /* backtick */;
|
|
12578
12592
|
pos++;
|
|
12579
12593
|
let start2 = pos;
|
|
12580
12594
|
let contents = "";
|
|
@@ -12587,14 +12601,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12587
12601
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
12588
12602
|
break;
|
|
12589
12603
|
}
|
|
12590
|
-
const currChar =
|
|
12604
|
+
const currChar = charCodeUnchecked(pos);
|
|
12591
12605
|
if (currChar === 96 /* backtick */) {
|
|
12592
12606
|
contents += text.substring(start2, pos);
|
|
12593
12607
|
pos++;
|
|
12594
12608
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
12595
12609
|
break;
|
|
12596
12610
|
}
|
|
12597
|
-
if (currChar === 36 /* $ */ && pos + 1 < end &&
|
|
12611
|
+
if (currChar === 36 /* $ */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 123 /* openBrace */) {
|
|
12598
12612
|
contents += text.substring(start2, pos);
|
|
12599
12613
|
pos += 2;
|
|
12600
12614
|
resultingToken = startedWithBacktick ? 16 /* TemplateHead */ : 17 /* TemplateMiddle */;
|
|
@@ -12613,7 +12627,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12613
12627
|
if (currChar === 13 /* carriageReturn */) {
|
|
12614
12628
|
contents += text.substring(start2, pos);
|
|
12615
12629
|
pos++;
|
|
12616
|
-
if (pos < end &&
|
|
12630
|
+
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
12617
12631
|
pos++;
|
|
12618
12632
|
}
|
|
12619
12633
|
contents += "\n";
|
|
@@ -12633,24 +12647,24 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12633
12647
|
error2(Diagnostics.Unexpected_end_of_text);
|
|
12634
12648
|
return "";
|
|
12635
12649
|
}
|
|
12636
|
-
const ch =
|
|
12650
|
+
const ch = charCodeUnchecked(pos);
|
|
12637
12651
|
pos++;
|
|
12638
12652
|
switch (ch) {
|
|
12639
12653
|
case 48 /* _0 */:
|
|
12640
|
-
if (pos >= end || !isDigit(
|
|
12654
|
+
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
12641
12655
|
return "\0";
|
|
12642
12656
|
}
|
|
12643
12657
|
case 49 /* _1 */:
|
|
12644
12658
|
case 50 /* _2 */:
|
|
12645
12659
|
case 51 /* _3 */:
|
|
12646
|
-
if (pos < end && isOctalDigit(
|
|
12660
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
12647
12661
|
pos++;
|
|
12648
12662
|
}
|
|
12649
12663
|
case 52 /* _4 */:
|
|
12650
12664
|
case 53 /* _5 */:
|
|
12651
12665
|
case 54 /* _6 */:
|
|
12652
12666
|
case 55 /* _7 */:
|
|
12653
|
-
if (pos < end && isOctalDigit(
|
|
12667
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
12654
12668
|
pos++;
|
|
12655
12669
|
}
|
|
12656
12670
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
@@ -12687,12 +12701,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12687
12701
|
case 34 /* doubleQuote */:
|
|
12688
12702
|
return '"';
|
|
12689
12703
|
case 117 /* u */:
|
|
12690
|
-
if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end &&
|
|
12704
|
+
if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
12691
12705
|
pos -= 2;
|
|
12692
12706
|
return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
|
|
12693
12707
|
}
|
|
12694
12708
|
for (; pos < start2 + 6; pos++) {
|
|
12695
|
-
if (!(pos < end && isHexDigit(
|
|
12709
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
12696
12710
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12697
12711
|
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12698
12712
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
@@ -12703,11 +12717,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12703
12717
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
12704
12718
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
12705
12719
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
12706
|
-
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 */) {
|
|
12707
12721
|
const nextStart = pos;
|
|
12708
12722
|
let nextPos = pos + 2;
|
|
12709
12723
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
12710
|
-
if (!isHexDigit(
|
|
12724
|
+
if (!isHexDigit(charCodeUnchecked(pos))) {
|
|
12711
12725
|
return escapedValueString;
|
|
12712
12726
|
}
|
|
12713
12727
|
}
|
|
@@ -12720,7 +12734,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12720
12734
|
return escapedValueString;
|
|
12721
12735
|
case 120 /* x */:
|
|
12722
12736
|
for (; pos < start2 + 4; pos++) {
|
|
12723
|
-
if (!(pos < end && isHexDigit(
|
|
12737
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
12724
12738
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12725
12739
|
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12726
12740
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
@@ -12731,7 +12745,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12731
12745
|
tokenFlags |= 4096 /* HexEscape */;
|
|
12732
12746
|
return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
|
|
12733
12747
|
case 13 /* carriageReturn */:
|
|
12734
|
-
if (pos < end &&
|
|
12748
|
+
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
12735
12749
|
pos++;
|
|
12736
12750
|
}
|
|
12737
12751
|
case 10 /* lineFeed */:
|
|
@@ -12772,7 +12786,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12772
12786
|
error2(Diagnostics.Unexpected_end_of_text);
|
|
12773
12787
|
}
|
|
12774
12788
|
isInvalidExtendedEscape = true;
|
|
12775
|
-
} else if (
|
|
12789
|
+
} else if (charCodeUnchecked(pos) === 125 /* closeBrace */) {
|
|
12776
12790
|
pos++;
|
|
12777
12791
|
} else {
|
|
12778
12792
|
if (shouldEmitInvalidEscapeError) {
|
|
@@ -12788,7 +12802,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12788
12802
|
return utf16EncodeAsString(escapedValue);
|
|
12789
12803
|
}
|
|
12790
12804
|
function peekUnicodeEscape() {
|
|
12791
|
-
if (pos + 5 < end &&
|
|
12805
|
+
if (pos + 5 < end && charCodeUnchecked(pos + 1) === 117 /* u */) {
|
|
12792
12806
|
const start2 = pos;
|
|
12793
12807
|
pos += 2;
|
|
12794
12808
|
const value = scanExactNumberOfHexDigits(
|
|
@@ -12802,7 +12816,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12802
12816
|
return -1;
|
|
12803
12817
|
}
|
|
12804
12818
|
function peekExtendedUnicodeEscape() {
|
|
12805
|
-
if (
|
|
12819
|
+
if (codePointUnchecked(pos + 1) === 117 /* u */ && codePointUnchecked(pos + 2) === 123 /* openBrace */) {
|
|
12806
12820
|
const start2 = pos;
|
|
12807
12821
|
pos += 3;
|
|
12808
12822
|
const escapedValueString = scanMinimumNumberOfHexDigits(
|
|
@@ -12820,7 +12834,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12820
12834
|
let result = "";
|
|
12821
12835
|
let start2 = pos;
|
|
12822
12836
|
while (pos < end) {
|
|
12823
|
-
let ch =
|
|
12837
|
+
let ch = codePointUnchecked(pos);
|
|
12824
12838
|
if (isIdentifierPart(ch, languageVersion)) {
|
|
12825
12839
|
pos += charSize(ch);
|
|
12826
12840
|
} else if (ch === 92 /* backslash */) {
|
|
@@ -12867,7 +12881,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12867
12881
|
let separatorAllowed = false;
|
|
12868
12882
|
let isPreviousTokenSeparator = false;
|
|
12869
12883
|
while (true) {
|
|
12870
|
-
const ch =
|
|
12884
|
+
const ch = charCodeUnchecked(pos);
|
|
12871
12885
|
if (ch === 95 /* _ */) {
|
|
12872
12886
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
12873
12887
|
if (separatorAllowed) {
|
|
@@ -12889,13 +12903,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12889
12903
|
pos++;
|
|
12890
12904
|
isPreviousTokenSeparator = false;
|
|
12891
12905
|
}
|
|
12892
|
-
if (
|
|
12906
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
12893
12907
|
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12894
12908
|
}
|
|
12895
12909
|
return value;
|
|
12896
12910
|
}
|
|
12897
12911
|
function checkBigIntSuffix() {
|
|
12898
|
-
if (
|
|
12912
|
+
if (charCodeUnchecked(pos) === 110 /* n */) {
|
|
12899
12913
|
tokenValue += "n";
|
|
12900
12914
|
if (tokenFlags & 384 /* BinaryOrOctalSpecifier */) {
|
|
12901
12915
|
tokenValue = parsePseudoBigInt(tokenValue) + "n";
|
|
@@ -12917,7 +12931,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12917
12931
|
if (pos >= end) {
|
|
12918
12932
|
return token = 1 /* EndOfFileToken */;
|
|
12919
12933
|
}
|
|
12920
|
-
const ch =
|
|
12934
|
+
const ch = codePointUnchecked(pos);
|
|
12921
12935
|
if (pos === 0) {
|
|
12922
12936
|
if (ch === 35 /* hash */ && isShebangTrivia(text, pos)) {
|
|
12923
12937
|
pos = scanShebangTrivia(text, pos);
|
|
@@ -12936,7 +12950,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12936
12950
|
pos++;
|
|
12937
12951
|
continue;
|
|
12938
12952
|
} else {
|
|
12939
|
-
if (ch === 13 /* carriageReturn */ && pos + 1 < end &&
|
|
12953
|
+
if (ch === 13 /* carriageReturn */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 10 /* lineFeed */) {
|
|
12940
12954
|
pos += 2;
|
|
12941
12955
|
} else {
|
|
12942
12956
|
pos++;
|
|
@@ -12969,14 +12983,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12969
12983
|
pos++;
|
|
12970
12984
|
continue;
|
|
12971
12985
|
} else {
|
|
12972
|
-
while (pos < end && isWhiteSpaceSingleLine(
|
|
12986
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
12973
12987
|
pos++;
|
|
12974
12988
|
}
|
|
12975
12989
|
return token = 5 /* WhitespaceTrivia */;
|
|
12976
12990
|
}
|
|
12977
12991
|
case 33 /* exclamation */:
|
|
12978
|
-
if (
|
|
12979
|
-
if (
|
|
12992
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
12993
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
12980
12994
|
return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */;
|
|
12981
12995
|
}
|
|
12982
12996
|
return pos += 2, token = 36 /* ExclamationEqualsToken */;
|
|
@@ -12993,19 +13007,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12993
13007
|
false
|
|
12994
13008
|
);
|
|
12995
13009
|
case 37 /* percent */:
|
|
12996
|
-
if (
|
|
13010
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
12997
13011
|
return pos += 2, token = 70 /* PercentEqualsToken */;
|
|
12998
13012
|
}
|
|
12999
13013
|
pos++;
|
|
13000
13014
|
return token = 45 /* PercentToken */;
|
|
13001
13015
|
case 38 /* ampersand */:
|
|
13002
|
-
if (
|
|
13003
|
-
if (
|
|
13016
|
+
if (charCodeUnchecked(pos + 1) === 38 /* ampersand */) {
|
|
13017
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13004
13018
|
return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */;
|
|
13005
13019
|
}
|
|
13006
13020
|
return pos += 2, token = 56 /* AmpersandAmpersandToken */;
|
|
13007
13021
|
}
|
|
13008
|
-
if (
|
|
13022
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13009
13023
|
return pos += 2, token = 74 /* AmpersandEqualsToken */;
|
|
13010
13024
|
}
|
|
13011
13025
|
pos++;
|
|
@@ -13017,11 +13031,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13017
13031
|
pos++;
|
|
13018
13032
|
return token = 22 /* CloseParenToken */;
|
|
13019
13033
|
case 42 /* asterisk */:
|
|
13020
|
-
if (
|
|
13034
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13021
13035
|
return pos += 2, token = 67 /* AsteriskEqualsToken */;
|
|
13022
13036
|
}
|
|
13023
|
-
if (
|
|
13024
|
-
if (
|
|
13037
|
+
if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
|
|
13038
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13025
13039
|
return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */;
|
|
13026
13040
|
}
|
|
13027
13041
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
@@ -13033,10 +13047,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13033
13047
|
}
|
|
13034
13048
|
return token = 42 /* AsteriskToken */;
|
|
13035
13049
|
case 43 /* plus */:
|
|
13036
|
-
if (
|
|
13050
|
+
if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
|
|
13037
13051
|
return pos += 2, token = 46 /* PlusPlusToken */;
|
|
13038
13052
|
}
|
|
13039
|
-
if (
|
|
13053
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13040
13054
|
return pos += 2, token = 65 /* PlusEqualsToken */;
|
|
13041
13055
|
}
|
|
13042
13056
|
pos++;
|
|
@@ -13045,29 +13059,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13045
13059
|
pos++;
|
|
13046
13060
|
return token = 28 /* CommaToken */;
|
|
13047
13061
|
case 45 /* minus */:
|
|
13048
|
-
if (
|
|
13062
|
+
if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
|
|
13049
13063
|
return pos += 2, token = 47 /* MinusMinusToken */;
|
|
13050
13064
|
}
|
|
13051
|
-
if (
|
|
13065
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13052
13066
|
return pos += 2, token = 66 /* MinusEqualsToken */;
|
|
13053
13067
|
}
|
|
13054
13068
|
pos++;
|
|
13055
13069
|
return token = 41 /* MinusToken */;
|
|
13056
13070
|
case 46 /* dot */:
|
|
13057
|
-
if (isDigit(
|
|
13071
|
+
if (isDigit(charCodeUnchecked(pos + 1))) {
|
|
13058
13072
|
scanNumber();
|
|
13059
13073
|
return token = 9 /* NumericLiteral */;
|
|
13060
13074
|
}
|
|
13061
|
-
if (
|
|
13075
|
+
if (charCodeUnchecked(pos + 1) === 46 /* dot */ && charCodeUnchecked(pos + 2) === 46 /* dot */) {
|
|
13062
13076
|
return pos += 3, token = 26 /* DotDotDotToken */;
|
|
13063
13077
|
}
|
|
13064
13078
|
pos++;
|
|
13065
13079
|
return token = 25 /* DotToken */;
|
|
13066
13080
|
case 47 /* slash */:
|
|
13067
|
-
if (
|
|
13081
|
+
if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
13068
13082
|
pos += 2;
|
|
13069
13083
|
while (pos < end) {
|
|
13070
|
-
if (isLineBreak(
|
|
13084
|
+
if (isLineBreak(charCodeUnchecked(pos))) {
|
|
13071
13085
|
break;
|
|
13072
13086
|
}
|
|
13073
13087
|
pos++;
|
|
@@ -13084,14 +13098,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13084
13098
|
return token = 2 /* SingleLineCommentTrivia */;
|
|
13085
13099
|
}
|
|
13086
13100
|
}
|
|
13087
|
-
if (
|
|
13101
|
+
if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
|
|
13088
13102
|
pos += 2;
|
|
13089
|
-
const isJSDoc2 =
|
|
13103
|
+
const isJSDoc2 = charCodeUnchecked(pos) === 42 /* asterisk */ && charCodeUnchecked(pos + 1) !== 47 /* slash */;
|
|
13090
13104
|
let commentClosed = false;
|
|
13091
13105
|
let lastLineStart = tokenStart;
|
|
13092
13106
|
while (pos < end) {
|
|
13093
|
-
const ch2 =
|
|
13094
|
-
if (ch2 === 42 /* asterisk */ &&
|
|
13107
|
+
const ch2 = charCodeUnchecked(pos);
|
|
13108
|
+
if (ch2 === 42 /* asterisk */ && charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
13095
13109
|
pos += 2;
|
|
13096
13110
|
commentClosed = true;
|
|
13097
13111
|
break;
|
|
@@ -13118,13 +13132,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13118
13132
|
return token = 3 /* MultiLineCommentTrivia */;
|
|
13119
13133
|
}
|
|
13120
13134
|
}
|
|
13121
|
-
if (
|
|
13135
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13122
13136
|
return pos += 2, token = 69 /* SlashEqualsToken */;
|
|
13123
13137
|
}
|
|
13124
13138
|
pos++;
|
|
13125
13139
|
return token = 44 /* SlashToken */;
|
|
13126
13140
|
case 48 /* _0 */:
|
|
13127
|
-
if (pos + 2 < end && (
|
|
13141
|
+
if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 88 /* X */ || charCodeUnchecked(pos + 1) === 120 /* x */)) {
|
|
13128
13142
|
pos += 2;
|
|
13129
13143
|
tokenValue = scanMinimumNumberOfHexDigits(
|
|
13130
13144
|
1,
|
|
@@ -13138,7 +13152,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13138
13152
|
tokenValue = "0x" + tokenValue;
|
|
13139
13153
|
tokenFlags |= 64 /* HexSpecifier */;
|
|
13140
13154
|
return token = checkBigIntSuffix();
|
|
13141
|
-
} else if (pos + 2 < end && (
|
|
13155
|
+
} else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 66 /* B */ || charCodeUnchecked(pos + 1) === 98 /* b */)) {
|
|
13142
13156
|
pos += 2;
|
|
13143
13157
|
tokenValue = scanBinaryOrOctalDigits(
|
|
13144
13158
|
/* base */
|
|
@@ -13151,7 +13165,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13151
13165
|
tokenValue = "0b" + tokenValue;
|
|
13152
13166
|
tokenFlags |= 128 /* BinarySpecifier */;
|
|
13153
13167
|
return token = checkBigIntSuffix();
|
|
13154
|
-
} else if (pos + 2 < end && (
|
|
13168
|
+
} else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 79 /* O */ || charCodeUnchecked(pos + 1) === 111 /* o */)) {
|
|
13155
13169
|
pos += 2;
|
|
13156
13170
|
tokenValue = scanBinaryOrOctalDigits(
|
|
13157
13171
|
/* base */
|
|
@@ -13190,16 +13204,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13190
13204
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
13191
13205
|
}
|
|
13192
13206
|
}
|
|
13193
|
-
if (
|
|
13194
|
-
if (
|
|
13207
|
+
if (charCodeUnchecked(pos + 1) === 60 /* lessThan */) {
|
|
13208
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13195
13209
|
return pos += 3, token = 71 /* LessThanLessThanEqualsToken */;
|
|
13196
13210
|
}
|
|
13197
13211
|
return pos += 2, token = 48 /* LessThanLessThanToken */;
|
|
13198
13212
|
}
|
|
13199
|
-
if (
|
|
13213
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13200
13214
|
return pos += 2, token = 33 /* LessThanEqualsToken */;
|
|
13201
13215
|
}
|
|
13202
|
-
if (languageVariant === 1 /* JSX */ &&
|
|
13216
|
+
if (languageVariant === 1 /* JSX */ && charCodeUnchecked(pos + 1) === 47 /* slash */ && charCodeUnchecked(pos + 2) !== 42 /* asterisk */) {
|
|
13203
13217
|
return pos += 2, token = 31 /* LessThanSlashToken */;
|
|
13204
13218
|
}
|
|
13205
13219
|
pos++;
|
|
@@ -13213,13 +13227,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13213
13227
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
13214
13228
|
}
|
|
13215
13229
|
}
|
|
13216
|
-
if (
|
|
13217
|
-
if (
|
|
13230
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13231
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13218
13232
|
return pos += 3, token = 37 /* EqualsEqualsEqualsToken */;
|
|
13219
13233
|
}
|
|
13220
13234
|
return pos += 2, token = 35 /* EqualsEqualsToken */;
|
|
13221
13235
|
}
|
|
13222
|
-
if (
|
|
13236
|
+
if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
|
|
13223
13237
|
return pos += 2, token = 39 /* EqualsGreaterThanToken */;
|
|
13224
13238
|
}
|
|
13225
13239
|
pos++;
|
|
@@ -13236,11 +13250,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13236
13250
|
pos++;
|
|
13237
13251
|
return token = 32 /* GreaterThanToken */;
|
|
13238
13252
|
case 63 /* question */:
|
|
13239
|
-
if (
|
|
13253
|
+
if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
|
|
13240
13254
|
return pos += 2, token = 29 /* QuestionDotToken */;
|
|
13241
13255
|
}
|
|
13242
|
-
if (
|
|
13243
|
-
if (
|
|
13256
|
+
if (charCodeUnchecked(pos + 1) === 63 /* question */) {
|
|
13257
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13244
13258
|
return pos += 3, token = 78 /* QuestionQuestionEqualsToken */;
|
|
13245
13259
|
}
|
|
13246
13260
|
return pos += 2, token = 61 /* QuestionQuestionToken */;
|
|
@@ -13254,7 +13268,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13254
13268
|
pos++;
|
|
13255
13269
|
return token = 24 /* CloseBracketToken */;
|
|
13256
13270
|
case 94 /* caret */:
|
|
13257
|
-
if (
|
|
13271
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13258
13272
|
return pos += 2, token = 79 /* CaretEqualsToken */;
|
|
13259
13273
|
}
|
|
13260
13274
|
pos++;
|
|
@@ -13271,13 +13285,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13271
13285
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
13272
13286
|
}
|
|
13273
13287
|
}
|
|
13274
|
-
if (
|
|
13275
|
-
if (
|
|
13288
|
+
if (charCodeUnchecked(pos + 1) === 124 /* bar */) {
|
|
13289
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13276
13290
|
return pos += 3, token = 76 /* BarBarEqualsToken */;
|
|
13277
13291
|
}
|
|
13278
13292
|
return pos += 2, token = 57 /* BarBarToken */;
|
|
13279
13293
|
}
|
|
13280
|
-
if (
|
|
13294
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13281
13295
|
return pos += 2, token = 75 /* BarEqualsToken */;
|
|
13282
13296
|
}
|
|
13283
13297
|
pos++;
|
|
@@ -13316,7 +13330,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13316
13330
|
pos++;
|
|
13317
13331
|
return token = 0 /* Unknown */;
|
|
13318
13332
|
}
|
|
13319
|
-
const charAfterHash =
|
|
13333
|
+
const charAfterHash = codePointUnchecked(pos + 1);
|
|
13320
13334
|
if (charAfterHash === 92 /* backslash */) {
|
|
13321
13335
|
pos++;
|
|
13322
13336
|
const extendedCookedChar2 = peekExtendedUnicodeEscape();
|
|
@@ -13386,7 +13400,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13386
13400
|
Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
|
|
13387
13401
|
pos = tokenStart = fullStartPos;
|
|
13388
13402
|
tokenFlags = 0;
|
|
13389
|
-
const ch =
|
|
13403
|
+
const ch = codePointUnchecked(pos);
|
|
13390
13404
|
const identifierKind = scanIdentifier(ch, 99 /* ESNext */);
|
|
13391
13405
|
if (identifierKind) {
|
|
13392
13406
|
return token = identifierKind;
|
|
@@ -13398,7 +13412,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13398
13412
|
let ch = startCharacter;
|
|
13399
13413
|
if (isIdentifierStart(ch, languageVersion2)) {
|
|
13400
13414
|
pos += charSize(ch);
|
|
13401
|
-
while (pos < end && isIdentifierPart(ch =
|
|
13415
|
+
while (pos < end && isIdentifierPart(ch = codePointUnchecked(pos), languageVersion2))
|
|
13402
13416
|
pos += charSize(ch);
|
|
13403
13417
|
tokenValue = text.substring(tokenStart, pos);
|
|
13404
13418
|
if (ch === 92 /* backslash */) {
|
|
@@ -13409,20 +13423,20 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13409
13423
|
}
|
|
13410
13424
|
function reScanGreaterToken() {
|
|
13411
13425
|
if (token === 32 /* GreaterThanToken */) {
|
|
13412
|
-
if (
|
|
13413
|
-
if (
|
|
13414
|
-
if (
|
|
13426
|
+
if (charCodeUnchecked(pos) === 62 /* greaterThan */) {
|
|
13427
|
+
if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
|
|
13428
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
13415
13429
|
return pos += 3, token = 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
|
|
13416
13430
|
}
|
|
13417
13431
|
return pos += 2, token = 50 /* GreaterThanGreaterThanGreaterThanToken */;
|
|
13418
13432
|
}
|
|
13419
|
-
if (
|
|
13433
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
13420
13434
|
return pos += 2, token = 72 /* GreaterThanGreaterThanEqualsToken */;
|
|
13421
13435
|
}
|
|
13422
13436
|
pos++;
|
|
13423
13437
|
return token = 49 /* GreaterThanGreaterThanToken */;
|
|
13424
13438
|
}
|
|
13425
|
-
if (
|
|
13439
|
+
if (charCodeUnchecked(pos) === 61 /* equals */) {
|
|
13426
13440
|
pos++;
|
|
13427
13441
|
return token = 34 /* GreaterThanEqualsToken */;
|
|
13428
13442
|
}
|
|
@@ -13445,7 +13459,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13445
13459
|
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
13446
13460
|
break;
|
|
13447
13461
|
}
|
|
13448
|
-
const ch =
|
|
13462
|
+
const ch = charCodeUnchecked(p);
|
|
13449
13463
|
if (isLineBreak(ch)) {
|
|
13450
13464
|
tokenFlags |= 4 /* Unterminated */;
|
|
13451
13465
|
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
@@ -13469,7 +13483,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13469
13483
|
const endOfBody = p - (isUnterminated ? 0 : 1);
|
|
13470
13484
|
let regExpFlags = 0 /* None */;
|
|
13471
13485
|
while (p < end) {
|
|
13472
|
-
const ch =
|
|
13486
|
+
const ch = charCodeUnchecked(p);
|
|
13473
13487
|
if (!isIdentifierPart(ch, languageVersion)) {
|
|
13474
13488
|
break;
|
|
13475
13489
|
}
|
|
@@ -13488,845 +13502,860 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13488
13502
|
}
|
|
13489
13503
|
p++;
|
|
13490
13504
|
}
|
|
13505
|
+
pos = p;
|
|
13491
13506
|
if (reportErrors2) {
|
|
13492
|
-
|
|
13493
|
-
const saveTokenPos = tokenStart;
|
|
13507
|
+
const saveTokenStart = tokenStart;
|
|
13494
13508
|
const saveTokenFlags = tokenFlags;
|
|
13509
|
+
const savePos = pos;
|
|
13510
|
+
const saveEnd = end;
|
|
13511
|
+
pos = tokenStart + 1;
|
|
13512
|
+
end = endOfBody;
|
|
13495
13513
|
scanRegularExpressionWorker(
|
|
13496
|
-
text,
|
|
13497
|
-
endOfBody,
|
|
13498
13514
|
regExpFlags,
|
|
13499
13515
|
isUnterminated,
|
|
13500
13516
|
/*annexB*/
|
|
13501
13517
|
true
|
|
13502
13518
|
);
|
|
13503
|
-
|
|
13504
|
-
pos = p;
|
|
13505
|
-
}
|
|
13506
|
-
tokenStart = saveTokenPos;
|
|
13519
|
+
tokenStart = saveTokenStart;
|
|
13507
13520
|
tokenFlags = saveTokenFlags;
|
|
13508
|
-
|
|
13509
|
-
|
|
13521
|
+
pos = savePos;
|
|
13522
|
+
end = saveEnd;
|
|
13510
13523
|
}
|
|
13511
13524
|
tokenValue = text.substring(tokenStart, pos);
|
|
13512
13525
|
token = 14 /* RegularExpressionLiteral */;
|
|
13513
13526
|
}
|
|
13514
13527
|
return token;
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
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;
|
|
13536
13550
|
}
|
|
13551
|
+
pos++;
|
|
13537
13552
|
}
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
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 */) {
|
|
13550
13584
|
pos++;
|
|
13551
|
-
switch (
|
|
13552
|
-
case
|
|
13553
|
-
case
|
|
13585
|
+
switch (charCodeChecked(pos)) {
|
|
13586
|
+
case 61 /* equals */:
|
|
13587
|
+
case 33 /* exclamation */:
|
|
13554
13588
|
pos++;
|
|
13555
|
-
isPreviousTermQuantifiable =
|
|
13556
|
-
break;
|
|
13557
|
-
default:
|
|
13558
|
-
scanAtomEscape();
|
|
13559
|
-
isPreviousTermQuantifiable = true;
|
|
13589
|
+
isPreviousTermQuantifiable = annexB;
|
|
13560
13590
|
break;
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
switch (text2.charCodeAt(pos)) {
|
|
13568
|
-
case 61 /* equals */:
|
|
13569
|
-
case 33 /* exclamation */:
|
|
13570
|
-
pos++;
|
|
13571
|
-
isPreviousTermQuantifiable = annexB;
|
|
13572
|
-
break;
|
|
13573
|
-
case 60 /* lessThan */:
|
|
13574
|
-
const groupNameStart = pos;
|
|
13575
|
-
pos++;
|
|
13576
|
-
switch (text2.charCodeAt(pos)) {
|
|
13577
|
-
case 61 /* equals */:
|
|
13578
|
-
case 33 /* exclamation */:
|
|
13579
|
-
pos++;
|
|
13580
|
-
isPreviousTermQuantifiable = false;
|
|
13581
|
-
break;
|
|
13582
|
-
default:
|
|
13583
|
-
scanGroupName(
|
|
13584
|
-
/*isReference*/
|
|
13585
|
-
false
|
|
13586
|
-
);
|
|
13587
|
-
scanExpectedChar(62 /* greaterThan */);
|
|
13588
|
-
if (languageVersion < 5 /* ES2018 */) {
|
|
13589
|
-
error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
|
|
13590
|
-
}
|
|
13591
|
-
numberOfCapturingGroups++;
|
|
13592
|
-
isPreviousTermQuantifiable = true;
|
|
13593
|
-
break;
|
|
13594
|
-
}
|
|
13595
|
-
break;
|
|
13596
|
-
default:
|
|
13597
|
-
const start3 = pos;
|
|
13598
|
-
const setFlags = scanPatternModifiers(0 /* None */);
|
|
13599
|
-
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 */:
|
|
13600
13597
|
pos++;
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
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);
|
|
13604
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);
|
|
13605
13622
|
}
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
} else {
|
|
13611
|
-
numberOfCapturingGroups++;
|
|
13612
|
-
isPreviousTermQuantifiable = true;
|
|
13623
|
+
}
|
|
13624
|
+
scanExpectedChar(58 /* colon */);
|
|
13625
|
+
isPreviousTermQuantifiable = true;
|
|
13626
|
+
break;
|
|
13613
13627
|
}
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
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 */) {
|
|
13621
13644
|
pos++;
|
|
13622
|
-
const digitsStart = pos;
|
|
13623
13645
|
scanDigits();
|
|
13624
|
-
const
|
|
13625
|
-
if (
|
|
13626
|
-
pos
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
13632
|
-
} else {
|
|
13633
|
-
if (unicodeMode) {
|
|
13634
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13635
|
-
}
|
|
13636
|
-
isPreviousTermQuantifiable = true;
|
|
13637
|
-
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));
|
|
13638
13653
|
}
|
|
13654
|
+
isPreviousTermQuantifiable = true;
|
|
13655
|
+
break;
|
|
13639
13656
|
}
|
|
13640
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
13641
|
-
error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
13642
|
-
}
|
|
13643
|
-
} else if (!min2) {
|
|
13644
|
-
if (unicodeMode) {
|
|
13645
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13646
|
-
}
|
|
13647
|
-
isPreviousTermQuantifiable = true;
|
|
13648
|
-
break;
|
|
13649
|
-
}
|
|
13650
|
-
scanExpectedChar(125 /* closeBrace */);
|
|
13651
|
-
pos--;
|
|
13652
|
-
case 42 /* asterisk */:
|
|
13653
|
-
case 43 /* plus */:
|
|
13654
|
-
case 63 /* question */:
|
|
13655
|
-
pos++;
|
|
13656
|
-
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
13657
|
-
pos++;
|
|
13658
13657
|
}
|
|
13659
|
-
if (
|
|
13660
|
-
error2(Diagnostics.
|
|
13658
|
+
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
13659
|
+
error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
13661
13660
|
}
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
pos++;
|
|
13666
|
-
isPreviousTermQuantifiable = true;
|
|
13667
|
-
break;
|
|
13668
|
-
case 91 /* openBracket */:
|
|
13669
|
-
pos++;
|
|
13670
|
-
if (unicodeSetsMode) {
|
|
13671
|
-
scanClassSetExpression();
|
|
13672
|
-
} else {
|
|
13673
|
-
scanClassRanges();
|
|
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));
|
|
13674
13664
|
}
|
|
13675
|
-
scanExpectedChar(93 /* closeBracket */);
|
|
13676
13665
|
isPreviousTermQuantifiable = true;
|
|
13677
13666
|
break;
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
if (isUnterminated && !isInGroup) {
|
|
13685
|
-
return;
|
|
13686
|
-
}
|
|
13687
|
-
if (unicodeMode || ch === 41 /* closeParen */) {
|
|
13688
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13689
|
-
}
|
|
13690
|
-
pos++;
|
|
13691
|
-
isPreviousTermQuantifiable = true;
|
|
13692
|
-
break;
|
|
13693
|
-
case 47 /* slash */:
|
|
13694
|
-
case 124 /* bar */:
|
|
13695
|
-
return;
|
|
13696
|
-
default:
|
|
13697
|
-
scanSourceCharacter();
|
|
13698
|
-
isPreviousTermQuantifiable = true;
|
|
13699
|
-
break;
|
|
13700
|
-
}
|
|
13701
|
-
}
|
|
13702
|
-
}
|
|
13703
|
-
function scanPatternModifiers(currFlags) {
|
|
13704
|
-
while (pos < end2) {
|
|
13705
|
-
const ch = text2.charCodeAt(pos);
|
|
13706
|
-
if (!isIdentifierPart(ch, languageVersion)) {
|
|
13707
|
-
break;
|
|
13708
|
-
}
|
|
13709
|
-
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
13710
|
-
if (flag === void 0) {
|
|
13711
|
-
error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
|
|
13712
|
-
} else if (currFlags & flag) {
|
|
13713
|
-
error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
|
|
13714
|
-
} else if (!(flag & 28 /* Modifiers */)) {
|
|
13715
|
-
error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
|
|
13716
|
-
} else {
|
|
13717
|
-
currFlags |= flag;
|
|
13718
|
-
checkRegularExpressionFlagAvailable(flag, pos);
|
|
13719
|
-
}
|
|
13720
|
-
pos++;
|
|
13721
|
-
}
|
|
13722
|
-
return currFlags;
|
|
13723
|
-
}
|
|
13724
|
-
function scanAtomEscape() {
|
|
13725
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13726
|
-
switch (text2.charCodeAt(pos)) {
|
|
13727
|
-
case 107 /* k */:
|
|
13667
|
+
}
|
|
13668
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
13669
|
+
pos--;
|
|
13670
|
+
case 42 /* asterisk */:
|
|
13671
|
+
case 43 /* plus */:
|
|
13672
|
+
case 63 /* question */:
|
|
13728
13673
|
pos++;
|
|
13729
|
-
if (
|
|
13674
|
+
if (charCodeChecked(pos) === 63 /* question */) {
|
|
13730
13675
|
pos++;
|
|
13731
|
-
scanGroupName(
|
|
13732
|
-
/*isReference*/
|
|
13733
|
-
true
|
|
13734
|
-
);
|
|
13735
|
-
scanExpectedChar(62 /* greaterThan */);
|
|
13736
|
-
} else if (unicodeMode) {
|
|
13737
|
-
error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
13738
13676
|
}
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
if (unicodeSetsMode) {
|
|
13742
|
-
pos++;
|
|
13743
|
-
error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
13744
|
-
break;
|
|
13677
|
+
if (!isPreviousTermQuantifiable) {
|
|
13678
|
+
error2(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
|
|
13745
13679
|
}
|
|
13746
|
-
|
|
13747
|
-
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
13748
|
-
/*atomEscape*/
|
|
13749
|
-
true
|
|
13750
|
-
));
|
|
13680
|
+
isPreviousTermQuantifiable = false;
|
|
13751
13681
|
break;
|
|
13752
|
-
|
|
13753
|
-
}
|
|
13754
|
-
function scanDecimalEscape() {
|
|
13755
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13756
|
-
const ch = text2.charCodeAt(pos);
|
|
13757
|
-
if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
|
|
13758
|
-
const start2 = pos;
|
|
13759
|
-
scanDigits();
|
|
13760
|
-
decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
|
|
13761
|
-
return true;
|
|
13762
|
-
}
|
|
13763
|
-
return false;
|
|
13764
|
-
}
|
|
13765
|
-
function scanCharacterEscape(atomEscape) {
|
|
13766
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13767
|
-
let ch = text2.charCodeAt(pos);
|
|
13768
|
-
switch (ch) {
|
|
13769
|
-
case 99 /* c */:
|
|
13682
|
+
case 46 /* dot */:
|
|
13770
13683
|
pos++;
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
pos--;
|
|
13780
|
-
return "\\";
|
|
13684
|
+
isPreviousTermQuantifiable = true;
|
|
13685
|
+
break;
|
|
13686
|
+
case 91 /* openBracket */:
|
|
13687
|
+
pos++;
|
|
13688
|
+
if (unicodeSetsMode) {
|
|
13689
|
+
scanClassSetExpression();
|
|
13690
|
+
} else {
|
|
13691
|
+
scanClassRanges();
|
|
13781
13692
|
}
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
case 47 /* slash */:
|
|
13786
|
-
case 92 /* backslash */:
|
|
13787
|
-
case 46 /* dot */:
|
|
13788
|
-
case 42 /* asterisk */:
|
|
13789
|
-
case 43 /* plus */:
|
|
13790
|
-
case 63 /* question */:
|
|
13791
|
-
case 40 /* openParen */:
|
|
13693
|
+
scanExpectedChar(93 /* closeBracket */);
|
|
13694
|
+
isPreviousTermQuantifiable = true;
|
|
13695
|
+
break;
|
|
13792
13696
|
case 41 /* closeParen */:
|
|
13793
|
-
|
|
13697
|
+
if (isInGroup) {
|
|
13698
|
+
return;
|
|
13699
|
+
}
|
|
13794
13700
|
case 93 /* closeBracket */:
|
|
13795
|
-
case 123 /* openBrace */:
|
|
13796
13701
|
case 125 /* closeBrace */:
|
|
13797
|
-
|
|
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
|
+
}
|
|
13798
13708
|
pos++;
|
|
13799
|
-
|
|
13709
|
+
isPreviousTermQuantifiable = true;
|
|
13710
|
+
break;
|
|
13711
|
+
case 47 /* slash */:
|
|
13712
|
+
case 124 /* bar */:
|
|
13713
|
+
return;
|
|
13800
13714
|
default:
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
}
|
|
13805
|
-
pos--;
|
|
13806
|
-
return scanEscapeSequence(
|
|
13807
|
-
/*shouldEmitInvalidEscapeError*/
|
|
13808
|
-
unicodeMode,
|
|
13809
|
-
/*isRegularExpression*/
|
|
13810
|
-
annexB ? "annex-b" : true
|
|
13811
|
-
);
|
|
13715
|
+
scanSourceCharacter();
|
|
13716
|
+
isPreviousTermQuantifiable = true;
|
|
13717
|
+
break;
|
|
13812
13718
|
}
|
|
13813
13719
|
}
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
if (
|
|
13819
|
-
|
|
13820
|
-
}
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
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);
|
|
13824
13734
|
} else {
|
|
13825
|
-
|
|
13826
|
-
|
|
13735
|
+
currFlags |= flag;
|
|
13736
|
+
checkRegularExpressionFlagAvailable(flag, pos);
|
|
13827
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;
|
|
13770
|
+
}
|
|
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;
|
|
13780
|
+
}
|
|
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 */:
|
|
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);
|
|
13828
13847
|
}
|
|
13829
|
-
|
|
13830
|
-
|
|
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++;
|
|
13831
13856
|
}
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
if (
|
|
13857
|
+
while (true) {
|
|
13858
|
+
const ch = charCodeChecked(pos);
|
|
13859
|
+
if (isClassContentExit(ch)) {
|
|
13860
|
+
return;
|
|
13861
|
+
}
|
|
13862
|
+
const minStart = pos;
|
|
13863
|
+
const minCharacter = scanClassAtom();
|
|
13864
|
+
if (charCodeChecked(pos) === 45 /* minus */) {
|
|
13835
13865
|
pos++;
|
|
13866
|
+
const ch2 = charCodeChecked(pos);
|
|
13867
|
+
if (isClassContentExit(ch2)) {
|
|
13868
|
+
return;
|
|
13869
|
+
}
|
|
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
|
+
}
|
|
13836
13887
|
}
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
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);
|
|
13919
|
+
}
|
|
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);
|
|
13931
|
+
}
|
|
13932
|
+
expressionMayContainStrings = mayContainStrings;
|
|
13933
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13840
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);
|
|
13841
13942
|
}
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
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 */:
|
|
13845
13953
|
pos++;
|
|
13846
|
-
|
|
13847
|
-
if (isClassContentExit(
|
|
13954
|
+
ch = charCodeChecked(pos);
|
|
13955
|
+
if (isClassContentExit(ch)) {
|
|
13956
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13848
13957
|
return;
|
|
13849
13958
|
}
|
|
13850
|
-
if (
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
if (!maxCharacter && !annexB) {
|
|
13856
|
-
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
13857
|
-
continue;
|
|
13858
|
-
}
|
|
13859
|
-
if (!minCharacter) {
|
|
13959
|
+
if (ch === 45 /* minus */) {
|
|
13960
|
+
pos++;
|
|
13961
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13962
|
+
start2 = pos - 2;
|
|
13963
|
+
operand = text.slice(start2, pos);
|
|
13860
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
|
+
}
|
|
13861
13987
|
}
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
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));
|
|
13866
14001
|
}
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
}
|
|
13870
|
-
function scanClassSetExpression() {
|
|
13871
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
|
|
13872
|
-
let isCharacterComplement = false;
|
|
13873
|
-
if (text2.charCodeAt(pos) === 94 /* caret */) {
|
|
13874
|
-
pos++;
|
|
13875
|
-
isCharacterComplement = true;
|
|
14002
|
+
operand = text.slice(start2, pos);
|
|
14003
|
+
continue;
|
|
13876
14004
|
}
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
if (isClassContentExit(ch)) {
|
|
13880
|
-
return;
|
|
14005
|
+
if (isClassContentExit(charCodeChecked(pos))) {
|
|
14006
|
+
break;
|
|
13881
14007
|
}
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
switch (text2.slice(pos, pos + 2)) {
|
|
14008
|
+
start2 = pos;
|
|
14009
|
+
switch (text.slice(pos, pos + 2)) {
|
|
13885
14010
|
case "--":
|
|
13886
14011
|
case "&&":
|
|
13887
|
-
error2(Diagnostics.
|
|
13888
|
-
|
|
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);
|
|
13889
14015
|
break;
|
|
13890
14016
|
default:
|
|
13891
|
-
|
|
14017
|
+
operand = scanClassSetOperand();
|
|
13892
14018
|
break;
|
|
13893
14019
|
}
|
|
13894
|
-
|
|
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) {
|
|
13895
14031
|
case 45 /* minus */:
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
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);
|
|
13899
14037
|
}
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13903
|
-
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);
|
|
13904
14040
|
}
|
|
13905
14041
|
break;
|
|
13906
14042
|
case 38 /* ampersand */:
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
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++;
|
|
13911
14052
|
}
|
|
13912
|
-
expressionMayContainStrings = mayContainStrings;
|
|
13913
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13914
|
-
return;
|
|
13915
14053
|
} else {
|
|
13916
|
-
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));
|
|
13917
14055
|
}
|
|
13918
14056
|
break;
|
|
13919
14057
|
default:
|
|
13920
|
-
|
|
13921
|
-
|
|
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;
|
|
13922
14067
|
}
|
|
13923
|
-
expressionMayContainStrings = mayContainStrings;
|
|
13924
14068
|
break;
|
|
13925
14069
|
}
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
pos++;
|
|
13931
|
-
ch = text2.charCodeAt(pos);
|
|
13932
|
-
if (isClassContentExit(ch)) {
|
|
13933
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13934
|
-
return;
|
|
13935
|
-
}
|
|
13936
|
-
if (ch === 45 /* minus */) {
|
|
13937
|
-
pos++;
|
|
13938
|
-
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13939
|
-
start2 = pos - 2;
|
|
13940
|
-
oprand = text2.slice(start2, pos);
|
|
13941
|
-
continue;
|
|
13942
|
-
} else {
|
|
13943
|
-
if (!oprand) {
|
|
13944
|
-
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
|
|
13945
|
-
}
|
|
13946
|
-
const secondStart = pos;
|
|
13947
|
-
const secondOprand = scanClassSetOprand();
|
|
13948
|
-
if (isCharacterComplement && mayContainStrings) {
|
|
13949
|
-
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
|
|
13950
|
-
}
|
|
13951
|
-
expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
|
|
13952
|
-
if (!secondOprand) {
|
|
13953
|
-
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
|
|
13954
|
-
break;
|
|
13955
|
-
}
|
|
13956
|
-
if (!oprand) {
|
|
13957
|
-
break;
|
|
13958
|
-
}
|
|
13959
|
-
const minCharacterValue = codePointAt(oprand, 0);
|
|
13960
|
-
const maxCharacterValue = codePointAt(secondOprand, 0);
|
|
13961
|
-
if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
13962
|
-
error2(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
|
|
13963
|
-
}
|
|
13964
|
-
}
|
|
13965
|
-
break;
|
|
13966
|
-
case 38 /* ampersand */:
|
|
13967
|
-
start2 = pos;
|
|
13968
|
-
pos++;
|
|
13969
|
-
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13970
|
-
pos++;
|
|
13971
|
-
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13972
|
-
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13973
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13974
|
-
pos++;
|
|
13975
|
-
}
|
|
13976
|
-
} else {
|
|
13977
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
13978
|
-
}
|
|
13979
|
-
oprand = text2.slice(start2, pos);
|
|
13980
|
-
continue;
|
|
13981
|
-
}
|
|
13982
|
-
if (isClassContentExit(text2.charCodeAt(pos))) {
|
|
13983
|
-
break;
|
|
13984
|
-
}
|
|
13985
|
-
start2 = pos;
|
|
13986
|
-
switch (text2.slice(pos, pos + 2)) {
|
|
13987
|
-
case "--":
|
|
13988
|
-
case "&&":
|
|
13989
|
-
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
13990
|
-
pos += 2;
|
|
13991
|
-
oprand = text2.slice(start2, pos);
|
|
13992
|
-
break;
|
|
13993
|
-
default:
|
|
13994
|
-
oprand = scanClassSetOprand();
|
|
13995
|
-
break;
|
|
13996
|
-
}
|
|
14070
|
+
ch = charCodeChecked(pos);
|
|
14071
|
+
if (isClassContentExit(ch)) {
|
|
14072
|
+
error2(Diagnostics.Expected_a_class_set_operand);
|
|
14073
|
+
break;
|
|
13997
14074
|
}
|
|
13998
|
-
|
|
14075
|
+
scanClassSetOperand();
|
|
14076
|
+
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
13999
14077
|
}
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
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 */) {
|
|
14020
14097
|
pos++;
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
pos++;
|
|
14029
|
-
}
|
|
14030
|
-
} else {
|
|
14031
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
14032
|
-
}
|
|
14033
|
-
break;
|
|
14034
|
-
default:
|
|
14035
|
-
switch (expressionType) {
|
|
14036
|
-
case 3 /* ClassSubtraction */:
|
|
14037
|
-
error2(Diagnostics._0_expected, pos, 0, "--");
|
|
14038
|
-
break;
|
|
14039
|
-
case 2 /* ClassIntersection */:
|
|
14040
|
-
error2(Diagnostics._0_expected, pos, 0, "&&");
|
|
14041
|
-
break;
|
|
14042
|
-
default:
|
|
14043
|
-
break;
|
|
14044
|
-
}
|
|
14045
|
-
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
|
+
}
|
|
14046
14105
|
}
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
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++;
|
|
14050
14135
|
break;
|
|
14051
|
-
}
|
|
14052
|
-
scanClassSetOprand();
|
|
14053
|
-
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
14054
14136
|
}
|
|
14055
|
-
mayContainStrings = expressionMayContainStrings;
|
|
14056
14137
|
}
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
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 */:
|
|
14061
14149
|
pos++;
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
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 */:
|
|
14066
14165
|
pos++;
|
|
14067
|
-
|
|
14068
|
-
return "";
|
|
14069
|
-
} else if (text2.charCodeAt(pos) === 113 /* q */) {
|
|
14070
|
-
pos++;
|
|
14071
|
-
if (text2.charCodeAt(pos) === 123 /* openBrace */) {
|
|
14072
|
-
pos++;
|
|
14073
|
-
scanClassStringDisjunctionContents();
|
|
14074
|
-
scanExpectedChar(125 /* closeBrace */);
|
|
14075
|
-
return "";
|
|
14076
|
-
} else {
|
|
14077
|
-
error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
|
|
14078
|
-
return "q";
|
|
14079
|
-
}
|
|
14080
|
-
}
|
|
14081
|
-
pos--;
|
|
14166
|
+
return String.fromCharCode(ch2);
|
|
14082
14167
|
default:
|
|
14083
|
-
return
|
|
14084
|
-
|
|
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
|
-
|
|
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);
|
|
14110
14195
|
}
|
|
14111
14196
|
}
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
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));
|
|
14115
14208
|
pos++;
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
case 35 /* hash */:
|
|
14125
|
-
case 37 /* percent */:
|
|
14126
|
-
case 44 /* comma */:
|
|
14127
|
-
case 58 /* colon */:
|
|
14128
|
-
case 59 /* semicolon */:
|
|
14129
|
-
case 60 /* lessThan */:
|
|
14130
|
-
case 61 /* equals */:
|
|
14131
|
-
case 62 /* greaterThan */:
|
|
14132
|
-
case 64 /* at */:
|
|
14133
|
-
case 96 /* backtick */:
|
|
14134
|
-
case 126 /* tilde */:
|
|
14135
|
-
pos++;
|
|
14136
|
-
return String.fromCharCode(ch2);
|
|
14137
|
-
default:
|
|
14138
|
-
return scanCharacterEscape(
|
|
14139
|
-
/*atomEscape*/
|
|
14140
|
-
false
|
|
14141
|
-
);
|
|
14142
|
-
}
|
|
14143
|
-
} else if (ch === text2.charCodeAt(pos + 1)) {
|
|
14144
|
-
switch (ch) {
|
|
14145
|
-
case 38 /* ampersand */:
|
|
14146
|
-
case 33 /* exclamation */:
|
|
14147
|
-
case 35 /* hash */:
|
|
14148
|
-
case 37 /* percent */:
|
|
14149
|
-
case 42 /* asterisk */:
|
|
14150
|
-
case 43 /* plus */:
|
|
14151
|
-
case 44 /* comma */:
|
|
14152
|
-
case 46 /* dot */:
|
|
14153
|
-
case 58 /* colon */:
|
|
14154
|
-
case 59 /* semicolon */:
|
|
14155
|
-
case 60 /* lessThan */:
|
|
14156
|
-
case 61 /* equals */:
|
|
14157
|
-
case 62 /* greaterThan */:
|
|
14158
|
-
case 63 /* question */:
|
|
14159
|
-
case 64 /* at */:
|
|
14160
|
-
case 96 /* backtick */:
|
|
14161
|
-
case 126 /* tilde */:
|
|
14162
|
-
error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
|
|
14163
|
-
pos += 2;
|
|
14164
|
-
return text2.substring(pos - 2, pos);
|
|
14165
|
-
}
|
|
14166
|
-
}
|
|
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);
|
|
14167
14217
|
switch (ch) {
|
|
14168
|
-
case
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
case 91 /* openBracket */:
|
|
14172
|
-
case 93 /* closeBracket */:
|
|
14173
|
-
case 123 /* openBrace */:
|
|
14174
|
-
case 125 /* closeBrace */:
|
|
14218
|
+
case 98 /* b */:
|
|
14219
|
+
pos++;
|
|
14220
|
+
return "\b";
|
|
14175
14221
|
case 45 /* minus */:
|
|
14176
|
-
case 124 /* bar */:
|
|
14177
|
-
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
14178
14222
|
pos++;
|
|
14179
14223
|
return String.fromCharCode(ch);
|
|
14224
|
+
default:
|
|
14225
|
+
if (scanCharacterClassEscape()) {
|
|
14226
|
+
return "";
|
|
14227
|
+
}
|
|
14228
|
+
return scanCharacterEscape(
|
|
14229
|
+
/*atomEscape*/
|
|
14230
|
+
false
|
|
14231
|
+
);
|
|
14180
14232
|
}
|
|
14233
|
+
} else {
|
|
14181
14234
|
return scanSourceCharacter();
|
|
14182
14235
|
}
|
|
14183
|
-
|
|
14184
|
-
|
|
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 */:
|
|
14185
14249
|
pos++;
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
pos++;
|
|
14193
|
-
return String.fromCharCode(ch);
|
|
14194
|
-
default:
|
|
14195
|
-
if (scanCharacterClassEscape()) {
|
|
14196
|
-
return "";
|
|
14197
|
-
}
|
|
14198
|
-
return scanCharacterEscape(
|
|
14199
|
-
/*atomEscape*/
|
|
14200
|
-
false
|
|
14201
|
-
);
|
|
14202
|
-
}
|
|
14203
|
-
} else {
|
|
14204
|
-
return scanSourceCharacter();
|
|
14205
|
-
}
|
|
14206
|
-
}
|
|
14207
|
-
function scanCharacterClassEscape() {
|
|
14208
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
14209
|
-
let isCharacterComplement = false;
|
|
14210
|
-
const start2 = pos - 1;
|
|
14211
|
-
const ch = text2.charCodeAt(pos);
|
|
14212
|
-
switch (ch) {
|
|
14213
|
-
case 100 /* d */:
|
|
14214
|
-
case 68 /* D */:
|
|
14215
|
-
case 115 /* s */:
|
|
14216
|
-
case 83 /* S */:
|
|
14217
|
-
case 119 /* w */:
|
|
14218
|
-
case 87 /* W */:
|
|
14219
|
-
pos++;
|
|
14220
|
-
return true;
|
|
14221
|
-
case 80 /* P */:
|
|
14222
|
-
isCharacterComplement = true;
|
|
14223
|
-
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 */) {
|
|
14224
14256
|
pos++;
|
|
14225
|
-
|
|
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
|
+
}
|
|
14226
14270
|
pos++;
|
|
14227
|
-
const
|
|
14228
|
-
const
|
|
14229
|
-
if (
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
if (suggestion) {
|
|
14237
|
-
error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
14238
|
-
}
|
|
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);
|
|
14239
14280
|
}
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
error2(Diagnostics.
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
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;
|
|
14251
14292
|
}
|
|
14252
|
-
} else {
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
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);
|
|
14258
|
-
} else if (isCharacterComplement) {
|
|
14259
|
-
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14260
|
-
} else {
|
|
14261
|
-
mayContainStrings = true;
|
|
14262
|
-
}
|
|
14263
|
-
} else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
|
|
14264
|
-
error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14265
|
-
const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
|
|
14266
|
-
if (suggestion) {
|
|
14267
|
-
error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
14268
|
-
}
|
|
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);
|
|
14269
14298
|
}
|
|
14270
14299
|
}
|
|
14271
|
-
scanExpectedChar(125 /* closeBrace */);
|
|
14272
|
-
if (!unicodeMode) {
|
|
14273
|
-
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);
|
|
14274
|
-
}
|
|
14275
|
-
} else if (unicodeMode) {
|
|
14276
|
-
error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
14277
14300
|
}
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
while (pos < end2) {
|
|
14285
|
-
const ch = text2.charCodeAt(pos);
|
|
14286
|
-
if (!isWordCharacter(ch)) {
|
|
14287
|
-
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));
|
|
14288
14307
|
}
|
|
14289
|
-
|
|
14290
|
-
|
|
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;
|
|
14291
14318
|
}
|
|
14292
|
-
|
|
14319
|
+
value += String.fromCharCode(ch);
|
|
14320
|
+
pos++;
|
|
14293
14321
|
}
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
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));
|
|
14298
14334
|
}
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
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);
|
|
14305
14343
|
}
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
error2(Diagnostics.
|
|
14313
|
-
}
|
|
14314
|
-
});
|
|
14315
|
-
forEach(decimalEscapes, (escape) => {
|
|
14316
|
-
if (!annexB && escape.value > numberOfCapturingGroups) {
|
|
14317
|
-
if (numberOfCapturingGroups) {
|
|
14318
|
-
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);
|
|
14319
|
-
} else {
|
|
14320
|
-
error2(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
|
|
14321
|
-
}
|
|
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);
|
|
14322
14351
|
}
|
|
14323
|
-
});
|
|
14324
|
-
}
|
|
14325
|
-
function checkRegularExpressionFlagAvailable(flag, pos2) {
|
|
14326
|
-
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
14327
|
-
if (availableFrom && languageVersion < availableFrom) {
|
|
14328
|
-
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
|
|
14329
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));
|
|
14330
14359
|
}
|
|
14331
14360
|
}
|
|
14332
14361
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
@@ -14394,9 +14423,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14394
14423
|
if (pos >= end) {
|
|
14395
14424
|
return token = 1 /* EndOfFileToken */;
|
|
14396
14425
|
}
|
|
14397
|
-
let char =
|
|
14426
|
+
let char = charCodeUnchecked(pos);
|
|
14398
14427
|
if (char === 60 /* lessThan */) {
|
|
14399
|
-
if (
|
|
14428
|
+
if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
14400
14429
|
pos += 2;
|
|
14401
14430
|
return token = 31 /* LessThanSlashToken */;
|
|
14402
14431
|
}
|
|
@@ -14409,7 +14438,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14409
14438
|
}
|
|
14410
14439
|
let firstNonWhitespace = 0;
|
|
14411
14440
|
while (pos < end) {
|
|
14412
|
-
char =
|
|
14441
|
+
char = charCodeUnchecked(pos);
|
|
14413
14442
|
if (char === 123 /* openBrace */) {
|
|
14414
14443
|
break;
|
|
14415
14444
|
}
|
|
@@ -14441,7 +14470,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14441
14470
|
function scanJsxIdentifier() {
|
|
14442
14471
|
if (tokenIsIdentifierOrKeyword(token)) {
|
|
14443
14472
|
while (pos < end) {
|
|
14444
|
-
const ch =
|
|
14473
|
+
const ch = charCodeUnchecked(pos);
|
|
14445
14474
|
if (ch === 45 /* minus */) {
|
|
14446
14475
|
tokenValue += "-";
|
|
14447
14476
|
pos++;
|
|
@@ -14459,7 +14488,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14459
14488
|
}
|
|
14460
14489
|
function scanJsxAttributeValue() {
|
|
14461
14490
|
fullStartPos = pos;
|
|
14462
|
-
switch (
|
|
14491
|
+
switch (charCodeUnchecked(pos)) {
|
|
14463
14492
|
case 34 /* doubleQuote */:
|
|
14464
14493
|
case 39 /* singleQuote */:
|
|
14465
14494
|
tokenValue = scanString(
|
|
@@ -14481,11 +14510,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14481
14510
|
if (pos >= end) {
|
|
14482
14511
|
return token = 1 /* EndOfFileToken */;
|
|
14483
14512
|
}
|
|
14484
|
-
for (let ch =
|
|
14513
|
+
for (let ch = charCodeUnchecked(pos); pos < end && (!isLineBreak(ch) && ch !== 96 /* backtick */); ch = codePointUnchecked(++pos)) {
|
|
14485
14514
|
if (!inBackticks) {
|
|
14486
14515
|
if (ch === 123 /* openBrace */) {
|
|
14487
14516
|
break;
|
|
14488
|
-
} 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)))) {
|
|
14489
14518
|
break;
|
|
14490
14519
|
}
|
|
14491
14520
|
}
|
|
@@ -14502,21 +14531,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14502
14531
|
if (pos >= end) {
|
|
14503
14532
|
return token = 1 /* EndOfFileToken */;
|
|
14504
14533
|
}
|
|
14505
|
-
const ch =
|
|
14534
|
+
const ch = codePointUnchecked(pos);
|
|
14506
14535
|
pos += charSize(ch);
|
|
14507
14536
|
switch (ch) {
|
|
14508
14537
|
case 9 /* tab */:
|
|
14509
14538
|
case 11 /* verticalTab */:
|
|
14510
14539
|
case 12 /* formFeed */:
|
|
14511
14540
|
case 32 /* space */:
|
|
14512
|
-
while (pos < end && isWhiteSpaceSingleLine(
|
|
14541
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
14513
14542
|
pos++;
|
|
14514
14543
|
}
|
|
14515
14544
|
return token = 5 /* WhitespaceTrivia */;
|
|
14516
14545
|
case 64 /* at */:
|
|
14517
14546
|
return token = 60 /* AtToken */;
|
|
14518
14547
|
case 13 /* carriageReturn */:
|
|
14519
|
-
if (
|
|
14548
|
+
if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
14520
14549
|
pos++;
|
|
14521
14550
|
}
|
|
14522
14551
|
case 10 /* lineFeed */:
|
|
@@ -14572,7 +14601,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14572
14601
|
}
|
|
14573
14602
|
if (isIdentifierStart(ch, languageVersion)) {
|
|
14574
14603
|
let char = ch;
|
|
14575
|
-
while (pos < end && isIdentifierPart(char =
|
|
14604
|
+
while (pos < end && isIdentifierPart(char = codePointUnchecked(pos), languageVersion) || char === 45 /* minus */)
|
|
14576
14605
|
pos += charSize(char);
|
|
14577
14606
|
tokenValue = text.substring(tokenStart, pos);
|
|
14578
14607
|
if (char === 92 /* backslash */) {
|
|
@@ -14682,6 +14711,9 @@ function charSize(ch) {
|
|
|
14682
14711
|
if (ch >= 65536) {
|
|
14683
14712
|
return 2;
|
|
14684
14713
|
}
|
|
14714
|
+
if (ch === -1 /* EOF */) {
|
|
14715
|
+
return 0;
|
|
14716
|
+
}
|
|
14685
14717
|
return 1;
|
|
14686
14718
|
}
|
|
14687
14719
|
function utf16EncodeAsStringFallback(codePoint) {
|
|
@@ -17460,7 +17492,8 @@ function createFileDiagnosticFromMessageChain(file, start, length2, messageChain
|
|
|
17460
17492
|
code: messageChain.code,
|
|
17461
17493
|
category: messageChain.category,
|
|
17462
17494
|
messageText: messageChain.next ? messageChain : messageChain.messageText,
|
|
17463
|
-
relatedInformation
|
|
17495
|
+
relatedInformation,
|
|
17496
|
+
canonicalHead: messageChain.canonicalHead
|
|
17464
17497
|
};
|
|
17465
17498
|
}
|
|
17466
17499
|
function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
|
|
@@ -17492,6 +17525,12 @@ function createDiagnosticForRange(sourceFile, range, message) {
|
|
|
17492
17525
|
messageText: message.message
|
|
17493
17526
|
};
|
|
17494
17527
|
}
|
|
17528
|
+
function getCanonicalDiagnostic(message, ...args) {
|
|
17529
|
+
return {
|
|
17530
|
+
code: message.code,
|
|
17531
|
+
messageText: formatMessage(message, ...args)
|
|
17532
|
+
};
|
|
17533
|
+
}
|
|
17495
17534
|
function getSpanOfTokenAtPosition(sourceFile, pos) {
|
|
17496
17535
|
const scanner2 = createScanner(
|
|
17497
17536
|
sourceFile.languageVersion,
|
|
@@ -21625,7 +21664,9 @@ function compareDiagnostics(d1, d2) {
|
|
|
21625
21664
|
return compareDiagnosticsSkipRelatedInformation(d1, d2) || compareRelatedInformation(d1, d2) || 0 /* EqualTo */;
|
|
21626
21665
|
}
|
|
21627
21666
|
function compareDiagnosticsSkipRelatedInformation(d1, d2) {
|
|
21628
|
-
|
|
21667
|
+
const code1 = getDiagnosticCode(d1);
|
|
21668
|
+
const code2 = getDiagnosticCode(d2);
|
|
21669
|
+
return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(code1, code2) || compareMessageText(d1, d2) || 0 /* EqualTo */;
|
|
21629
21670
|
}
|
|
21630
21671
|
function compareRelatedInformation(d1, d2) {
|
|
21631
21672
|
if (!d1.relatedInformation && !d2.relatedInformation) {
|
|
@@ -21639,21 +21680,32 @@ function compareRelatedInformation(d1, d2) {
|
|
|
21639
21680
|
}
|
|
21640
21681
|
return d1.relatedInformation ? -1 /* LessThan */ : 1 /* GreaterThan */;
|
|
21641
21682
|
}
|
|
21642
|
-
function compareMessageText(
|
|
21643
|
-
|
|
21644
|
-
|
|
21683
|
+
function compareMessageText(d1, d2) {
|
|
21684
|
+
let headMsg1 = getDiagnosticMessage(d1);
|
|
21685
|
+
let headMsg2 = getDiagnosticMessage(d2);
|
|
21686
|
+
if (typeof headMsg1 !== "string") {
|
|
21687
|
+
headMsg1 = headMsg1.messageText;
|
|
21645
21688
|
}
|
|
21646
|
-
if (typeof
|
|
21647
|
-
|
|
21689
|
+
if (typeof headMsg2 !== "string") {
|
|
21690
|
+
headMsg2 = headMsg2.messageText;
|
|
21648
21691
|
}
|
|
21649
|
-
|
|
21650
|
-
|
|
21692
|
+
const chain1 = typeof d1.messageText !== "string" ? d1.messageText.next : void 0;
|
|
21693
|
+
const chain2 = typeof d2.messageText !== "string" ? d2.messageText.next : void 0;
|
|
21694
|
+
let res = compareStringsCaseSensitive(headMsg1, headMsg2);
|
|
21695
|
+
if (res) {
|
|
21696
|
+
return res;
|
|
21651
21697
|
}
|
|
21652
|
-
|
|
21698
|
+
res = compareMessageChain(chain1, chain2);
|
|
21653
21699
|
if (res) {
|
|
21654
21700
|
return res;
|
|
21655
21701
|
}
|
|
21656
|
-
|
|
21702
|
+
if (d1.canonicalHead && !d2.canonicalHead) {
|
|
21703
|
+
return -1 /* LessThan */;
|
|
21704
|
+
}
|
|
21705
|
+
if (d2.canonicalHead && !d1.canonicalHead) {
|
|
21706
|
+
return 1 /* GreaterThan */;
|
|
21707
|
+
}
|
|
21708
|
+
return 0 /* EqualTo */;
|
|
21657
21709
|
}
|
|
21658
21710
|
function compareMessageChain(c1, c2) {
|
|
21659
21711
|
if (c1 === void 0 && c2 === void 0) {
|
|
@@ -21707,7 +21759,19 @@ function compareMessageChainContent(c1, c2) {
|
|
|
21707
21759
|
return 0 /* EqualTo */;
|
|
21708
21760
|
}
|
|
21709
21761
|
function diagnosticsEqualityComparer(d1, d2) {
|
|
21710
|
-
|
|
21762
|
+
const code1 = getDiagnosticCode(d1);
|
|
21763
|
+
const code2 = getDiagnosticCode(d2);
|
|
21764
|
+
const msg1 = getDiagnosticMessage(d1);
|
|
21765
|
+
const msg2 = getDiagnosticMessage(d2);
|
|
21766
|
+
return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) === 0 /* EqualTo */ && compareValues(d1.start, d2.start) === 0 /* EqualTo */ && compareValues(d1.length, d2.length) === 0 /* EqualTo */ && compareValues(code1, code2) === 0 /* EqualTo */ && messageTextEqualityComparer(msg1, msg2);
|
|
21767
|
+
}
|
|
21768
|
+
function getDiagnosticCode(d) {
|
|
21769
|
+
var _a;
|
|
21770
|
+
return ((_a = d.canonicalHead) == null ? void 0 : _a.code) || d.code;
|
|
21771
|
+
}
|
|
21772
|
+
function getDiagnosticMessage(d) {
|
|
21773
|
+
var _a;
|
|
21774
|
+
return ((_a = d.canonicalHead) == null ? void 0 : _a.messageText) || d.messageText;
|
|
21711
21775
|
}
|
|
21712
21776
|
function messageTextEqualityComparer(m1, m2) {
|
|
21713
21777
|
const t1 = typeof m1 === "string" ? m1 : m1.messageText;
|
|
@@ -51826,6 +51890,7 @@ function createTypeChecker(host) {
|
|
|
51826
51890
|
);
|
|
51827
51891
|
const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
51828
51892
|
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
51893
|
+
diagnostic.canonicalHead = getCanonicalDiagnostic(nameNotFoundMessage, diagnosticName(nameArg));
|
|
51829
51894
|
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
51830
51895
|
if (suggestion.valueDeclaration) {
|
|
51831
51896
|
addRelatedInfo(
|
|
@@ -59604,7 +59669,7 @@ function createTypeChecker(host) {
|
|
|
59604
59669
|
}
|
|
59605
59670
|
type = anyType;
|
|
59606
59671
|
}
|
|
59607
|
-
links.type = type;
|
|
59672
|
+
links.type ?? (links.type = type);
|
|
59608
59673
|
}
|
|
59609
59674
|
return links.type;
|
|
59610
59675
|
}
|
|
@@ -59622,7 +59687,7 @@ function createTypeChecker(host) {
|
|
|
59622
59687
|
}
|
|
59623
59688
|
writeType = anyType;
|
|
59624
59689
|
}
|
|
59625
|
-
links.writeType = writeType || getTypeOfAccessors(symbol);
|
|
59690
|
+
links.writeType ?? (links.writeType = writeType || getTypeOfAccessors(symbol));
|
|
59626
59691
|
}
|
|
59627
59692
|
return links.writeType;
|
|
59628
59693
|
}
|
|
@@ -59699,10 +59764,10 @@ function createTypeChecker(host) {
|
|
|
59699
59764
|
true
|
|
59700
59765
|
);
|
|
59701
59766
|
const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
|
|
59702
|
-
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;
|
|
59767
|
+
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);
|
|
59703
59768
|
if (!popTypeResolution()) {
|
|
59704
59769
|
reportCircularityError(exportSymbol ?? symbol);
|
|
59705
|
-
return links.type = errorType;
|
|
59770
|
+
return links.type ?? (links.type = errorType);
|
|
59706
59771
|
}
|
|
59707
59772
|
}
|
|
59708
59773
|
return links.type;
|
|
@@ -59968,7 +60033,7 @@ function createTypeChecker(host) {
|
|
|
59968
60033
|
}
|
|
59969
60034
|
if (!popTypeResolution()) {
|
|
59970
60035
|
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
59971
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
60036
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
59972
60037
|
}
|
|
59973
60038
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
59974
60039
|
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
@@ -59985,9 +60050,9 @@ function createTypeChecker(host) {
|
|
|
59985
60050
|
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)));
|
|
59986
60051
|
}
|
|
59987
60052
|
}
|
|
59988
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
60053
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
59989
60054
|
}
|
|
59990
|
-
type.resolvedBaseConstructorType = baseConstructorType;
|
|
60055
|
+
type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = baseConstructorType);
|
|
59991
60056
|
}
|
|
59992
60057
|
return type.resolvedBaseConstructorType;
|
|
59993
60058
|
}
|
|
@@ -60228,7 +60293,7 @@ function createTypeChecker(host) {
|
|
|
60228
60293
|
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
60229
60294
|
}
|
|
60230
60295
|
}
|
|
60231
|
-
links.declaredType = type;
|
|
60296
|
+
links.declaredType ?? (links.declaredType = type);
|
|
60232
60297
|
}
|
|
60233
60298
|
return links.declaredType;
|
|
60234
60299
|
}
|
|
@@ -61346,6 +61411,7 @@ function createTypeChecker(host) {
|
|
|
61346
61411
|
}
|
|
61347
61412
|
}
|
|
61348
61413
|
function getTypeOfMappedSymbol(symbol) {
|
|
61414
|
+
var _a;
|
|
61349
61415
|
if (!symbol.links.type) {
|
|
61350
61416
|
const mappedType = symbol.links.mappedType;
|
|
61351
61417
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -61364,7 +61430,7 @@ function createTypeChecker(host) {
|
|
|
61364
61430
|
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
61365
61431
|
type = errorType;
|
|
61366
61432
|
}
|
|
61367
|
-
symbol.links.type = type;
|
|
61433
|
+
(_a = symbol.links).type ?? (_a.type = type);
|
|
61368
61434
|
}
|
|
61369
61435
|
return symbol.links.type;
|
|
61370
61436
|
}
|
|
@@ -61717,7 +61783,7 @@ function createTypeChecker(host) {
|
|
|
61717
61783
|
}
|
|
61718
61784
|
result = circularConstraintType;
|
|
61719
61785
|
}
|
|
61720
|
-
t.immediateBaseConstraint = result || noConstraintType;
|
|
61786
|
+
t.immediateBaseConstraint ?? (t.immediateBaseConstraint = result || noConstraintType);
|
|
61721
61787
|
}
|
|
61722
61788
|
return t.immediateBaseConstraint;
|
|
61723
61789
|
}
|
|
@@ -62591,7 +62657,7 @@ function createTypeChecker(host) {
|
|
|
62591
62657
|
}
|
|
62592
62658
|
type = anyType;
|
|
62593
62659
|
}
|
|
62594
|
-
signature.resolvedReturnType = type;
|
|
62660
|
+
signature.resolvedReturnType ?? (signature.resolvedReturnType = type);
|
|
62595
62661
|
}
|
|
62596
62662
|
return signature.resolvedReturnType;
|
|
62597
62663
|
}
|
|
@@ -62937,9 +63003,9 @@ function createTypeChecker(host) {
|
|
|
62937
63003
|
const node = type.node;
|
|
62938
63004
|
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);
|
|
62939
63005
|
if (popTypeResolution()) {
|
|
62940
|
-
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
63006
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
|
|
62941
63007
|
} else {
|
|
62942
|
-
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
63008
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
|
|
62943
63009
|
error2(
|
|
62944
63010
|
type.node || currentNode,
|
|
62945
63011
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
@@ -67998,6 +68064,16 @@ function createTypeChecker(host) {
|
|
|
67998
68064
|
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
67999
68065
|
}
|
|
68000
68066
|
if (!headMessage2 && maybeSuppress) {
|
|
68067
|
+
const savedErrorState = captureErrorCalculationState();
|
|
68068
|
+
reportRelationError(headMessage2, source2, target2);
|
|
68069
|
+
let canonical;
|
|
68070
|
+
if (errorInfo && errorInfo !== savedErrorState.errorInfo) {
|
|
68071
|
+
canonical = { code: errorInfo.code, messageText: errorInfo.messageText };
|
|
68072
|
+
}
|
|
68073
|
+
resetErrorInfo(savedErrorState);
|
|
68074
|
+
if (canonical && errorInfo) {
|
|
68075
|
+
errorInfo.canonicalHead = canonical;
|
|
68076
|
+
}
|
|
68001
68077
|
lastSkippedInfo = [source2, target2];
|
|
68002
68078
|
return;
|
|
68003
68079
|
}
|
|
@@ -69986,6 +70062,7 @@ function createTypeChecker(host) {
|
|
|
69986
70062
|
if (!links.variances) {
|
|
69987
70063
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
69988
70064
|
const oldVarianceComputation = inVarianceComputation;
|
|
70065
|
+
const saveResolutionStart = resolutionStart;
|
|
69989
70066
|
if (!inVarianceComputation) {
|
|
69990
70067
|
inVarianceComputation = true;
|
|
69991
70068
|
resolutionStart = resolutionTargets.length;
|
|
@@ -70020,7 +70097,7 @@ function createTypeChecker(host) {
|
|
|
70020
70097
|
}
|
|
70021
70098
|
if (!oldVarianceComputation) {
|
|
70022
70099
|
inVarianceComputation = false;
|
|
70023
|
-
resolutionStart =
|
|
70100
|
+
resolutionStart = saveResolutionStart;
|
|
70024
70101
|
}
|
|
70025
70102
|
links.variances = variances;
|
|
70026
70103
|
(_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
|
|
@@ -74213,7 +74290,7 @@ function createTypeChecker(host) {
|
|
|
74213
74290
|
reportCircularityError(declaration.symbol);
|
|
74214
74291
|
return true;
|
|
74215
74292
|
}
|
|
74216
|
-
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
74293
|
+
links.parameterInitializerContainsUndefined ?? (links.parameterInitializerContainsUndefined = containsUndefined);
|
|
74217
74294
|
}
|
|
74218
74295
|
return links.parameterInitializerContainsUndefined;
|
|
74219
74296
|
}
|
|
@@ -76020,7 +76097,7 @@ function createTypeChecker(host) {
|
|
|
76020
76097
|
}
|
|
76021
76098
|
function checkGrammarRegularExpressionLiteral(node) {
|
|
76022
76099
|
const sourceFile = getSourceFileOfNode(node);
|
|
76023
|
-
if (!hasParseDiagnostics(sourceFile)) {
|
|
76100
|
+
if (!hasParseDiagnostics(sourceFile) && !node.isUnterminated) {
|
|
76024
76101
|
let lastError;
|
|
76025
76102
|
scanner2 ?? (scanner2 = createScanner(
|
|
76026
76103
|
99 /* ESNext */,
|
|
@@ -79622,8 +79699,13 @@ function createTypeChecker(host) {
|
|
|
79622
79699
|
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
|
79623
79700
|
return cached;
|
|
79624
79701
|
}
|
|
79702
|
+
const saveResolutionStart = resolutionStart;
|
|
79703
|
+
if (!cached) {
|
|
79704
|
+
resolutionStart = resolutionTargets.length;
|
|
79705
|
+
}
|
|
79625
79706
|
links.resolvedSignature = resolvingSignature;
|
|
79626
79707
|
let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
|
|
79708
|
+
resolutionStart = saveResolutionStart;
|
|
79627
79709
|
if (result !== resolvingSignature) {
|
|
79628
79710
|
if (links.resolvedSignature !== resolvingSignature) {
|
|
79629
79711
|
result = links.resolvedSignature;
|
|
@@ -157690,7 +157772,7 @@ registerCodeFix({
|
|
|
157690
157772
|
actions2,
|
|
157691
157773
|
createCodeFixAction(
|
|
157692
157774
|
addMissingParamFixId,
|
|
157693
|
-
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.
|
|
157775
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newParameters)),
|
|
157694
157776
|
[length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name],
|
|
157695
157777
|
addMissingParamFixId,
|
|
157696
157778
|
Diagnostics.Add_all_missing_parameters
|
|
@@ -157702,7 +157784,7 @@ registerCodeFix({
|
|
|
157702
157784
|
actions2,
|
|
157703
157785
|
createCodeFixAction(
|
|
157704
157786
|
addOptionalParamFixId,
|
|
157705
|
-
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.
|
|
157787
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newOptionalParameters)),
|
|
157706
157788
|
[length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name],
|
|
157707
157789
|
addOptionalParamFixId,
|
|
157708
157790
|
Diagnostics.Add_all_optional_parameters
|
|
@@ -157716,10 +157798,10 @@ registerCodeFix({
|
|
|
157716
157798
|
if (info) {
|
|
157717
157799
|
const { declarations, newParameters, newOptionalParameters } = info;
|
|
157718
157800
|
if (context.fixId === addMissingParamFixId) {
|
|
157719
|
-
doChange19(changes, context.
|
|
157801
|
+
doChange19(changes, context.program, context.preferences, context.host, declarations, newParameters);
|
|
157720
157802
|
}
|
|
157721
157803
|
if (context.fixId === addOptionalParamFixId) {
|
|
157722
|
-
doChange19(changes, context.
|
|
157804
|
+
doChange19(changes, context.program, context.preferences, context.host, declarations, newOptionalParameters);
|
|
157723
157805
|
}
|
|
157724
157806
|
}
|
|
157725
157807
|
})
|
|
@@ -157799,14 +157881,17 @@ function tryGetName2(node) {
|
|
|
157799
157881
|
function typeToTypeNode(checker, type, enclosingDeclaration) {
|
|
157800
157882
|
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
157801
157883
|
}
|
|
157802
|
-
function doChange19(changes,
|
|
157884
|
+
function doChange19(changes, program, preferences, host, declarations, newParameters) {
|
|
157885
|
+
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
157803
157886
|
forEach(declarations, (declaration) => {
|
|
157887
|
+
const sourceFile = getSourceFileOfNode(declaration);
|
|
157888
|
+
const importAdder = createImportAdder(sourceFile, program, preferences, host);
|
|
157804
157889
|
if (length(declaration.parameters)) {
|
|
157805
157890
|
changes.replaceNodeRangeWithNodes(
|
|
157806
157891
|
sourceFile,
|
|
157807
157892
|
first(declaration.parameters),
|
|
157808
157893
|
last(declaration.parameters),
|
|
157809
|
-
updateParameters(declaration, newParameters),
|
|
157894
|
+
updateParameters(importAdder, scriptTarget, declaration, newParameters),
|
|
157810
157895
|
{
|
|
157811
157896
|
joiner: ", ",
|
|
157812
157897
|
indentation: 0,
|
|
@@ -157815,7 +157900,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
|
157815
157900
|
}
|
|
157816
157901
|
);
|
|
157817
157902
|
} else {
|
|
157818
|
-
forEach(updateParameters(declaration, newParameters), (parameter, index) => {
|
|
157903
|
+
forEach(updateParameters(importAdder, scriptTarget, declaration, newParameters), (parameter, index) => {
|
|
157819
157904
|
if (length(declaration.parameters) === 0 && index === 0) {
|
|
157820
157905
|
changes.insertNodeAt(sourceFile, declaration.parameters.end, parameter);
|
|
157821
157906
|
} else {
|
|
@@ -157823,6 +157908,7 @@ function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
|
157823
157908
|
}
|
|
157824
157909
|
});
|
|
157825
157910
|
}
|
|
157911
|
+
importAdder.writeFixes(changes);
|
|
157826
157912
|
});
|
|
157827
157913
|
}
|
|
157828
157914
|
function isConvertibleSignatureDeclaration(node) {
|
|
@@ -157836,7 +157922,7 @@ function isConvertibleSignatureDeclaration(node) {
|
|
|
157836
157922
|
return false;
|
|
157837
157923
|
}
|
|
157838
157924
|
}
|
|
157839
|
-
function updateParameters(node, newParameters) {
|
|
157925
|
+
function updateParameters(importAdder, scriptTarget, node, newParameters) {
|
|
157840
157926
|
const parameters = map(node.parameters, (p) => factory.createParameterDeclaration(
|
|
157841
157927
|
p.modifiers,
|
|
157842
157928
|
p.dotDotDotToken,
|
|
@@ -157856,7 +157942,7 @@ function updateParameters(node, newParameters) {
|
|
|
157856
157942
|
declaration.dotDotDotToken,
|
|
157857
157943
|
declaration.name,
|
|
157858
157944
|
prev && prev.questionToken ? factory.createToken(58 /* QuestionToken */) : declaration.questionToken,
|
|
157859
|
-
declaration.type,
|
|
157945
|
+
getParameterType(importAdder, declaration.type, scriptTarget),
|
|
157860
157946
|
declaration.initializer
|
|
157861
157947
|
)
|
|
157862
157948
|
);
|
|
@@ -157897,6 +157983,14 @@ function createParameter(name, type, questionToken) {
|
|
|
157897
157983
|
function isOptionalPos(declarations, pos) {
|
|
157898
157984
|
return length(declarations) && some(declarations, (d) => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === void 0);
|
|
157899
157985
|
}
|
|
157986
|
+
function getParameterType(importAdder, typeNode, scriptTarget) {
|
|
157987
|
+
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
157988
|
+
if (importableReference) {
|
|
157989
|
+
importSymbols(importAdder, importableReference.symbols);
|
|
157990
|
+
return importableReference.typeNode;
|
|
157991
|
+
}
|
|
157992
|
+
return typeNode;
|
|
157993
|
+
}
|
|
157900
157994
|
|
|
157901
157995
|
// src/services/codefixes/fixCannotFindModule.ts
|
|
157902
157996
|
var fixName2 = "fixCannotFindModule";
|
|
@@ -178464,6 +178558,7 @@ __export(ts_exports2, {
|
|
|
178464
178558
|
getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
|
|
178465
178559
|
getBuilderCreationParameters: () => getBuilderCreationParameters,
|
|
178466
178560
|
getBuilderFileEmit: () => getBuilderFileEmit,
|
|
178561
|
+
getCanonicalDiagnostic: () => getCanonicalDiagnostic,
|
|
178467
178562
|
getCheckFlags: () => getCheckFlags,
|
|
178468
178563
|
getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
|
|
178469
178564
|
getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
|
|
@@ -180951,7 +181046,7 @@ __export(ts_server_protocol_exports, {
|
|
|
180951
181046
|
NewLineKind: () => NewLineKind2,
|
|
180952
181047
|
OrganizeImportsMode: () => OrganizeImportsMode,
|
|
180953
181048
|
PollingWatchKind: () => PollingWatchKind2,
|
|
180954
|
-
ScriptTarget: () =>
|
|
181049
|
+
ScriptTarget: () => ScriptTarget11,
|
|
180955
181050
|
SemicolonPreference: () => SemicolonPreference,
|
|
180956
181051
|
WatchDirectoryKind: () => WatchDirectoryKind2,
|
|
180957
181052
|
WatchFileKind: () => WatchFileKind2
|
|
@@ -181140,24 +181235,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
181140
181235
|
NewLineKind3["Lf"] = "Lf";
|
|
181141
181236
|
return NewLineKind3;
|
|
181142
181237
|
})(NewLineKind2 || {});
|
|
181143
|
-
var
|
|
181144
|
-
|
|
181145
|
-
|
|
181146
|
-
|
|
181147
|
-
|
|
181148
|
-
|
|
181149
|
-
|
|
181150
|
-
|
|
181151
|
-
|
|
181152
|
-
|
|
181153
|
-
|
|
181154
|
-
|
|
181155
|
-
|
|
181156
|
-
|
|
181157
|
-
|
|
181158
|
-
|
|
181159
|
-
return
|
|
181160
|
-
})(
|
|
181238
|
+
var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
|
|
181239
|
+
ScriptTarget12["ES3"] = "es3";
|
|
181240
|
+
ScriptTarget12["ES5"] = "es5";
|
|
181241
|
+
ScriptTarget12["ES6"] = "es6";
|
|
181242
|
+
ScriptTarget12["ES2015"] = "es2015";
|
|
181243
|
+
ScriptTarget12["ES2016"] = "es2016";
|
|
181244
|
+
ScriptTarget12["ES2017"] = "es2017";
|
|
181245
|
+
ScriptTarget12["ES2018"] = "es2018";
|
|
181246
|
+
ScriptTarget12["ES2019"] = "es2019";
|
|
181247
|
+
ScriptTarget12["ES2020"] = "es2020";
|
|
181248
|
+
ScriptTarget12["ES2021"] = "es2021";
|
|
181249
|
+
ScriptTarget12["ES2022"] = "es2022";
|
|
181250
|
+
ScriptTarget12["ES2023"] = "es2023";
|
|
181251
|
+
ScriptTarget12["ESNext"] = "esnext";
|
|
181252
|
+
ScriptTarget12["JSON"] = "json";
|
|
181253
|
+
ScriptTarget12["Latest"] = "esnext" /* ESNext */;
|
|
181254
|
+
return ScriptTarget12;
|
|
181255
|
+
})(ScriptTarget11 || {});
|
|
181161
181256
|
{
|
|
181162
181257
|
}
|
|
181163
181258
|
|
|
@@ -192891,6 +192986,7 @@ if (typeof console !== "undefined") {
|
|
|
192891
192986
|
getBuildOrderFromAnyBuildOrder,
|
|
192892
192987
|
getBuilderCreationParameters,
|
|
192893
192988
|
getBuilderFileEmit,
|
|
192989
|
+
getCanonicalDiagnostic,
|
|
192894
192990
|
getCheckFlags,
|
|
192895
192991
|
getClassExtendsHeritageElement,
|
|
192896
192992
|
getClassLikeDeclarationOfSymbol,
|