@typescript-deploys/pr-build 5.5.0-pr-58352-3 → 5.5.0-pr-58243-49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.iterable.d.ts +67 -67
- package/lib/lib.es2018.asynciterable.d.ts +5 -5
- package/lib/lib.es2020.bigint.d.ts +8 -8
- package/lib/lib.es2020.string.d.ts +1 -1
- package/lib/lib.es2020.symbol.wellknown.d.ts +1 -1
- package/lib/lib.es2022.intl.d.ts +1 -1
- package/lib/tsc.js +986 -964
- package/lib/typescript.js +1049 -1012
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240430`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6203,7 +6203,7 @@ var Diagnostics = {
|
|
|
6203
6203
|
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."),
|
|
6204
6204
|
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."),
|
|
6205
6205
|
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."),
|
|
6206
|
-
|
|
6206
|
+
Expected_a_class_set_operand: diag(1520, 1 /* Error */, "Expected_a_class_set_operand_1520", "Expected a class set operand."),
|
|
6207
6207
|
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."),
|
|
6208
6208
|
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?"),
|
|
6209
6209
|
Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
|
|
@@ -8689,6 +8689,18 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8689
8689
|
});
|
|
8690
8690
|
}
|
|
8691
8691
|
return scanner;
|
|
8692
|
+
function codePointUnchecked(pos2) {
|
|
8693
|
+
return codePointAt(text, pos2);
|
|
8694
|
+
}
|
|
8695
|
+
function codePointChecked(pos2) {
|
|
8696
|
+
return pos2 >= 0 && pos2 < end ? codePointUnchecked(pos2) : -1 /* EOF */;
|
|
8697
|
+
}
|
|
8698
|
+
function charCodeUnchecked(pos2) {
|
|
8699
|
+
return text.charCodeAt(pos2);
|
|
8700
|
+
}
|
|
8701
|
+
function charCodeChecked(pos2) {
|
|
8702
|
+
return pos2 >= 0 && pos2 < end ? charCodeUnchecked(pos2) : -1 /* EOF */;
|
|
8703
|
+
}
|
|
8692
8704
|
function error(message, errPos = pos, length3, arg0) {
|
|
8693
8705
|
if (onError) {
|
|
8694
8706
|
const oldPos = pos;
|
|
@@ -8703,7 +8715,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8703
8715
|
let isPreviousTokenSeparator = false;
|
|
8704
8716
|
let result = "";
|
|
8705
8717
|
while (true) {
|
|
8706
|
-
const ch =
|
|
8718
|
+
const ch = charCodeUnchecked(pos);
|
|
8707
8719
|
if (ch === 95 /* _ */) {
|
|
8708
8720
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
8709
8721
|
if (allowSeparator) {
|
|
@@ -8730,7 +8742,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8730
8742
|
}
|
|
8731
8743
|
break;
|
|
8732
8744
|
}
|
|
8733
|
-
if (
|
|
8745
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
8734
8746
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
8735
8747
|
error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
8736
8748
|
}
|
|
@@ -8739,9 +8751,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8739
8751
|
function scanNumber() {
|
|
8740
8752
|
let start2 = pos;
|
|
8741
8753
|
let mainFragment;
|
|
8742
|
-
if (
|
|
8754
|
+
if (charCodeUnchecked(pos) === 48 /* _0 */) {
|
|
8743
8755
|
pos++;
|
|
8744
|
-
if (
|
|
8756
|
+
if (charCodeUnchecked(pos) === 95 /* _ */) {
|
|
8745
8757
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
8746
8758
|
error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
8747
8759
|
pos--;
|
|
@@ -8766,15 +8778,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8766
8778
|
}
|
|
8767
8779
|
let decimalFragment;
|
|
8768
8780
|
let scientificFragment;
|
|
8769
|
-
if (
|
|
8781
|
+
if (charCodeUnchecked(pos) === 46 /* dot */) {
|
|
8770
8782
|
pos++;
|
|
8771
8783
|
decimalFragment = scanNumberFragment();
|
|
8772
8784
|
}
|
|
8773
8785
|
let end2 = pos;
|
|
8774
|
-
if (
|
|
8786
|
+
if (charCodeUnchecked(pos) === 69 /* E */ || charCodeUnchecked(pos) === 101 /* e */) {
|
|
8775
8787
|
pos++;
|
|
8776
8788
|
tokenFlags |= 16 /* Scientific */;
|
|
8777
|
-
if (
|
|
8789
|
+
if (charCodeUnchecked(pos) === 43 /* plus */ || charCodeUnchecked(pos) === 45 /* minus */)
|
|
8778
8790
|
pos++;
|
|
8779
8791
|
const preNumericPart = pos;
|
|
8780
8792
|
const finalFragment = scanNumberFragment();
|
|
@@ -8814,7 +8826,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8814
8826
|
}
|
|
8815
8827
|
}
|
|
8816
8828
|
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
|
|
8817
|
-
if (!isIdentifierStart(
|
|
8829
|
+
if (!isIdentifierStart(codePointUnchecked(pos), languageVersion)) {
|
|
8818
8830
|
return;
|
|
8819
8831
|
}
|
|
8820
8832
|
const identifierStart = pos;
|
|
@@ -8833,8 +8845,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8833
8845
|
function scanDigits() {
|
|
8834
8846
|
const start2 = pos;
|
|
8835
8847
|
let isOctal = true;
|
|
8836
|
-
while (isDigit(
|
|
8837
|
-
if (!isOctalDigit(
|
|
8848
|
+
while (isDigit(charCodeChecked(pos))) {
|
|
8849
|
+
if (!isOctalDigit(charCodeUnchecked(pos))) {
|
|
8838
8850
|
isOctal = false;
|
|
8839
8851
|
}
|
|
8840
8852
|
pos++;
|
|
@@ -8866,7 +8878,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8866
8878
|
let allowSeparator = false;
|
|
8867
8879
|
let isPreviousTokenSeparator = false;
|
|
8868
8880
|
while (valueChars.length < minCount || scanAsManyAsPossible) {
|
|
8869
|
-
let ch =
|
|
8881
|
+
let ch = charCodeUnchecked(pos);
|
|
8870
8882
|
if (canHaveSeparators && ch === 95 /* _ */) {
|
|
8871
8883
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
8872
8884
|
if (allowSeparator) {
|
|
@@ -8893,13 +8905,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8893
8905
|
if (valueChars.length < minCount) {
|
|
8894
8906
|
valueChars = [];
|
|
8895
8907
|
}
|
|
8896
|
-
if (
|
|
8908
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
8897
8909
|
error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
8898
8910
|
}
|
|
8899
8911
|
return String.fromCharCode(...valueChars);
|
|
8900
8912
|
}
|
|
8901
8913
|
function scanString(jsxAttributeString = false) {
|
|
8902
|
-
const quote =
|
|
8914
|
+
const quote = charCodeUnchecked(pos);
|
|
8903
8915
|
pos++;
|
|
8904
8916
|
let result = "";
|
|
8905
8917
|
let start2 = pos;
|
|
@@ -8910,7 +8922,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8910
8922
|
error(Diagnostics.Unterminated_string_literal);
|
|
8911
8923
|
break;
|
|
8912
8924
|
}
|
|
8913
|
-
const ch =
|
|
8925
|
+
const ch = charCodeUnchecked(pos);
|
|
8914
8926
|
if (ch === quote) {
|
|
8915
8927
|
result += text.substring(start2, pos);
|
|
8916
8928
|
pos++;
|
|
@@ -8938,7 +8950,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8938
8950
|
return result;
|
|
8939
8951
|
}
|
|
8940
8952
|
function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
|
|
8941
|
-
const startedWithBacktick =
|
|
8953
|
+
const startedWithBacktick = charCodeUnchecked(pos) === 96 /* backtick */;
|
|
8942
8954
|
pos++;
|
|
8943
8955
|
let start2 = pos;
|
|
8944
8956
|
let contents = "";
|
|
@@ -8951,14 +8963,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8951
8963
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
8952
8964
|
break;
|
|
8953
8965
|
}
|
|
8954
|
-
const currChar =
|
|
8966
|
+
const currChar = charCodeUnchecked(pos);
|
|
8955
8967
|
if (currChar === 96 /* backtick */) {
|
|
8956
8968
|
contents += text.substring(start2, pos);
|
|
8957
8969
|
pos++;
|
|
8958
8970
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
8959
8971
|
break;
|
|
8960
8972
|
}
|
|
8961
|
-
if (currChar === 36 /* $ */ && pos + 1 < end &&
|
|
8973
|
+
if (currChar === 36 /* $ */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 123 /* openBrace */) {
|
|
8962
8974
|
contents += text.substring(start2, pos);
|
|
8963
8975
|
pos += 2;
|
|
8964
8976
|
resultingToken = startedWithBacktick ? 16 /* TemplateHead */ : 17 /* TemplateMiddle */;
|
|
@@ -8977,7 +8989,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8977
8989
|
if (currChar === 13 /* carriageReturn */) {
|
|
8978
8990
|
contents += text.substring(start2, pos);
|
|
8979
8991
|
pos++;
|
|
8980
|
-
if (pos < end &&
|
|
8992
|
+
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
8981
8993
|
pos++;
|
|
8982
8994
|
}
|
|
8983
8995
|
contents += "\n";
|
|
@@ -8997,24 +9009,24 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8997
9009
|
error(Diagnostics.Unexpected_end_of_text);
|
|
8998
9010
|
return "";
|
|
8999
9011
|
}
|
|
9000
|
-
const ch =
|
|
9012
|
+
const ch = charCodeUnchecked(pos);
|
|
9001
9013
|
pos++;
|
|
9002
9014
|
switch (ch) {
|
|
9003
9015
|
case 48 /* _0 */:
|
|
9004
|
-
if (pos >= end || !isDigit(
|
|
9016
|
+
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
9005
9017
|
return "\0";
|
|
9006
9018
|
}
|
|
9007
9019
|
case 49 /* _1 */:
|
|
9008
9020
|
case 50 /* _2 */:
|
|
9009
9021
|
case 51 /* _3 */:
|
|
9010
|
-
if (pos < end && isOctalDigit(
|
|
9022
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
9011
9023
|
pos++;
|
|
9012
9024
|
}
|
|
9013
9025
|
case 52 /* _4 */:
|
|
9014
9026
|
case 53 /* _5 */:
|
|
9015
9027
|
case 54 /* _6 */:
|
|
9016
9028
|
case 55 /* _7 */:
|
|
9017
|
-
if (pos < end && isOctalDigit(
|
|
9029
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
9018
9030
|
pos++;
|
|
9019
9031
|
}
|
|
9020
9032
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
@@ -9051,12 +9063,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9051
9063
|
case 34 /* doubleQuote */:
|
|
9052
9064
|
return '"';
|
|
9053
9065
|
case 117 /* u */:
|
|
9054
|
-
if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end &&
|
|
9066
|
+
if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
9055
9067
|
pos -= 2;
|
|
9056
9068
|
return scanExtendedUnicodeEscape(!!isRegularExpression || shouldEmitInvalidEscapeError);
|
|
9057
9069
|
}
|
|
9058
9070
|
for (; pos < start2 + 6; pos++) {
|
|
9059
|
-
if (!(pos < end && isHexDigit(
|
|
9071
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
9060
9072
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9061
9073
|
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
9062
9074
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
@@ -9067,11 +9079,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9067
9079
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
9068
9080
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
9069
9081
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
9070
|
-
if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" &&
|
|
9082
|
+
if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
|
|
9071
9083
|
const nextStart = pos;
|
|
9072
9084
|
let nextPos = pos + 2;
|
|
9073
9085
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
9074
|
-
if (!isHexDigit(
|
|
9086
|
+
if (!isHexDigit(charCodeUnchecked(pos))) {
|
|
9075
9087
|
return escapedValueString;
|
|
9076
9088
|
}
|
|
9077
9089
|
}
|
|
@@ -9084,7 +9096,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9084
9096
|
return escapedValueString;
|
|
9085
9097
|
case 120 /* x */:
|
|
9086
9098
|
for (; pos < start2 + 4; pos++) {
|
|
9087
|
-
if (!(pos < end && isHexDigit(
|
|
9099
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
9088
9100
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9089
9101
|
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
9090
9102
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
@@ -9095,7 +9107,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9095
9107
|
tokenFlags |= 4096 /* HexEscape */;
|
|
9096
9108
|
return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
|
|
9097
9109
|
case 13 /* carriageReturn */:
|
|
9098
|
-
if (pos < end &&
|
|
9110
|
+
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
9099
9111
|
pos++;
|
|
9100
9112
|
}
|
|
9101
9113
|
case 10 /* lineFeed */:
|
|
@@ -9136,7 +9148,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9136
9148
|
error(Diagnostics.Unexpected_end_of_text);
|
|
9137
9149
|
}
|
|
9138
9150
|
isInvalidExtendedEscape = true;
|
|
9139
|
-
} else if (
|
|
9151
|
+
} else if (charCodeUnchecked(pos) === 125 /* closeBrace */) {
|
|
9140
9152
|
pos++;
|
|
9141
9153
|
} else {
|
|
9142
9154
|
if (shouldEmitInvalidEscapeError) {
|
|
@@ -9152,7 +9164,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9152
9164
|
return utf16EncodeAsString(escapedValue);
|
|
9153
9165
|
}
|
|
9154
9166
|
function peekUnicodeEscape() {
|
|
9155
|
-
if (pos + 5 < end &&
|
|
9167
|
+
if (pos + 5 < end && charCodeUnchecked(pos + 1) === 117 /* u */) {
|
|
9156
9168
|
const start2 = pos;
|
|
9157
9169
|
pos += 2;
|
|
9158
9170
|
const value = scanExactNumberOfHexDigits(
|
|
@@ -9166,7 +9178,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9166
9178
|
return -1;
|
|
9167
9179
|
}
|
|
9168
9180
|
function peekExtendedUnicodeEscape() {
|
|
9169
|
-
if (
|
|
9181
|
+
if (codePointUnchecked(pos + 1) === 117 /* u */ && codePointUnchecked(pos + 2) === 123 /* openBrace */) {
|
|
9170
9182
|
const start2 = pos;
|
|
9171
9183
|
pos += 3;
|
|
9172
9184
|
const escapedValueString = scanMinimumNumberOfHexDigits(
|
|
@@ -9184,7 +9196,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9184
9196
|
let result = "";
|
|
9185
9197
|
let start2 = pos;
|
|
9186
9198
|
while (pos < end) {
|
|
9187
|
-
let ch =
|
|
9199
|
+
let ch = codePointUnchecked(pos);
|
|
9188
9200
|
if (isIdentifierPart(ch, languageVersion)) {
|
|
9189
9201
|
pos += charSize(ch);
|
|
9190
9202
|
} else if (ch === 92 /* backslash */) {
|
|
@@ -9231,7 +9243,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9231
9243
|
let separatorAllowed = false;
|
|
9232
9244
|
let isPreviousTokenSeparator = false;
|
|
9233
9245
|
while (true) {
|
|
9234
|
-
const ch =
|
|
9246
|
+
const ch = charCodeUnchecked(pos);
|
|
9235
9247
|
if (ch === 95 /* _ */) {
|
|
9236
9248
|
tokenFlags |= 512 /* ContainsSeparator */;
|
|
9237
9249
|
if (separatorAllowed) {
|
|
@@ -9253,13 +9265,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9253
9265
|
pos++;
|
|
9254
9266
|
isPreviousTokenSeparator = false;
|
|
9255
9267
|
}
|
|
9256
|
-
if (
|
|
9268
|
+
if (charCodeUnchecked(pos - 1) === 95 /* _ */) {
|
|
9257
9269
|
error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
9258
9270
|
}
|
|
9259
9271
|
return value;
|
|
9260
9272
|
}
|
|
9261
9273
|
function checkBigIntSuffix() {
|
|
9262
|
-
if (
|
|
9274
|
+
if (charCodeUnchecked(pos) === 110 /* n */) {
|
|
9263
9275
|
tokenValue += "n";
|
|
9264
9276
|
if (tokenFlags & 384 /* BinaryOrOctalSpecifier */) {
|
|
9265
9277
|
tokenValue = parsePseudoBigInt(tokenValue) + "n";
|
|
@@ -9281,7 +9293,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9281
9293
|
if (pos >= end) {
|
|
9282
9294
|
return token = 1 /* EndOfFileToken */;
|
|
9283
9295
|
}
|
|
9284
|
-
const ch =
|
|
9296
|
+
const ch = codePointUnchecked(pos);
|
|
9285
9297
|
if (pos === 0) {
|
|
9286
9298
|
if (ch === 35 /* hash */ && isShebangTrivia(text, pos)) {
|
|
9287
9299
|
pos = scanShebangTrivia(text, pos);
|
|
@@ -9300,7 +9312,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9300
9312
|
pos++;
|
|
9301
9313
|
continue;
|
|
9302
9314
|
} else {
|
|
9303
|
-
if (ch === 13 /* carriageReturn */ && pos + 1 < end &&
|
|
9315
|
+
if (ch === 13 /* carriageReturn */ && pos + 1 < end && charCodeUnchecked(pos + 1) === 10 /* lineFeed */) {
|
|
9304
9316
|
pos += 2;
|
|
9305
9317
|
} else {
|
|
9306
9318
|
pos++;
|
|
@@ -9333,14 +9345,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9333
9345
|
pos++;
|
|
9334
9346
|
continue;
|
|
9335
9347
|
} else {
|
|
9336
|
-
while (pos < end && isWhiteSpaceSingleLine(
|
|
9348
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
9337
9349
|
pos++;
|
|
9338
9350
|
}
|
|
9339
9351
|
return token = 5 /* WhitespaceTrivia */;
|
|
9340
9352
|
}
|
|
9341
9353
|
case 33 /* exclamation */:
|
|
9342
|
-
if (
|
|
9343
|
-
if (
|
|
9354
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9355
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9344
9356
|
return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */;
|
|
9345
9357
|
}
|
|
9346
9358
|
return pos += 2, token = 36 /* ExclamationEqualsToken */;
|
|
@@ -9357,19 +9369,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9357
9369
|
false
|
|
9358
9370
|
);
|
|
9359
9371
|
case 37 /* percent */:
|
|
9360
|
-
if (
|
|
9372
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9361
9373
|
return pos += 2, token = 70 /* PercentEqualsToken */;
|
|
9362
9374
|
}
|
|
9363
9375
|
pos++;
|
|
9364
9376
|
return token = 45 /* PercentToken */;
|
|
9365
9377
|
case 38 /* ampersand */:
|
|
9366
|
-
if (
|
|
9367
|
-
if (
|
|
9378
|
+
if (charCodeUnchecked(pos + 1) === 38 /* ampersand */) {
|
|
9379
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9368
9380
|
return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */;
|
|
9369
9381
|
}
|
|
9370
9382
|
return pos += 2, token = 56 /* AmpersandAmpersandToken */;
|
|
9371
9383
|
}
|
|
9372
|
-
if (
|
|
9384
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9373
9385
|
return pos += 2, token = 74 /* AmpersandEqualsToken */;
|
|
9374
9386
|
}
|
|
9375
9387
|
pos++;
|
|
@@ -9381,11 +9393,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9381
9393
|
pos++;
|
|
9382
9394
|
return token = 22 /* CloseParenToken */;
|
|
9383
9395
|
case 42 /* asterisk */:
|
|
9384
|
-
if (
|
|
9396
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9385
9397
|
return pos += 2, token = 67 /* AsteriskEqualsToken */;
|
|
9386
9398
|
}
|
|
9387
|
-
if (
|
|
9388
|
-
if (
|
|
9399
|
+
if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
|
|
9400
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9389
9401
|
return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */;
|
|
9390
9402
|
}
|
|
9391
9403
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
@@ -9397,10 +9409,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9397
9409
|
}
|
|
9398
9410
|
return token = 42 /* AsteriskToken */;
|
|
9399
9411
|
case 43 /* plus */:
|
|
9400
|
-
if (
|
|
9412
|
+
if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
|
|
9401
9413
|
return pos += 2, token = 46 /* PlusPlusToken */;
|
|
9402
9414
|
}
|
|
9403
|
-
if (
|
|
9415
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9404
9416
|
return pos += 2, token = 65 /* PlusEqualsToken */;
|
|
9405
9417
|
}
|
|
9406
9418
|
pos++;
|
|
@@ -9409,29 +9421,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9409
9421
|
pos++;
|
|
9410
9422
|
return token = 28 /* CommaToken */;
|
|
9411
9423
|
case 45 /* minus */:
|
|
9412
|
-
if (
|
|
9424
|
+
if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
|
|
9413
9425
|
return pos += 2, token = 47 /* MinusMinusToken */;
|
|
9414
9426
|
}
|
|
9415
|
-
if (
|
|
9427
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9416
9428
|
return pos += 2, token = 66 /* MinusEqualsToken */;
|
|
9417
9429
|
}
|
|
9418
9430
|
pos++;
|
|
9419
9431
|
return token = 41 /* MinusToken */;
|
|
9420
9432
|
case 46 /* dot */:
|
|
9421
|
-
if (isDigit(
|
|
9433
|
+
if (isDigit(charCodeUnchecked(pos + 1))) {
|
|
9422
9434
|
scanNumber();
|
|
9423
9435
|
return token = 9 /* NumericLiteral */;
|
|
9424
9436
|
}
|
|
9425
|
-
if (
|
|
9437
|
+
if (charCodeUnchecked(pos + 1) === 46 /* dot */ && charCodeUnchecked(pos + 2) === 46 /* dot */) {
|
|
9426
9438
|
return pos += 3, token = 26 /* DotDotDotToken */;
|
|
9427
9439
|
}
|
|
9428
9440
|
pos++;
|
|
9429
9441
|
return token = 25 /* DotToken */;
|
|
9430
9442
|
case 47 /* slash */:
|
|
9431
|
-
if (
|
|
9443
|
+
if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
9432
9444
|
pos += 2;
|
|
9433
9445
|
while (pos < end) {
|
|
9434
|
-
if (isLineBreak(
|
|
9446
|
+
if (isLineBreak(charCodeUnchecked(pos))) {
|
|
9435
9447
|
break;
|
|
9436
9448
|
}
|
|
9437
9449
|
pos++;
|
|
@@ -9448,14 +9460,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9448
9460
|
return token = 2 /* SingleLineCommentTrivia */;
|
|
9449
9461
|
}
|
|
9450
9462
|
}
|
|
9451
|
-
if (
|
|
9463
|
+
if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
|
|
9452
9464
|
pos += 2;
|
|
9453
|
-
const isJSDoc2 =
|
|
9465
|
+
const isJSDoc2 = charCodeUnchecked(pos) === 42 /* asterisk */ && charCodeUnchecked(pos + 1) !== 47 /* slash */;
|
|
9454
9466
|
let commentClosed = false;
|
|
9455
9467
|
let lastLineStart = tokenStart;
|
|
9456
9468
|
while (pos < end) {
|
|
9457
|
-
const ch2 =
|
|
9458
|
-
if (ch2 === 42 /* asterisk */ &&
|
|
9469
|
+
const ch2 = charCodeUnchecked(pos);
|
|
9470
|
+
if (ch2 === 42 /* asterisk */ && charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
9459
9471
|
pos += 2;
|
|
9460
9472
|
commentClosed = true;
|
|
9461
9473
|
break;
|
|
@@ -9482,13 +9494,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9482
9494
|
return token = 3 /* MultiLineCommentTrivia */;
|
|
9483
9495
|
}
|
|
9484
9496
|
}
|
|
9485
|
-
if (
|
|
9497
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9486
9498
|
return pos += 2, token = 69 /* SlashEqualsToken */;
|
|
9487
9499
|
}
|
|
9488
9500
|
pos++;
|
|
9489
9501
|
return token = 44 /* SlashToken */;
|
|
9490
9502
|
case 48 /* _0 */:
|
|
9491
|
-
if (pos + 2 < end && (
|
|
9503
|
+
if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 88 /* X */ || charCodeUnchecked(pos + 1) === 120 /* x */)) {
|
|
9492
9504
|
pos += 2;
|
|
9493
9505
|
tokenValue = scanMinimumNumberOfHexDigits(
|
|
9494
9506
|
1,
|
|
@@ -9502,7 +9514,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9502
9514
|
tokenValue = "0x" + tokenValue;
|
|
9503
9515
|
tokenFlags |= 64 /* HexSpecifier */;
|
|
9504
9516
|
return token = checkBigIntSuffix();
|
|
9505
|
-
} else if (pos + 2 < end && (
|
|
9517
|
+
} else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 66 /* B */ || charCodeUnchecked(pos + 1) === 98 /* b */)) {
|
|
9506
9518
|
pos += 2;
|
|
9507
9519
|
tokenValue = scanBinaryOrOctalDigits(
|
|
9508
9520
|
/* base */
|
|
@@ -9515,7 +9527,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9515
9527
|
tokenValue = "0b" + tokenValue;
|
|
9516
9528
|
tokenFlags |= 128 /* BinarySpecifier */;
|
|
9517
9529
|
return token = checkBigIntSuffix();
|
|
9518
|
-
} else if (pos + 2 < end && (
|
|
9530
|
+
} else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 79 /* O */ || charCodeUnchecked(pos + 1) === 111 /* o */)) {
|
|
9519
9531
|
pos += 2;
|
|
9520
9532
|
tokenValue = scanBinaryOrOctalDigits(
|
|
9521
9533
|
/* base */
|
|
@@ -9554,16 +9566,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9554
9566
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
9555
9567
|
}
|
|
9556
9568
|
}
|
|
9557
|
-
if (
|
|
9558
|
-
if (
|
|
9569
|
+
if (charCodeUnchecked(pos + 1) === 60 /* lessThan */) {
|
|
9570
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9559
9571
|
return pos += 3, token = 71 /* LessThanLessThanEqualsToken */;
|
|
9560
9572
|
}
|
|
9561
9573
|
return pos += 2, token = 48 /* LessThanLessThanToken */;
|
|
9562
9574
|
}
|
|
9563
|
-
if (
|
|
9575
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9564
9576
|
return pos += 2, token = 33 /* LessThanEqualsToken */;
|
|
9565
9577
|
}
|
|
9566
|
-
if (languageVariant === 1 /* JSX */ &&
|
|
9578
|
+
if (languageVariant === 1 /* JSX */ && charCodeUnchecked(pos + 1) === 47 /* slash */ && charCodeUnchecked(pos + 2) !== 42 /* asterisk */) {
|
|
9567
9579
|
return pos += 2, token = 31 /* LessThanSlashToken */;
|
|
9568
9580
|
}
|
|
9569
9581
|
pos++;
|
|
@@ -9577,13 +9589,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9577
9589
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
9578
9590
|
}
|
|
9579
9591
|
}
|
|
9580
|
-
if (
|
|
9581
|
-
if (
|
|
9592
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9593
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9582
9594
|
return pos += 3, token = 37 /* EqualsEqualsEqualsToken */;
|
|
9583
9595
|
}
|
|
9584
9596
|
return pos += 2, token = 35 /* EqualsEqualsToken */;
|
|
9585
9597
|
}
|
|
9586
|
-
if (
|
|
9598
|
+
if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
|
|
9587
9599
|
return pos += 2, token = 39 /* EqualsGreaterThanToken */;
|
|
9588
9600
|
}
|
|
9589
9601
|
pos++;
|
|
@@ -9600,11 +9612,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9600
9612
|
pos++;
|
|
9601
9613
|
return token = 32 /* GreaterThanToken */;
|
|
9602
9614
|
case 63 /* question */:
|
|
9603
|
-
if (
|
|
9615
|
+
if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
|
|
9604
9616
|
return pos += 2, token = 29 /* QuestionDotToken */;
|
|
9605
9617
|
}
|
|
9606
|
-
if (
|
|
9607
|
-
if (
|
|
9618
|
+
if (charCodeUnchecked(pos + 1) === 63 /* question */) {
|
|
9619
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9608
9620
|
return pos += 3, token = 78 /* QuestionQuestionEqualsToken */;
|
|
9609
9621
|
}
|
|
9610
9622
|
return pos += 2, token = 61 /* QuestionQuestionToken */;
|
|
@@ -9618,7 +9630,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9618
9630
|
pos++;
|
|
9619
9631
|
return token = 24 /* CloseBracketToken */;
|
|
9620
9632
|
case 94 /* caret */:
|
|
9621
|
-
if (
|
|
9633
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9622
9634
|
return pos += 2, token = 79 /* CaretEqualsToken */;
|
|
9623
9635
|
}
|
|
9624
9636
|
pos++;
|
|
@@ -9635,13 +9647,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9635
9647
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
9636
9648
|
}
|
|
9637
9649
|
}
|
|
9638
|
-
if (
|
|
9639
|
-
if (
|
|
9650
|
+
if (charCodeUnchecked(pos + 1) === 124 /* bar */) {
|
|
9651
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9640
9652
|
return pos += 3, token = 76 /* BarBarEqualsToken */;
|
|
9641
9653
|
}
|
|
9642
9654
|
return pos += 2, token = 57 /* BarBarToken */;
|
|
9643
9655
|
}
|
|
9644
|
-
if (
|
|
9656
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9645
9657
|
return pos += 2, token = 75 /* BarEqualsToken */;
|
|
9646
9658
|
}
|
|
9647
9659
|
pos++;
|
|
@@ -9680,7 +9692,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9680
9692
|
pos++;
|
|
9681
9693
|
return token = 0 /* Unknown */;
|
|
9682
9694
|
}
|
|
9683
|
-
const charAfterHash =
|
|
9695
|
+
const charAfterHash = codePointUnchecked(pos + 1);
|
|
9684
9696
|
if (charAfterHash === 92 /* backslash */) {
|
|
9685
9697
|
pos++;
|
|
9686
9698
|
const extendedCookedChar2 = peekExtendedUnicodeEscape();
|
|
@@ -9750,7 +9762,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9750
9762
|
Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
|
|
9751
9763
|
pos = tokenStart = fullStartPos;
|
|
9752
9764
|
tokenFlags = 0;
|
|
9753
|
-
const ch =
|
|
9765
|
+
const ch = codePointUnchecked(pos);
|
|
9754
9766
|
const identifierKind = scanIdentifier(ch, 99 /* ESNext */);
|
|
9755
9767
|
if (identifierKind) {
|
|
9756
9768
|
return token = identifierKind;
|
|
@@ -9762,7 +9774,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9762
9774
|
let ch = startCharacter;
|
|
9763
9775
|
if (isIdentifierStart(ch, languageVersion2)) {
|
|
9764
9776
|
pos += charSize(ch);
|
|
9765
|
-
while (pos < end && isIdentifierPart(ch =
|
|
9777
|
+
while (pos < end && isIdentifierPart(ch = codePointUnchecked(pos), languageVersion2))
|
|
9766
9778
|
pos += charSize(ch);
|
|
9767
9779
|
tokenValue = text.substring(tokenStart, pos);
|
|
9768
9780
|
if (ch === 92 /* backslash */) {
|
|
@@ -9773,20 +9785,20 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9773
9785
|
}
|
|
9774
9786
|
function reScanGreaterToken() {
|
|
9775
9787
|
if (token === 32 /* GreaterThanToken */) {
|
|
9776
|
-
if (
|
|
9777
|
-
if (
|
|
9778
|
-
if (
|
|
9788
|
+
if (charCodeUnchecked(pos) === 62 /* greaterThan */) {
|
|
9789
|
+
if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
|
|
9790
|
+
if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
|
|
9779
9791
|
return pos += 3, token = 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
|
|
9780
9792
|
}
|
|
9781
9793
|
return pos += 2, token = 50 /* GreaterThanGreaterThanGreaterThanToken */;
|
|
9782
9794
|
}
|
|
9783
|
-
if (
|
|
9795
|
+
if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
|
|
9784
9796
|
return pos += 2, token = 72 /* GreaterThanGreaterThanEqualsToken */;
|
|
9785
9797
|
}
|
|
9786
9798
|
pos++;
|
|
9787
9799
|
return token = 49 /* GreaterThanGreaterThanToken */;
|
|
9788
9800
|
}
|
|
9789
|
-
if (
|
|
9801
|
+
if (charCodeUnchecked(pos) === 61 /* equals */) {
|
|
9790
9802
|
pos++;
|
|
9791
9803
|
return token = 34 /* GreaterThanEqualsToken */;
|
|
9792
9804
|
}
|
|
@@ -9809,7 +9821,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9809
9821
|
error(Diagnostics.Unterminated_regular_expression_literal);
|
|
9810
9822
|
break;
|
|
9811
9823
|
}
|
|
9812
|
-
const ch =
|
|
9824
|
+
const ch = charCodeUnchecked(p);
|
|
9813
9825
|
if (isLineBreak(ch)) {
|
|
9814
9826
|
tokenFlags |= 4 /* Unterminated */;
|
|
9815
9827
|
error(Diagnostics.Unterminated_regular_expression_literal);
|
|
@@ -9833,7 +9845,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9833
9845
|
const endOfBody = p - (isUnterminated ? 0 : 1);
|
|
9834
9846
|
let regExpFlags = 0 /* None */;
|
|
9835
9847
|
while (p < end) {
|
|
9836
|
-
const ch =
|
|
9848
|
+
const ch = charCodeUnchecked(p);
|
|
9837
9849
|
if (!isIdentifierPart(ch, languageVersion)) {
|
|
9838
9850
|
break;
|
|
9839
9851
|
}
|
|
@@ -9852,845 +9864,860 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9852
9864
|
}
|
|
9853
9865
|
p++;
|
|
9854
9866
|
}
|
|
9867
|
+
pos = p;
|
|
9855
9868
|
if (reportErrors2) {
|
|
9856
|
-
|
|
9857
|
-
const saveTokenPos = tokenStart;
|
|
9869
|
+
const saveTokenStart = tokenStart;
|
|
9858
9870
|
const saveTokenFlags = tokenFlags;
|
|
9871
|
+
const savePos = pos;
|
|
9872
|
+
const saveEnd = end;
|
|
9873
|
+
pos = tokenStart + 1;
|
|
9874
|
+
end = endOfBody;
|
|
9859
9875
|
scanRegularExpressionWorker(
|
|
9860
|
-
text,
|
|
9861
|
-
endOfBody,
|
|
9862
9876
|
regExpFlags,
|
|
9863
9877
|
isUnterminated,
|
|
9864
9878
|
/*annexB*/
|
|
9865
9879
|
true
|
|
9866
9880
|
);
|
|
9867
|
-
|
|
9868
|
-
pos = p;
|
|
9869
|
-
}
|
|
9870
|
-
tokenStart = saveTokenPos;
|
|
9881
|
+
tokenStart = saveTokenStart;
|
|
9871
9882
|
tokenFlags = saveTokenFlags;
|
|
9872
|
-
|
|
9873
|
-
|
|
9883
|
+
pos = savePos;
|
|
9884
|
+
end = saveEnd;
|
|
9874
9885
|
}
|
|
9875
9886
|
tokenValue = text.substring(tokenStart, pos);
|
|
9876
9887
|
token = 14 /* RegularExpressionLiteral */;
|
|
9877
9888
|
}
|
|
9878
9889
|
return token;
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9890
|
+
}
|
|
9891
|
+
function scanRegularExpressionWorker(regExpFlags, isUnterminated, annexB) {
|
|
9892
|
+
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
9893
|
+
var unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
|
|
9894
|
+
if (unicodeMode) {
|
|
9895
|
+
annexB = false;
|
|
9896
|
+
}
|
|
9897
|
+
var mayContainStrings = false;
|
|
9898
|
+
var numberOfCapturingGroups = 0;
|
|
9899
|
+
var groupSpecifiers;
|
|
9900
|
+
var groupNameReferences;
|
|
9901
|
+
var decimalEscapes;
|
|
9902
|
+
var namedCapturingGroupsScopeStack = [];
|
|
9903
|
+
var topNamedCapturingGroupsScope;
|
|
9904
|
+
function scanDisjunction(isInGroup) {
|
|
9905
|
+
while (true) {
|
|
9906
|
+
namedCapturingGroupsScopeStack.push(topNamedCapturingGroupsScope);
|
|
9907
|
+
topNamedCapturingGroupsScope = void 0;
|
|
9908
|
+
scanAlternative(isInGroup);
|
|
9909
|
+
topNamedCapturingGroupsScope = namedCapturingGroupsScopeStack.pop();
|
|
9910
|
+
if (charCodeChecked(pos) !== 124 /* bar */) {
|
|
9911
|
+
return;
|
|
9900
9912
|
}
|
|
9913
|
+
pos++;
|
|
9901
9914
|
}
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9915
|
+
}
|
|
9916
|
+
function scanAlternative(isInGroup) {
|
|
9917
|
+
let isPreviousTermQuantifiable = false;
|
|
9918
|
+
while (true) {
|
|
9919
|
+
const start2 = pos;
|
|
9920
|
+
const ch = charCodeChecked(pos);
|
|
9921
|
+
switch (ch) {
|
|
9922
|
+
case -1 /* EOF */:
|
|
9923
|
+
return;
|
|
9924
|
+
case 94 /* caret */:
|
|
9925
|
+
case 36 /* $ */:
|
|
9926
|
+
pos++;
|
|
9927
|
+
isPreviousTermQuantifiable = false;
|
|
9928
|
+
break;
|
|
9929
|
+
case 92 /* backslash */:
|
|
9930
|
+
pos++;
|
|
9931
|
+
switch (charCodeChecked(pos)) {
|
|
9932
|
+
case 98 /* b */:
|
|
9933
|
+
case 66 /* B */:
|
|
9934
|
+
pos++;
|
|
9935
|
+
isPreviousTermQuantifiable = false;
|
|
9936
|
+
break;
|
|
9937
|
+
default:
|
|
9938
|
+
scanAtomEscape();
|
|
9939
|
+
isPreviousTermQuantifiable = true;
|
|
9940
|
+
break;
|
|
9941
|
+
}
|
|
9942
|
+
break;
|
|
9943
|
+
case 40 /* openParen */:
|
|
9944
|
+
pos++;
|
|
9945
|
+
if (charCodeChecked(pos) === 63 /* question */) {
|
|
9914
9946
|
pos++;
|
|
9915
|
-
switch (
|
|
9916
|
-
case
|
|
9917
|
-
case
|
|
9947
|
+
switch (charCodeChecked(pos)) {
|
|
9948
|
+
case 61 /* equals */:
|
|
9949
|
+
case 33 /* exclamation */:
|
|
9918
9950
|
pos++;
|
|
9919
|
-
isPreviousTermQuantifiable =
|
|
9951
|
+
isPreviousTermQuantifiable = annexB;
|
|
9920
9952
|
break;
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
case 40 /* openParen */:
|
|
9928
|
-
pos++;
|
|
9929
|
-
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
9930
|
-
pos++;
|
|
9931
|
-
switch (text2.charCodeAt(pos)) {
|
|
9932
|
-
case 61 /* equals */:
|
|
9933
|
-
case 33 /* exclamation */:
|
|
9934
|
-
pos++;
|
|
9935
|
-
isPreviousTermQuantifiable = annexB;
|
|
9936
|
-
break;
|
|
9937
|
-
case 60 /* lessThan */:
|
|
9938
|
-
const groupNameStart = pos;
|
|
9939
|
-
pos++;
|
|
9940
|
-
switch (text2.charCodeAt(pos)) {
|
|
9941
|
-
case 61 /* equals */:
|
|
9942
|
-
case 33 /* exclamation */:
|
|
9943
|
-
pos++;
|
|
9944
|
-
isPreviousTermQuantifiable = false;
|
|
9945
|
-
break;
|
|
9946
|
-
default:
|
|
9947
|
-
scanGroupName(
|
|
9948
|
-
/*isReference*/
|
|
9949
|
-
false
|
|
9950
|
-
);
|
|
9951
|
-
scanExpectedChar(62 /* greaterThan */);
|
|
9952
|
-
if (languageVersion < 5 /* ES2018 */) {
|
|
9953
|
-
error(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
|
|
9954
|
-
}
|
|
9955
|
-
numberOfCapturingGroups++;
|
|
9956
|
-
isPreviousTermQuantifiable = true;
|
|
9957
|
-
break;
|
|
9958
|
-
}
|
|
9959
|
-
break;
|
|
9960
|
-
default:
|
|
9961
|
-
const start3 = pos;
|
|
9962
|
-
const setFlags = scanPatternModifiers(0 /* None */);
|
|
9963
|
-
if (text2.charCodeAt(pos) === 45 /* minus */) {
|
|
9953
|
+
case 60 /* lessThan */:
|
|
9954
|
+
const groupNameStart = pos;
|
|
9955
|
+
pos++;
|
|
9956
|
+
switch (charCodeChecked(pos)) {
|
|
9957
|
+
case 61 /* equals */:
|
|
9958
|
+
case 33 /* exclamation */:
|
|
9964
9959
|
pos++;
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9960
|
+
isPreviousTermQuantifiable = false;
|
|
9961
|
+
break;
|
|
9962
|
+
default:
|
|
9963
|
+
scanGroupName(
|
|
9964
|
+
/*isReference*/
|
|
9965
|
+
false
|
|
9966
|
+
);
|
|
9967
|
+
scanExpectedChar(62 /* greaterThan */);
|
|
9968
|
+
if (languageVersion < 5 /* ES2018 */) {
|
|
9969
|
+
error(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
|
|
9968
9970
|
}
|
|
9971
|
+
numberOfCapturingGroups++;
|
|
9972
|
+
isPreviousTermQuantifiable = true;
|
|
9973
|
+
break;
|
|
9974
|
+
}
|
|
9975
|
+
break;
|
|
9976
|
+
default:
|
|
9977
|
+
const start3 = pos;
|
|
9978
|
+
const setFlags = scanPatternModifiers(0 /* None */);
|
|
9979
|
+
if (charCodeChecked(pos) === 45 /* minus */) {
|
|
9980
|
+
pos++;
|
|
9981
|
+
scanPatternModifiers(setFlags);
|
|
9982
|
+
if (pos === start3 + 1) {
|
|
9983
|
+
error(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
|
|
9969
9984
|
}
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
} else {
|
|
9975
|
-
numberOfCapturingGroups++;
|
|
9976
|
-
isPreviousTermQuantifiable = true;
|
|
9985
|
+
}
|
|
9986
|
+
scanExpectedChar(58 /* colon */);
|
|
9987
|
+
isPreviousTermQuantifiable = true;
|
|
9988
|
+
break;
|
|
9977
9989
|
}
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9990
|
+
} else {
|
|
9991
|
+
numberOfCapturingGroups++;
|
|
9992
|
+
isPreviousTermQuantifiable = true;
|
|
9993
|
+
}
|
|
9994
|
+
scanDisjunction(
|
|
9995
|
+
/*isInGroup*/
|
|
9996
|
+
true
|
|
9997
|
+
);
|
|
9998
|
+
scanExpectedChar(41 /* closeParen */);
|
|
9999
|
+
break;
|
|
10000
|
+
case 123 /* openBrace */:
|
|
10001
|
+
pos++;
|
|
10002
|
+
const digitsStart = pos;
|
|
10003
|
+
scanDigits();
|
|
10004
|
+
const min2 = tokenValue;
|
|
10005
|
+
if (charCodeChecked(pos) === 44 /* comma */) {
|
|
9985
10006
|
pos++;
|
|
9986
|
-
const digitsStart = pos;
|
|
9987
10007
|
scanDigits();
|
|
9988
|
-
const
|
|
9989
|
-
if (
|
|
9990
|
-
pos
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
9996
|
-
} else {
|
|
9997
|
-
if (unicodeMode) {
|
|
9998
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9999
|
-
}
|
|
10000
|
-
isPreviousTermQuantifiable = true;
|
|
10001
|
-
break;
|
|
10008
|
+
const max = tokenValue;
|
|
10009
|
+
if (!min2) {
|
|
10010
|
+
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
10011
|
+
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
10012
|
+
} else {
|
|
10013
|
+
if (unicodeMode) {
|
|
10014
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
10002
10015
|
}
|
|
10016
|
+
isPreviousTermQuantifiable = true;
|
|
10017
|
+
break;
|
|
10003
10018
|
}
|
|
10004
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
10005
|
-
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
10006
|
-
}
|
|
10007
|
-
} else if (!min2) {
|
|
10008
|
-
if (unicodeMode) {
|
|
10009
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
10010
|
-
}
|
|
10011
|
-
isPreviousTermQuantifiable = true;
|
|
10012
|
-
break;
|
|
10013
10019
|
}
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
case 42 /* asterisk */:
|
|
10017
|
-
case 43 /* plus */:
|
|
10018
|
-
case 63 /* question */:
|
|
10019
|
-
pos++;
|
|
10020
|
-
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
10021
|
-
pos++;
|
|
10022
|
-
}
|
|
10023
|
-
if (!isPreviousTermQuantifiable) {
|
|
10024
|
-
error(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
|
|
10025
|
-
}
|
|
10026
|
-
isPreviousTermQuantifiable = false;
|
|
10027
|
-
break;
|
|
10028
|
-
case 46 /* dot */:
|
|
10029
|
-
pos++;
|
|
10030
|
-
isPreviousTermQuantifiable = true;
|
|
10031
|
-
break;
|
|
10032
|
-
case 91 /* openBracket */:
|
|
10033
|
-
pos++;
|
|
10034
|
-
if (unicodeSetsMode) {
|
|
10035
|
-
scanClassSetExpression();
|
|
10036
|
-
} else {
|
|
10037
|
-
scanClassRanges();
|
|
10020
|
+
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
10021
|
+
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
10038
10022
|
}
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
case 41 /* closeParen */:
|
|
10043
|
-
if (isInGroup) {
|
|
10044
|
-
return;
|
|
10023
|
+
} else if (!min2) {
|
|
10024
|
+
if (unicodeMode) {
|
|
10025
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
10045
10026
|
}
|
|
10046
|
-
case 93 /* closeBracket */:
|
|
10047
|
-
case 125 /* closeBrace */:
|
|
10048
|
-
if (isUnterminated && !isInGroup) {
|
|
10049
|
-
return;
|
|
10050
|
-
}
|
|
10051
|
-
if (unicodeMode || ch === 41 /* closeParen */) {
|
|
10052
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10053
|
-
}
|
|
10054
|
-
pos++;
|
|
10055
|
-
isPreviousTermQuantifiable = true;
|
|
10056
|
-
break;
|
|
10057
|
-
case 47 /* slash */:
|
|
10058
|
-
case 124 /* bar */:
|
|
10059
|
-
return;
|
|
10060
|
-
default:
|
|
10061
|
-
scanSourceCharacter();
|
|
10062
10027
|
isPreviousTermQuantifiable = true;
|
|
10063
10028
|
break;
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
if (!isIdentifierPart(ch, languageVersion)) {
|
|
10071
|
-
break;
|
|
10072
|
-
}
|
|
10073
|
-
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
10074
|
-
if (flag === void 0) {
|
|
10075
|
-
error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
|
|
10076
|
-
} else if (currFlags & flag) {
|
|
10077
|
-
error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
|
|
10078
|
-
} else if (!(flag & 28 /* Modifiers */)) {
|
|
10079
|
-
error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
|
|
10080
|
-
} else {
|
|
10081
|
-
currFlags |= flag;
|
|
10082
|
-
checkRegularExpressionFlagAvailable(flag, pos);
|
|
10083
|
-
}
|
|
10084
|
-
pos++;
|
|
10085
|
-
}
|
|
10086
|
-
return currFlags;
|
|
10087
|
-
}
|
|
10088
|
-
function scanAtomEscape() {
|
|
10089
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
10090
|
-
switch (text2.charCodeAt(pos)) {
|
|
10091
|
-
case 107 /* k */:
|
|
10029
|
+
}
|
|
10030
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
10031
|
+
pos--;
|
|
10032
|
+
case 42 /* asterisk */:
|
|
10033
|
+
case 43 /* plus */:
|
|
10034
|
+
case 63 /* question */:
|
|
10092
10035
|
pos++;
|
|
10093
|
-
if (
|
|
10036
|
+
if (charCodeChecked(pos) === 63 /* question */) {
|
|
10094
10037
|
pos++;
|
|
10095
|
-
scanGroupName(
|
|
10096
|
-
/*isReference*/
|
|
10097
|
-
true
|
|
10098
|
-
);
|
|
10099
|
-
scanExpectedChar(62 /* greaterThan */);
|
|
10100
|
-
} else if (unicodeMode) {
|
|
10101
|
-
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
10102
10038
|
}
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
if (unicodeSetsMode) {
|
|
10106
|
-
pos++;
|
|
10107
|
-
error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
10108
|
-
break;
|
|
10039
|
+
if (!isPreviousTermQuantifiable) {
|
|
10040
|
+
error(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
|
|
10109
10041
|
}
|
|
10110
|
-
|
|
10111
|
-
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
10112
|
-
/*atomEscape*/
|
|
10113
|
-
true
|
|
10114
|
-
));
|
|
10042
|
+
isPreviousTermQuantifiable = false;
|
|
10115
10043
|
break;
|
|
10116
|
-
|
|
10117
|
-
}
|
|
10118
|
-
function scanDecimalEscape() {
|
|
10119
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
10120
|
-
const ch = text2.charCodeAt(pos);
|
|
10121
|
-
if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
|
|
10122
|
-
const start2 = pos;
|
|
10123
|
-
scanDigits();
|
|
10124
|
-
decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
|
|
10125
|
-
return true;
|
|
10126
|
-
}
|
|
10127
|
-
return false;
|
|
10128
|
-
}
|
|
10129
|
-
function scanCharacterEscape(atomEscape) {
|
|
10130
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
10131
|
-
let ch = text2.charCodeAt(pos);
|
|
10132
|
-
switch (ch) {
|
|
10133
|
-
case 99 /* c */:
|
|
10044
|
+
case 46 /* dot */:
|
|
10134
10045
|
pos++;
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
pos--;
|
|
10144
|
-
return "\\";
|
|
10046
|
+
isPreviousTermQuantifiable = true;
|
|
10047
|
+
break;
|
|
10048
|
+
case 91 /* openBracket */:
|
|
10049
|
+
pos++;
|
|
10050
|
+
if (unicodeSetsMode) {
|
|
10051
|
+
scanClassSetExpression();
|
|
10052
|
+
} else {
|
|
10053
|
+
scanClassRanges();
|
|
10145
10054
|
}
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
case 47 /* slash */:
|
|
10150
|
-
case 92 /* backslash */:
|
|
10151
|
-
case 46 /* dot */:
|
|
10152
|
-
case 42 /* asterisk */:
|
|
10153
|
-
case 43 /* plus */:
|
|
10154
|
-
case 63 /* question */:
|
|
10155
|
-
case 40 /* openParen */:
|
|
10055
|
+
scanExpectedChar(93 /* closeBracket */);
|
|
10056
|
+
isPreviousTermQuantifiable = true;
|
|
10057
|
+
break;
|
|
10156
10058
|
case 41 /* closeParen */:
|
|
10157
|
-
|
|
10059
|
+
if (isInGroup) {
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
10158
10062
|
case 93 /* closeBracket */:
|
|
10159
|
-
case 123 /* openBrace */:
|
|
10160
10063
|
case 125 /* closeBrace */:
|
|
10161
|
-
|
|
10064
|
+
if (isUnterminated && !isInGroup) {
|
|
10065
|
+
return;
|
|
10066
|
+
}
|
|
10067
|
+
if (unicodeMode || ch === 41 /* closeParen */) {
|
|
10068
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10069
|
+
}
|
|
10162
10070
|
pos++;
|
|
10163
|
-
|
|
10071
|
+
isPreviousTermQuantifiable = true;
|
|
10072
|
+
break;
|
|
10073
|
+
case 47 /* slash */:
|
|
10074
|
+
case 124 /* bar */:
|
|
10075
|
+
return;
|
|
10164
10076
|
default:
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
}
|
|
10169
|
-
pos--;
|
|
10170
|
-
return scanEscapeSequence(
|
|
10171
|
-
/*shouldEmitInvalidEscapeError*/
|
|
10172
|
-
unicodeMode,
|
|
10173
|
-
/*isRegularExpression*/
|
|
10174
|
-
annexB ? "annex-b" : true
|
|
10175
|
-
);
|
|
10077
|
+
scanSourceCharacter();
|
|
10078
|
+
isPreviousTermQuantifiable = true;
|
|
10079
|
+
break;
|
|
10176
10080
|
}
|
|
10177
10081
|
}
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
if (
|
|
10183
|
-
|
|
10184
|
-
}
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
error(Diagnostics.
|
|
10082
|
+
}
|
|
10083
|
+
function scanPatternModifiers(currFlags) {
|
|
10084
|
+
while (true) {
|
|
10085
|
+
const ch = charCodeChecked(pos);
|
|
10086
|
+
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
10087
|
+
break;
|
|
10088
|
+
}
|
|
10089
|
+
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
10090
|
+
if (flag === void 0) {
|
|
10091
|
+
error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
|
|
10092
|
+
} else if (currFlags & flag) {
|
|
10093
|
+
error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
|
|
10094
|
+
} else if (!(flag & 28 /* Modifiers */)) {
|
|
10095
|
+
error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
|
|
10188
10096
|
} else {
|
|
10189
|
-
|
|
10190
|
-
|
|
10097
|
+
currFlags |= flag;
|
|
10098
|
+
checkRegularExpressionFlagAvailable(flag, pos);
|
|
10191
10099
|
}
|
|
10100
|
+
pos++;
|
|
10101
|
+
}
|
|
10102
|
+
return currFlags;
|
|
10103
|
+
}
|
|
10104
|
+
function scanAtomEscape() {
|
|
10105
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
|
|
10106
|
+
switch (charCodeChecked(pos)) {
|
|
10107
|
+
case 107 /* k */:
|
|
10108
|
+
pos++;
|
|
10109
|
+
if (charCodeChecked(pos) === 60 /* lessThan */) {
|
|
10110
|
+
pos++;
|
|
10111
|
+
scanGroupName(
|
|
10112
|
+
/*isReference*/
|
|
10113
|
+
true
|
|
10114
|
+
);
|
|
10115
|
+
scanExpectedChar(62 /* greaterThan */);
|
|
10116
|
+
} else if (unicodeMode) {
|
|
10117
|
+
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
10118
|
+
}
|
|
10119
|
+
break;
|
|
10120
|
+
case 113 /* q */:
|
|
10121
|
+
if (unicodeSetsMode) {
|
|
10122
|
+
pos++;
|
|
10123
|
+
error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
10124
|
+
break;
|
|
10125
|
+
}
|
|
10126
|
+
default:
|
|
10127
|
+
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
10128
|
+
/*atomEscape*/
|
|
10129
|
+
true
|
|
10130
|
+
));
|
|
10131
|
+
break;
|
|
10192
10132
|
}
|
|
10193
|
-
|
|
10194
|
-
|
|
10133
|
+
}
|
|
10134
|
+
function scanDecimalEscape() {
|
|
10135
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
|
|
10136
|
+
const ch = charCodeChecked(pos);
|
|
10137
|
+
if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
|
|
10138
|
+
const start2 = pos;
|
|
10139
|
+
scanDigits();
|
|
10140
|
+
decimalEscapes = append(decimalEscapes, { pos: start2, end: pos, value: +tokenValue });
|
|
10141
|
+
return true;
|
|
10195
10142
|
}
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10143
|
+
return false;
|
|
10144
|
+
}
|
|
10145
|
+
function scanCharacterEscape(atomEscape) {
|
|
10146
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
|
|
10147
|
+
let ch = charCodeChecked(pos);
|
|
10148
|
+
switch (ch) {
|
|
10149
|
+
case 99 /* c */:
|
|
10199
10150
|
pos++;
|
|
10151
|
+
ch = charCodeChecked(pos);
|
|
10152
|
+
if (isASCIILetter(ch)) {
|
|
10153
|
+
pos++;
|
|
10154
|
+
return String.fromCharCode(ch & 31);
|
|
10155
|
+
}
|
|
10156
|
+
if (unicodeMode) {
|
|
10157
|
+
error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
10158
|
+
} else if (atomEscape && annexB) {
|
|
10159
|
+
pos--;
|
|
10160
|
+
return "\\";
|
|
10161
|
+
}
|
|
10162
|
+
return String.fromCharCode(ch);
|
|
10163
|
+
case 94 /* caret */:
|
|
10164
|
+
case 36 /* $ */:
|
|
10165
|
+
case 47 /* slash */:
|
|
10166
|
+
case 92 /* backslash */:
|
|
10167
|
+
case 46 /* dot */:
|
|
10168
|
+
case 42 /* asterisk */:
|
|
10169
|
+
case 43 /* plus */:
|
|
10170
|
+
case 63 /* question */:
|
|
10171
|
+
case 40 /* openParen */:
|
|
10172
|
+
case 41 /* closeParen */:
|
|
10173
|
+
case 91 /* openBracket */:
|
|
10174
|
+
case 93 /* closeBracket */:
|
|
10175
|
+
case 123 /* openBrace */:
|
|
10176
|
+
case 125 /* closeBrace */:
|
|
10177
|
+
case 124 /* bar */:
|
|
10178
|
+
pos++;
|
|
10179
|
+
return String.fromCharCode(ch);
|
|
10180
|
+
default:
|
|
10181
|
+
if (pos >= end) {
|
|
10182
|
+
error(Diagnostics.Undetermined_character_escape, pos - 1, 1);
|
|
10183
|
+
return "\\";
|
|
10184
|
+
}
|
|
10185
|
+
pos--;
|
|
10186
|
+
return scanEscapeSequence(
|
|
10187
|
+
/*shouldEmitInvalidEscapeError*/
|
|
10188
|
+
unicodeMode,
|
|
10189
|
+
/*isRegularExpression*/
|
|
10190
|
+
annexB ? "annex-b" : true
|
|
10191
|
+
);
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
function scanGroupName(isReference) {
|
|
10195
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 60 /* lessThan */);
|
|
10196
|
+
tokenStart = pos;
|
|
10197
|
+
scanIdentifier(codePointChecked(pos), languageVersion);
|
|
10198
|
+
if (pos === tokenStart) {
|
|
10199
|
+
error(Diagnostics.Expected_a_capturing_group_name);
|
|
10200
|
+
} else if (isReference) {
|
|
10201
|
+
groupNameReferences = append(groupNameReferences, { pos: tokenStart, end: pos, name: tokenValue });
|
|
10202
|
+
} else if ((topNamedCapturingGroupsScope == null ? void 0 : topNamedCapturingGroupsScope.has(tokenValue)) || namedCapturingGroupsScopeStack.some((group2) => group2 == null ? void 0 : group2.has(tokenValue))) {
|
|
10203
|
+
error(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
|
|
10204
|
+
} else {
|
|
10205
|
+
topNamedCapturingGroupsScope ?? (topNamedCapturingGroupsScope = /* @__PURE__ */ new Set());
|
|
10206
|
+
topNamedCapturingGroupsScope.add(tokenValue);
|
|
10207
|
+
groupSpecifiers ?? (groupSpecifiers = /* @__PURE__ */ new Set());
|
|
10208
|
+
groupSpecifiers.add(tokenValue);
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
function isClassContentExit(ch) {
|
|
10212
|
+
return ch === 93 /* closeBracket */ || ch === -1 /* EOF */ || pos >= end;
|
|
10213
|
+
}
|
|
10214
|
+
function scanClassRanges() {
|
|
10215
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 91 /* openBracket */);
|
|
10216
|
+
if (charCodeChecked(pos) === 94 /* caret */) {
|
|
10217
|
+
pos++;
|
|
10218
|
+
}
|
|
10219
|
+
while (true) {
|
|
10220
|
+
const ch = charCodeChecked(pos);
|
|
10221
|
+
if (isClassContentExit(ch)) {
|
|
10222
|
+
return;
|
|
10200
10223
|
}
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10224
|
+
const minStart = pos;
|
|
10225
|
+
const minCharacter = scanClassAtom();
|
|
10226
|
+
if (charCodeChecked(pos) === 45 /* minus */) {
|
|
10227
|
+
pos++;
|
|
10228
|
+
const ch2 = charCodeChecked(pos);
|
|
10229
|
+
if (isClassContentExit(ch2)) {
|
|
10204
10230
|
return;
|
|
10205
10231
|
}
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10232
|
+
if (!minCharacter && !annexB) {
|
|
10233
|
+
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
10234
|
+
}
|
|
10235
|
+
const maxStart = pos;
|
|
10236
|
+
const maxCharacter = scanClassAtom();
|
|
10237
|
+
if (!maxCharacter && !annexB) {
|
|
10238
|
+
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
10239
|
+
continue;
|
|
10240
|
+
}
|
|
10241
|
+
if (!minCharacter) {
|
|
10242
|
+
continue;
|
|
10243
|
+
}
|
|
10244
|
+
const minCharacterValue = codePointAt(minCharacter, 0);
|
|
10245
|
+
const maxCharacterValue = codePointAt(maxCharacter, 0);
|
|
10246
|
+
if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
10247
|
+
error(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
function scanClassSetExpression() {
|
|
10253
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 91 /* openBracket */);
|
|
10254
|
+
let isCharacterComplement = false;
|
|
10255
|
+
if (charCodeChecked(pos) === 94 /* caret */) {
|
|
10256
|
+
pos++;
|
|
10257
|
+
isCharacterComplement = true;
|
|
10258
|
+
}
|
|
10259
|
+
let expressionMayContainStrings = false;
|
|
10260
|
+
let ch = charCodeChecked(pos);
|
|
10261
|
+
if (isClassContentExit(ch)) {
|
|
10262
|
+
return;
|
|
10263
|
+
}
|
|
10264
|
+
let start2 = pos;
|
|
10265
|
+
let operand;
|
|
10266
|
+
switch (text.slice(pos, pos + 2)) {
|
|
10267
|
+
case "--":
|
|
10268
|
+
case "&&":
|
|
10269
|
+
error(Diagnostics.Expected_a_class_set_operand);
|
|
10270
|
+
mayContainStrings = false;
|
|
10271
|
+
break;
|
|
10272
|
+
default:
|
|
10273
|
+
operand = scanClassSetOperand();
|
|
10274
|
+
break;
|
|
10275
|
+
}
|
|
10276
|
+
switch (charCodeChecked(pos)) {
|
|
10277
|
+
case 45 /* minus */:
|
|
10278
|
+
if (charCodeChecked(pos + 1) === 45 /* minus */) {
|
|
10279
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
10280
|
+
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
10213
10281
|
}
|
|
10214
|
-
|
|
10215
|
-
|
|
10282
|
+
expressionMayContainStrings = mayContainStrings;
|
|
10283
|
+
scanClassSetSubExpression(3 /* ClassSubtraction */);
|
|
10284
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10285
|
+
return;
|
|
10286
|
+
}
|
|
10287
|
+
break;
|
|
10288
|
+
case 38 /* ampersand */:
|
|
10289
|
+
if (charCodeChecked(pos + 1) === 38 /* ampersand */) {
|
|
10290
|
+
scanClassSetSubExpression(2 /* ClassIntersection */);
|
|
10291
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
10292
|
+
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
10216
10293
|
}
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10294
|
+
expressionMayContainStrings = mayContainStrings;
|
|
10295
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10296
|
+
return;
|
|
10297
|
+
} else {
|
|
10298
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10299
|
+
}
|
|
10300
|
+
break;
|
|
10301
|
+
default:
|
|
10302
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
10303
|
+
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
10304
|
+
}
|
|
10305
|
+
expressionMayContainStrings = mayContainStrings;
|
|
10306
|
+
break;
|
|
10307
|
+
}
|
|
10308
|
+
while (true) {
|
|
10309
|
+
ch = charCodeChecked(pos);
|
|
10310
|
+
if (ch === -1 /* EOF */) {
|
|
10311
|
+
break;
|
|
10312
|
+
}
|
|
10313
|
+
switch (ch) {
|
|
10314
|
+
case 45 /* minus */:
|
|
10315
|
+
pos++;
|
|
10316
|
+
ch = charCodeChecked(pos);
|
|
10317
|
+
if (isClassContentExit(ch)) {
|
|
10318
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10319
|
+
return;
|
|
10222
10320
|
}
|
|
10223
|
-
if (
|
|
10321
|
+
if (ch === 45 /* minus */) {
|
|
10322
|
+
pos++;
|
|
10323
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10324
|
+
start2 = pos - 2;
|
|
10325
|
+
operand = text.slice(start2, pos);
|
|
10224
10326
|
continue;
|
|
10327
|
+
} else {
|
|
10328
|
+
if (!operand) {
|
|
10329
|
+
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
|
|
10330
|
+
}
|
|
10331
|
+
const secondStart = pos;
|
|
10332
|
+
const secondOperand = scanClassSetOperand();
|
|
10333
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
10334
|
+
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
|
|
10335
|
+
}
|
|
10336
|
+
expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
|
|
10337
|
+
if (!secondOperand) {
|
|
10338
|
+
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
|
|
10339
|
+
break;
|
|
10340
|
+
}
|
|
10341
|
+
if (!operand) {
|
|
10342
|
+
break;
|
|
10343
|
+
}
|
|
10344
|
+
const minCharacterValue = codePointAt(operand, 0);
|
|
10345
|
+
const maxCharacterValue = codePointAt(secondOperand, 0);
|
|
10346
|
+
if (operand.length === charSize(minCharacterValue) && secondOperand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
10347
|
+
error(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
|
|
10348
|
+
}
|
|
10225
10349
|
}
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10350
|
+
break;
|
|
10351
|
+
case 38 /* ampersand */:
|
|
10352
|
+
start2 = pos;
|
|
10353
|
+
pos++;
|
|
10354
|
+
if (charCodeChecked(pos) === 38 /* ampersand */) {
|
|
10355
|
+
pos++;
|
|
10356
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10357
|
+
if (charCodeChecked(pos) === 38 /* ampersand */) {
|
|
10358
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10359
|
+
pos++;
|
|
10360
|
+
}
|
|
10361
|
+
} else {
|
|
10362
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
10230
10363
|
}
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
}
|
|
10234
|
-
function scanClassSetExpression() {
|
|
10235
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
|
|
10236
|
-
let isCharacterComplement = false;
|
|
10237
|
-
if (text2.charCodeAt(pos) === 94 /* caret */) {
|
|
10238
|
-
pos++;
|
|
10239
|
-
isCharacterComplement = true;
|
|
10364
|
+
operand = text.slice(start2, pos);
|
|
10365
|
+
continue;
|
|
10240
10366
|
}
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
if (isClassContentExit(ch)) {
|
|
10244
|
-
return;
|
|
10367
|
+
if (isClassContentExit(charCodeChecked(pos))) {
|
|
10368
|
+
break;
|
|
10245
10369
|
}
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
switch (text2.slice(pos, pos + 2)) {
|
|
10370
|
+
start2 = pos;
|
|
10371
|
+
switch (text.slice(pos, pos + 2)) {
|
|
10249
10372
|
case "--":
|
|
10250
10373
|
case "&&":
|
|
10251
|
-
error(Diagnostics.
|
|
10252
|
-
|
|
10374
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
10375
|
+
pos += 2;
|
|
10376
|
+
operand = text.slice(start2, pos);
|
|
10253
10377
|
break;
|
|
10254
10378
|
default:
|
|
10255
|
-
|
|
10379
|
+
operand = scanClassSetOperand();
|
|
10256
10380
|
break;
|
|
10257
10381
|
}
|
|
10258
|
-
|
|
10382
|
+
}
|
|
10383
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10384
|
+
}
|
|
10385
|
+
function scanClassSetSubExpression(expressionType) {
|
|
10386
|
+
let expressionMayContainStrings = mayContainStrings;
|
|
10387
|
+
while (true) {
|
|
10388
|
+
let ch = charCodeChecked(pos);
|
|
10389
|
+
if (isClassContentExit(ch)) {
|
|
10390
|
+
break;
|
|
10391
|
+
}
|
|
10392
|
+
switch (ch) {
|
|
10259
10393
|
case 45 /* minus */:
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10394
|
+
pos++;
|
|
10395
|
+
if (charCodeChecked(pos) === 45 /* minus */) {
|
|
10396
|
+
pos++;
|
|
10397
|
+
if (expressionType !== 3 /* ClassSubtraction */) {
|
|
10398
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10263
10399
|
}
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10267
|
-
return;
|
|
10400
|
+
} else {
|
|
10401
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
|
|
10268
10402
|
}
|
|
10269
10403
|
break;
|
|
10270
10404
|
case 38 /* ampersand */:
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10405
|
+
pos++;
|
|
10406
|
+
if (charCodeChecked(pos) === 38 /* ampersand */) {
|
|
10407
|
+
pos++;
|
|
10408
|
+
if (expressionType !== 2 /* ClassIntersection */) {
|
|
10409
|
+
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10410
|
+
}
|
|
10411
|
+
if (charCodeChecked(pos) === 38 /* ampersand */) {
|
|
10412
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10413
|
+
pos++;
|
|
10275
10414
|
}
|
|
10276
|
-
expressionMayContainStrings = mayContainStrings;
|
|
10277
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10278
|
-
return;
|
|
10279
10415
|
} else {
|
|
10280
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10416
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
10281
10417
|
}
|
|
10282
10418
|
break;
|
|
10283
10419
|
default:
|
|
10284
|
-
|
|
10285
|
-
|
|
10420
|
+
switch (expressionType) {
|
|
10421
|
+
case 3 /* ClassSubtraction */:
|
|
10422
|
+
error(Diagnostics._0_expected, pos, 0, "--");
|
|
10423
|
+
break;
|
|
10424
|
+
case 2 /* ClassIntersection */:
|
|
10425
|
+
error(Diagnostics._0_expected, pos, 0, "&&");
|
|
10426
|
+
break;
|
|
10427
|
+
default:
|
|
10428
|
+
break;
|
|
10286
10429
|
}
|
|
10287
|
-
expressionMayContainStrings = mayContainStrings;
|
|
10288
10430
|
break;
|
|
10289
10431
|
}
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
pos++;
|
|
10295
|
-
ch = text2.charCodeAt(pos);
|
|
10296
|
-
if (isClassContentExit(ch)) {
|
|
10297
|
-
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
10298
|
-
return;
|
|
10299
|
-
}
|
|
10300
|
-
if (ch === 45 /* minus */) {
|
|
10301
|
-
pos++;
|
|
10302
|
-
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10303
|
-
start2 = pos - 2;
|
|
10304
|
-
oprand = text2.slice(start2, pos);
|
|
10305
|
-
continue;
|
|
10306
|
-
} else {
|
|
10307
|
-
if (!oprand) {
|
|
10308
|
-
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
|
|
10309
|
-
}
|
|
10310
|
-
const secondStart = pos;
|
|
10311
|
-
const secondOprand = scanClassSetOprand();
|
|
10312
|
-
if (isCharacterComplement && mayContainStrings) {
|
|
10313
|
-
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
|
|
10314
|
-
}
|
|
10315
|
-
expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
|
|
10316
|
-
if (!secondOprand) {
|
|
10317
|
-
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
|
|
10318
|
-
break;
|
|
10319
|
-
}
|
|
10320
|
-
if (!oprand) {
|
|
10321
|
-
break;
|
|
10322
|
-
}
|
|
10323
|
-
const minCharacterValue = codePointAt(oprand, 0);
|
|
10324
|
-
const maxCharacterValue = codePointAt(secondOprand, 0);
|
|
10325
|
-
if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
10326
|
-
error(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
|
|
10327
|
-
}
|
|
10328
|
-
}
|
|
10329
|
-
break;
|
|
10330
|
-
case 38 /* ampersand */:
|
|
10331
|
-
start2 = pos;
|
|
10332
|
-
pos++;
|
|
10333
|
-
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
10334
|
-
pos++;
|
|
10335
|
-
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
10336
|
-
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
10337
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10338
|
-
pos++;
|
|
10339
|
-
}
|
|
10340
|
-
} else {
|
|
10341
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
10342
|
-
}
|
|
10343
|
-
oprand = text2.slice(start2, pos);
|
|
10344
|
-
continue;
|
|
10345
|
-
}
|
|
10346
|
-
if (isClassContentExit(text2.charCodeAt(pos))) {
|
|
10347
|
-
break;
|
|
10348
|
-
}
|
|
10349
|
-
start2 = pos;
|
|
10350
|
-
switch (text2.slice(pos, pos + 2)) {
|
|
10351
|
-
case "--":
|
|
10352
|
-
case "&&":
|
|
10353
|
-
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
10354
|
-
pos += 2;
|
|
10355
|
-
oprand = text2.slice(start2, pos);
|
|
10356
|
-
break;
|
|
10357
|
-
default:
|
|
10358
|
-
oprand = scanClassSetOprand();
|
|
10359
|
-
break;
|
|
10360
|
-
}
|
|
10432
|
+
ch = charCodeChecked(pos);
|
|
10433
|
+
if (isClassContentExit(ch)) {
|
|
10434
|
+
error(Diagnostics.Expected_a_class_set_operand);
|
|
10435
|
+
break;
|
|
10361
10436
|
}
|
|
10362
|
-
|
|
10437
|
+
scanClassSetOperand();
|
|
10438
|
+
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
10363
10439
|
}
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
case 38 /* ampersand */:
|
|
10440
|
+
mayContainStrings = expressionMayContainStrings;
|
|
10441
|
+
}
|
|
10442
|
+
function scanClassSetOperand() {
|
|
10443
|
+
mayContainStrings = false;
|
|
10444
|
+
switch (charCodeChecked(pos)) {
|
|
10445
|
+
case -1 /* EOF */:
|
|
10446
|
+
return "";
|
|
10447
|
+
case 91 /* openBracket */:
|
|
10448
|
+
pos++;
|
|
10449
|
+
scanClassSetExpression();
|
|
10450
|
+
scanExpectedChar(93 /* closeBracket */);
|
|
10451
|
+
return "";
|
|
10452
|
+
case 92 /* backslash */:
|
|
10453
|
+
pos++;
|
|
10454
|
+
if (scanCharacterClassEscape()) {
|
|
10455
|
+
return "";
|
|
10456
|
+
} else if (charCodeChecked(pos) === 113 /* q */) {
|
|
10457
|
+
pos++;
|
|
10458
|
+
if (charCodeChecked(pos) === 123 /* openBrace */) {
|
|
10384
10459
|
pos++;
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
pos++;
|
|
10393
|
-
}
|
|
10394
|
-
} else {
|
|
10395
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
10396
|
-
}
|
|
10397
|
-
break;
|
|
10398
|
-
default:
|
|
10399
|
-
switch (expressionType) {
|
|
10400
|
-
case 3 /* ClassSubtraction */:
|
|
10401
|
-
error(Diagnostics._0_expected, pos, 0, "--");
|
|
10402
|
-
break;
|
|
10403
|
-
case 2 /* ClassIntersection */:
|
|
10404
|
-
error(Diagnostics._0_expected, pos, 0, "&&");
|
|
10405
|
-
break;
|
|
10406
|
-
default:
|
|
10407
|
-
break;
|
|
10408
|
-
}
|
|
10409
|
-
break;
|
|
10460
|
+
scanClassStringDisjunctionContents();
|
|
10461
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
10462
|
+
return "";
|
|
10463
|
+
} else {
|
|
10464
|
+
error(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
|
|
10465
|
+
return "q";
|
|
10466
|
+
}
|
|
10410
10467
|
}
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10468
|
+
pos--;
|
|
10469
|
+
default:
|
|
10470
|
+
return scanClassSetCharacter();
|
|
10471
|
+
}
|
|
10472
|
+
}
|
|
10473
|
+
function scanClassStringDisjunctionContents() {
|
|
10474
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 123 /* openBrace */);
|
|
10475
|
+
let characterCount = 0;
|
|
10476
|
+
while (true) {
|
|
10477
|
+
const ch = charCodeChecked(pos);
|
|
10478
|
+
switch (ch) {
|
|
10479
|
+
case -1 /* EOF */:
|
|
10480
|
+
return;
|
|
10481
|
+
case 125 /* closeBrace */:
|
|
10482
|
+
if (characterCount !== 1) {
|
|
10483
|
+
mayContainStrings = true;
|
|
10484
|
+
}
|
|
10485
|
+
return;
|
|
10486
|
+
case 124 /* bar */:
|
|
10487
|
+
if (characterCount !== 1) {
|
|
10488
|
+
mayContainStrings = true;
|
|
10489
|
+
}
|
|
10490
|
+
pos++;
|
|
10491
|
+
start = pos;
|
|
10492
|
+
characterCount = 0;
|
|
10493
|
+
break;
|
|
10494
|
+
default:
|
|
10495
|
+
scanClassSetCharacter();
|
|
10496
|
+
characterCount++;
|
|
10414
10497
|
break;
|
|
10415
|
-
}
|
|
10416
|
-
scanClassSetOprand();
|
|
10417
|
-
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
10418
10498
|
}
|
|
10419
|
-
mayContainStrings = expressionMayContainStrings;
|
|
10420
10499
|
}
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10500
|
+
}
|
|
10501
|
+
function scanClassSetCharacter() {
|
|
10502
|
+
const ch = charCodeChecked(pos);
|
|
10503
|
+
if (ch === -1 /* EOF */) {
|
|
10504
|
+
return "";
|
|
10505
|
+
}
|
|
10506
|
+
if (ch === 92 /* backslash */) {
|
|
10507
|
+
pos++;
|
|
10508
|
+
const ch2 = charCodeChecked(pos);
|
|
10509
|
+
switch (ch2) {
|
|
10510
|
+
case 98 /* b */:
|
|
10425
10511
|
pos++;
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
case
|
|
10512
|
+
return "\b";
|
|
10513
|
+
case 38 /* ampersand */:
|
|
10514
|
+
case 45 /* minus */:
|
|
10515
|
+
case 33 /* exclamation */:
|
|
10516
|
+
case 35 /* hash */:
|
|
10517
|
+
case 37 /* percent */:
|
|
10518
|
+
case 44 /* comma */:
|
|
10519
|
+
case 58 /* colon */:
|
|
10520
|
+
case 59 /* semicolon */:
|
|
10521
|
+
case 60 /* lessThan */:
|
|
10522
|
+
case 61 /* equals */:
|
|
10523
|
+
case 62 /* greaterThan */:
|
|
10524
|
+
case 64 /* at */:
|
|
10525
|
+
case 96 /* backtick */:
|
|
10526
|
+
case 126 /* tilde */:
|
|
10430
10527
|
pos++;
|
|
10431
|
-
|
|
10432
|
-
return "";
|
|
10433
|
-
} else if (text2.charCodeAt(pos) === 113 /* q */) {
|
|
10434
|
-
pos++;
|
|
10435
|
-
if (text2.charCodeAt(pos) === 123 /* openBrace */) {
|
|
10436
|
-
pos++;
|
|
10437
|
-
scanClassStringDisjunctionContents();
|
|
10438
|
-
scanExpectedChar(125 /* closeBrace */);
|
|
10439
|
-
return "";
|
|
10440
|
-
} else {
|
|
10441
|
-
error(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
|
|
10442
|
-
return "q";
|
|
10443
|
-
}
|
|
10444
|
-
}
|
|
10445
|
-
pos--;
|
|
10528
|
+
return String.fromCharCode(ch2);
|
|
10446
10529
|
default:
|
|
10447
|
-
return
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10530
|
+
return scanCharacterEscape(
|
|
10531
|
+
/*atomEscape*/
|
|
10532
|
+
false
|
|
10533
|
+
);
|
|
10534
|
+
}
|
|
10535
|
+
} else if (ch === charCodeChecked(pos + 1)) {
|
|
10536
|
+
switch (ch) {
|
|
10537
|
+
case 38 /* ampersand */:
|
|
10538
|
+
case 33 /* exclamation */:
|
|
10539
|
+
case 35 /* hash */:
|
|
10540
|
+
case 37 /* percent */:
|
|
10541
|
+
case 42 /* asterisk */:
|
|
10542
|
+
case 43 /* plus */:
|
|
10543
|
+
case 44 /* comma */:
|
|
10544
|
+
case 46 /* dot */:
|
|
10545
|
+
case 58 /* colon */:
|
|
10546
|
+
case 59 /* semicolon */:
|
|
10547
|
+
case 60 /* lessThan */:
|
|
10548
|
+
case 61 /* equals */:
|
|
10549
|
+
case 62 /* greaterThan */:
|
|
10550
|
+
case 63 /* question */:
|
|
10551
|
+
case 64 /* at */:
|
|
10552
|
+
case 96 /* backtick */:
|
|
10553
|
+
case 126 /* tilde */:
|
|
10554
|
+
error(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
|
|
10555
|
+
pos += 2;
|
|
10556
|
+
return text.substring(pos - 2, pos);
|
|
10474
10557
|
}
|
|
10475
10558
|
}
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10559
|
+
switch (ch) {
|
|
10560
|
+
case 47 /* slash */:
|
|
10561
|
+
case 40 /* openParen */:
|
|
10562
|
+
case 41 /* closeParen */:
|
|
10563
|
+
case 91 /* openBracket */:
|
|
10564
|
+
case 93 /* closeBracket */:
|
|
10565
|
+
case 123 /* openBrace */:
|
|
10566
|
+
case 125 /* closeBrace */:
|
|
10567
|
+
case 45 /* minus */:
|
|
10568
|
+
case 124 /* bar */:
|
|
10569
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10479
10570
|
pos++;
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
case 35 /* hash */:
|
|
10489
|
-
case 37 /* percent */:
|
|
10490
|
-
case 44 /* comma */:
|
|
10491
|
-
case 58 /* colon */:
|
|
10492
|
-
case 59 /* semicolon */:
|
|
10493
|
-
case 60 /* lessThan */:
|
|
10494
|
-
case 61 /* equals */:
|
|
10495
|
-
case 62 /* greaterThan */:
|
|
10496
|
-
case 64 /* at */:
|
|
10497
|
-
case 96 /* backtick */:
|
|
10498
|
-
case 126 /* tilde */:
|
|
10499
|
-
pos++;
|
|
10500
|
-
return String.fromCharCode(ch2);
|
|
10501
|
-
default:
|
|
10502
|
-
return scanCharacterEscape(
|
|
10503
|
-
/*atomEscape*/
|
|
10504
|
-
false
|
|
10505
|
-
);
|
|
10506
|
-
}
|
|
10507
|
-
} else if (ch === text2.charCodeAt(pos + 1)) {
|
|
10508
|
-
switch (ch) {
|
|
10509
|
-
case 38 /* ampersand */:
|
|
10510
|
-
case 33 /* exclamation */:
|
|
10511
|
-
case 35 /* hash */:
|
|
10512
|
-
case 37 /* percent */:
|
|
10513
|
-
case 42 /* asterisk */:
|
|
10514
|
-
case 43 /* plus */:
|
|
10515
|
-
case 44 /* comma */:
|
|
10516
|
-
case 46 /* dot */:
|
|
10517
|
-
case 58 /* colon */:
|
|
10518
|
-
case 59 /* semicolon */:
|
|
10519
|
-
case 60 /* lessThan */:
|
|
10520
|
-
case 61 /* equals */:
|
|
10521
|
-
case 62 /* greaterThan */:
|
|
10522
|
-
case 63 /* question */:
|
|
10523
|
-
case 64 /* at */:
|
|
10524
|
-
case 96 /* backtick */:
|
|
10525
|
-
case 126 /* tilde */:
|
|
10526
|
-
error(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
|
|
10527
|
-
pos += 2;
|
|
10528
|
-
return text2.substring(pos - 2, pos);
|
|
10529
|
-
}
|
|
10530
|
-
}
|
|
10571
|
+
return String.fromCharCode(ch);
|
|
10572
|
+
}
|
|
10573
|
+
return scanSourceCharacter();
|
|
10574
|
+
}
|
|
10575
|
+
function scanClassAtom() {
|
|
10576
|
+
if (charCodeChecked(pos) === 92 /* backslash */) {
|
|
10577
|
+
pos++;
|
|
10578
|
+
const ch = charCodeChecked(pos);
|
|
10531
10579
|
switch (ch) {
|
|
10532
|
-
case
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
case 91 /* openBracket */:
|
|
10536
|
-
case 93 /* closeBracket */:
|
|
10537
|
-
case 123 /* openBrace */:
|
|
10538
|
-
case 125 /* closeBrace */:
|
|
10580
|
+
case 98 /* b */:
|
|
10581
|
+
pos++;
|
|
10582
|
+
return "\b";
|
|
10539
10583
|
case 45 /* minus */:
|
|
10540
|
-
case 124 /* bar */:
|
|
10541
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
10542
10584
|
pos++;
|
|
10543
10585
|
return String.fromCharCode(ch);
|
|
10586
|
+
default:
|
|
10587
|
+
if (scanCharacterClassEscape()) {
|
|
10588
|
+
return "";
|
|
10589
|
+
}
|
|
10590
|
+
return scanCharacterEscape(
|
|
10591
|
+
/*atomEscape*/
|
|
10592
|
+
false
|
|
10593
|
+
);
|
|
10544
10594
|
}
|
|
10595
|
+
} else {
|
|
10545
10596
|
return scanSourceCharacter();
|
|
10546
10597
|
}
|
|
10547
|
-
|
|
10548
|
-
|
|
10598
|
+
}
|
|
10599
|
+
function scanCharacterClassEscape() {
|
|
10600
|
+
Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
|
|
10601
|
+
let isCharacterComplement = false;
|
|
10602
|
+
const start2 = pos - 1;
|
|
10603
|
+
const ch = charCodeChecked(pos);
|
|
10604
|
+
switch (ch) {
|
|
10605
|
+
case 100 /* d */:
|
|
10606
|
+
case 68 /* D */:
|
|
10607
|
+
case 115 /* s */:
|
|
10608
|
+
case 83 /* S */:
|
|
10609
|
+
case 119 /* w */:
|
|
10610
|
+
case 87 /* W */:
|
|
10549
10611
|
pos++;
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
pos++;
|
|
10557
|
-
return String.fromCharCode(ch);
|
|
10558
|
-
default:
|
|
10559
|
-
if (scanCharacterClassEscape()) {
|
|
10560
|
-
return "";
|
|
10561
|
-
}
|
|
10562
|
-
return scanCharacterEscape(
|
|
10563
|
-
/*atomEscape*/
|
|
10564
|
-
false
|
|
10565
|
-
);
|
|
10566
|
-
}
|
|
10567
|
-
} else {
|
|
10568
|
-
return scanSourceCharacter();
|
|
10569
|
-
}
|
|
10570
|
-
}
|
|
10571
|
-
function scanCharacterClassEscape() {
|
|
10572
|
-
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
10573
|
-
let isCharacterComplement = false;
|
|
10574
|
-
const start2 = pos - 1;
|
|
10575
|
-
const ch = text2.charCodeAt(pos);
|
|
10576
|
-
switch (ch) {
|
|
10577
|
-
case 100 /* d */:
|
|
10578
|
-
case 68 /* D */:
|
|
10579
|
-
case 115 /* s */:
|
|
10580
|
-
case 83 /* S */:
|
|
10581
|
-
case 119 /* w */:
|
|
10582
|
-
case 87 /* W */:
|
|
10583
|
-
pos++;
|
|
10584
|
-
return true;
|
|
10585
|
-
case 80 /* P */:
|
|
10586
|
-
isCharacterComplement = true;
|
|
10587
|
-
case 112 /* p */:
|
|
10612
|
+
return true;
|
|
10613
|
+
case 80 /* P */:
|
|
10614
|
+
isCharacterComplement = true;
|
|
10615
|
+
case 112 /* p */:
|
|
10616
|
+
pos++;
|
|
10617
|
+
if (charCodeChecked(pos) === 123 /* openBrace */) {
|
|
10588
10618
|
pos++;
|
|
10589
|
-
|
|
10619
|
+
const propertyNameOrValueStart = pos;
|
|
10620
|
+
const propertyNameOrValue = scanWordCharacters();
|
|
10621
|
+
if (charCodeChecked(pos) === 61 /* equals */) {
|
|
10622
|
+
const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
|
|
10623
|
+
if (pos === propertyNameOrValueStart) {
|
|
10624
|
+
error(Diagnostics.Expected_a_Unicode_property_name);
|
|
10625
|
+
} else if (propertyName === void 0) {
|
|
10626
|
+
error(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
10627
|
+
const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
|
|
10628
|
+
if (suggestion) {
|
|
10629
|
+
error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
10630
|
+
}
|
|
10631
|
+
}
|
|
10590
10632
|
pos++;
|
|
10591
|
-
const
|
|
10592
|
-
const
|
|
10593
|
-
if (
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
if (suggestion) {
|
|
10601
|
-
error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
10602
|
-
}
|
|
10633
|
+
const propertyValueStart = pos;
|
|
10634
|
+
const propertyValue = scanWordCharacters();
|
|
10635
|
+
if (pos === propertyValueStart) {
|
|
10636
|
+
error(Diagnostics.Expected_a_Unicode_property_value);
|
|
10637
|
+
} else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
|
|
10638
|
+
error(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
|
|
10639
|
+
const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
|
|
10640
|
+
if (suggestion) {
|
|
10641
|
+
error(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
|
|
10603
10642
|
}
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
error(Diagnostics.
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10643
|
+
}
|
|
10644
|
+
} else {
|
|
10645
|
+
if (pos === propertyNameOrValueStart) {
|
|
10646
|
+
error(Diagnostics.Expected_a_Unicode_property_name_or_value);
|
|
10647
|
+
} else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
|
|
10648
|
+
if (!unicodeSetsMode) {
|
|
10649
|
+
error(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);
|
|
10650
|
+
} else if (isCharacterComplement) {
|
|
10651
|
+
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
10652
|
+
} else {
|
|
10653
|
+
mayContainStrings = true;
|
|
10615
10654
|
}
|
|
10616
|
-
} else {
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
error(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);
|
|
10622
|
-
} else if (isCharacterComplement) {
|
|
10623
|
-
error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
10624
|
-
} else {
|
|
10625
|
-
mayContainStrings = true;
|
|
10626
|
-
}
|
|
10627
|
-
} else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
|
|
10628
|
-
error(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
10629
|
-
const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
|
|
10630
|
-
if (suggestion) {
|
|
10631
|
-
error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
10632
|
-
}
|
|
10655
|
+
} else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
|
|
10656
|
+
error(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
10657
|
+
const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
|
|
10658
|
+
if (suggestion) {
|
|
10659
|
+
error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
10633
10660
|
}
|
|
10634
10661
|
}
|
|
10635
|
-
scanExpectedChar(125 /* closeBrace */);
|
|
10636
|
-
if (!unicodeMode) {
|
|
10637
|
-
error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
10638
|
-
}
|
|
10639
|
-
} else if (unicodeMode) {
|
|
10640
|
-
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10641
10662
|
}
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
while (pos < end2) {
|
|
10649
|
-
const ch = text2.charCodeAt(pos);
|
|
10650
|
-
if (!isWordCharacter(ch)) {
|
|
10651
|
-
break;
|
|
10663
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
10664
|
+
if (!unicodeMode) {
|
|
10665
|
+
error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
10666
|
+
}
|
|
10667
|
+
} else if (unicodeMode) {
|
|
10668
|
+
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10652
10669
|
}
|
|
10653
|
-
|
|
10654
|
-
|
|
10670
|
+
return true;
|
|
10671
|
+
}
|
|
10672
|
+
return false;
|
|
10673
|
+
}
|
|
10674
|
+
function scanWordCharacters() {
|
|
10675
|
+
let value = "";
|
|
10676
|
+
while (true) {
|
|
10677
|
+
const ch = charCodeChecked(pos);
|
|
10678
|
+
if (ch === -1 /* EOF */ || !isWordCharacter(ch)) {
|
|
10679
|
+
break;
|
|
10655
10680
|
}
|
|
10656
|
-
|
|
10681
|
+
value += String.fromCharCode(ch);
|
|
10682
|
+
pos++;
|
|
10657
10683
|
}
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10684
|
+
return value;
|
|
10685
|
+
}
|
|
10686
|
+
function scanSourceCharacter() {
|
|
10687
|
+
const size = unicodeMode ? charSize(charCodeChecked(pos)) : 1;
|
|
10688
|
+
pos += size;
|
|
10689
|
+
return size > 0 ? text.substring(pos - size, pos) : "";
|
|
10690
|
+
}
|
|
10691
|
+
function scanExpectedChar(ch) {
|
|
10692
|
+
if (charCodeChecked(pos) === ch) {
|
|
10693
|
+
pos++;
|
|
10694
|
+
} else {
|
|
10695
|
+
error(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
|
|
10662
10696
|
}
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10697
|
+
}
|
|
10698
|
+
scanDisjunction(
|
|
10699
|
+
/*isInGroup*/
|
|
10700
|
+
false
|
|
10701
|
+
);
|
|
10702
|
+
forEach(groupNameReferences, (reference) => {
|
|
10703
|
+
if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
|
|
10704
|
+
error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
|
|
10705
|
+
}
|
|
10706
|
+
});
|
|
10707
|
+
forEach(decimalEscapes, (escape) => {
|
|
10708
|
+
if (!annexB && escape.value > numberOfCapturingGroups) {
|
|
10709
|
+
if (numberOfCapturingGroups) {
|
|
10710
|
+
error(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);
|
|
10666
10711
|
} else {
|
|
10667
|
-
error(Diagnostics.
|
|
10712
|
+
error(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
|
|
10668
10713
|
}
|
|
10669
10714
|
}
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
|
|
10677
|
-
}
|
|
10678
|
-
});
|
|
10679
|
-
forEach(decimalEscapes, (escape) => {
|
|
10680
|
-
if (!annexB && escape.value > numberOfCapturingGroups) {
|
|
10681
|
-
if (numberOfCapturingGroups) {
|
|
10682
|
-
error(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);
|
|
10683
|
-
} else {
|
|
10684
|
-
error(Diagnostics.This_backreference_is_invalid_because_the_containing_regular_expression_contains_no_capturing_groups, escape.pos, escape.end - escape.pos);
|
|
10685
|
-
}
|
|
10686
|
-
}
|
|
10687
|
-
});
|
|
10688
|
-
}
|
|
10689
|
-
function checkRegularExpressionFlagAvailable(flag, pos2) {
|
|
10690
|
-
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
10691
|
-
if (availableFrom && languageVersion < availableFrom) {
|
|
10692
|
-
error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
|
|
10693
|
-
}
|
|
10715
|
+
});
|
|
10716
|
+
}
|
|
10717
|
+
function checkRegularExpressionFlagAvailable(flag, pos2) {
|
|
10718
|
+
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
10719
|
+
if (availableFrom && languageVersion < availableFrom) {
|
|
10720
|
+
error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
|
|
10694
10721
|
}
|
|
10695
10722
|
}
|
|
10696
10723
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
@@ -10758,9 +10785,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10758
10785
|
if (pos >= end) {
|
|
10759
10786
|
return token = 1 /* EndOfFileToken */;
|
|
10760
10787
|
}
|
|
10761
|
-
let char =
|
|
10788
|
+
let char = charCodeUnchecked(pos);
|
|
10762
10789
|
if (char === 60 /* lessThan */) {
|
|
10763
|
-
if (
|
|
10790
|
+
if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
|
|
10764
10791
|
pos += 2;
|
|
10765
10792
|
return token = 31 /* LessThanSlashToken */;
|
|
10766
10793
|
}
|
|
@@ -10773,7 +10800,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10773
10800
|
}
|
|
10774
10801
|
let firstNonWhitespace = 0;
|
|
10775
10802
|
while (pos < end) {
|
|
10776
|
-
char =
|
|
10803
|
+
char = charCodeUnchecked(pos);
|
|
10777
10804
|
if (char === 123 /* openBrace */) {
|
|
10778
10805
|
break;
|
|
10779
10806
|
}
|
|
@@ -10805,7 +10832,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10805
10832
|
function scanJsxIdentifier() {
|
|
10806
10833
|
if (tokenIsIdentifierOrKeyword(token)) {
|
|
10807
10834
|
while (pos < end) {
|
|
10808
|
-
const ch =
|
|
10835
|
+
const ch = charCodeUnchecked(pos);
|
|
10809
10836
|
if (ch === 45 /* minus */) {
|
|
10810
10837
|
tokenValue += "-";
|
|
10811
10838
|
pos++;
|
|
@@ -10823,7 +10850,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10823
10850
|
}
|
|
10824
10851
|
function scanJsxAttributeValue() {
|
|
10825
10852
|
fullStartPos = pos;
|
|
10826
|
-
switch (
|
|
10853
|
+
switch (charCodeUnchecked(pos)) {
|
|
10827
10854
|
case 34 /* doubleQuote */:
|
|
10828
10855
|
case 39 /* singleQuote */:
|
|
10829
10856
|
tokenValue = scanString(
|
|
@@ -10845,11 +10872,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10845
10872
|
if (pos >= end) {
|
|
10846
10873
|
return token = 1 /* EndOfFileToken */;
|
|
10847
10874
|
}
|
|
10848
|
-
for (let ch =
|
|
10875
|
+
for (let ch = charCodeUnchecked(pos); pos < end && (!isLineBreak(ch) && ch !== 96 /* backtick */); ch = codePointUnchecked(++pos)) {
|
|
10849
10876
|
if (!inBackticks) {
|
|
10850
10877
|
if (ch === 123 /* openBrace */) {
|
|
10851
10878
|
break;
|
|
10852
|
-
} else if (ch === 64 /* at */ && pos - 1 >= 0 && isWhiteSpaceSingleLine(
|
|
10879
|
+
} else if (ch === 64 /* at */ && pos - 1 >= 0 && isWhiteSpaceSingleLine(charCodeUnchecked(pos - 1)) && !(pos + 1 < end && isWhiteSpaceLike(charCodeUnchecked(pos + 1)))) {
|
|
10853
10880
|
break;
|
|
10854
10881
|
}
|
|
10855
10882
|
}
|
|
@@ -10866,21 +10893,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10866
10893
|
if (pos >= end) {
|
|
10867
10894
|
return token = 1 /* EndOfFileToken */;
|
|
10868
10895
|
}
|
|
10869
|
-
const ch =
|
|
10896
|
+
const ch = codePointUnchecked(pos);
|
|
10870
10897
|
pos += charSize(ch);
|
|
10871
10898
|
switch (ch) {
|
|
10872
10899
|
case 9 /* tab */:
|
|
10873
10900
|
case 11 /* verticalTab */:
|
|
10874
10901
|
case 12 /* formFeed */:
|
|
10875
10902
|
case 32 /* space */:
|
|
10876
|
-
while (pos < end && isWhiteSpaceSingleLine(
|
|
10903
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
10877
10904
|
pos++;
|
|
10878
10905
|
}
|
|
10879
10906
|
return token = 5 /* WhitespaceTrivia */;
|
|
10880
10907
|
case 64 /* at */:
|
|
10881
10908
|
return token = 60 /* AtToken */;
|
|
10882
10909
|
case 13 /* carriageReturn */:
|
|
10883
|
-
if (
|
|
10910
|
+
if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
10884
10911
|
pos++;
|
|
10885
10912
|
}
|
|
10886
10913
|
case 10 /* lineFeed */:
|
|
@@ -10936,7 +10963,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10936
10963
|
}
|
|
10937
10964
|
if (isIdentifierStart(ch, languageVersion)) {
|
|
10938
10965
|
let char = ch;
|
|
10939
|
-
while (pos < end && isIdentifierPart(char =
|
|
10966
|
+
while (pos < end && isIdentifierPart(char = codePointUnchecked(pos), languageVersion) || char === 45 /* minus */)
|
|
10940
10967
|
pos += charSize(char);
|
|
10941
10968
|
tokenValue = text.substring(tokenStart, pos);
|
|
10942
10969
|
if (char === 92 /* backslash */) {
|
|
@@ -11046,6 +11073,9 @@ function charSize(ch) {
|
|
|
11046
11073
|
if (ch >= 65536) {
|
|
11047
11074
|
return 2;
|
|
11048
11075
|
}
|
|
11076
|
+
if (ch === -1 /* EOF */) {
|
|
11077
|
+
return 0;
|
|
11078
|
+
}
|
|
11049
11079
|
return 1;
|
|
11050
11080
|
}
|
|
11051
11081
|
function utf16EncodeAsStringFallback(codePoint) {
|
|
@@ -12623,35 +12653,6 @@ function packageIdToString(packageId) {
|
|
|
12623
12653
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
12624
12654
|
return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
12625
12655
|
}
|
|
12626
|
-
function fileIncludeReasonIsEqual(a, b) {
|
|
12627
|
-
if (a === b)
|
|
12628
|
-
return true;
|
|
12629
|
-
if (a.kind !== b.kind)
|
|
12630
|
-
return false;
|
|
12631
|
-
switch (a.kind) {
|
|
12632
|
-
case 0 /* RootFile */:
|
|
12633
|
-
Debug.type(b);
|
|
12634
|
-
return a.index === b.index;
|
|
12635
|
-
case 6 /* LibFile */:
|
|
12636
|
-
Debug.type(b);
|
|
12637
|
-
return a.index === b.index;
|
|
12638
|
-
case 1 /* SourceFromProjectReference */:
|
|
12639
|
-
case 2 /* OutputFromProjectReference */:
|
|
12640
|
-
Debug.type(b);
|
|
12641
|
-
return a.index === b.index;
|
|
12642
|
-
case 3 /* Import */:
|
|
12643
|
-
case 4 /* ReferenceFile */:
|
|
12644
|
-
case 5 /* TypeReferenceDirective */:
|
|
12645
|
-
case 7 /* LibReferenceDirective */:
|
|
12646
|
-
Debug.type(b);
|
|
12647
|
-
return a.file === b.file && a.index === b.index;
|
|
12648
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
|
12649
|
-
Debug.type(b);
|
|
12650
|
-
return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
|
|
12651
|
-
default:
|
|
12652
|
-
return Debug.assertNever(a);
|
|
12653
|
-
}
|
|
12654
|
-
}
|
|
12655
12656
|
function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
|
|
12656
12657
|
Debug.assert(names.length === newResolutions.length);
|
|
12657
12658
|
for (let i = 0; i < names.length; i++) {
|
|
@@ -13565,7 +13566,8 @@ function createFileDiagnosticFromMessageChain(file, start, length2, messageChain
|
|
|
13565
13566
|
code: messageChain.code,
|
|
13566
13567
|
category: messageChain.category,
|
|
13567
13568
|
messageText: messageChain.next ? messageChain : messageChain.messageText,
|
|
13568
|
-
relatedInformation
|
|
13569
|
+
relatedInformation,
|
|
13570
|
+
canonicalHead: messageChain.canonicalHead
|
|
13569
13571
|
};
|
|
13570
13572
|
}
|
|
13571
13573
|
function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
|
|
@@ -13597,6 +13599,12 @@ function createDiagnosticForRange(sourceFile, range, message) {
|
|
|
13597
13599
|
messageText: message.message
|
|
13598
13600
|
};
|
|
13599
13601
|
}
|
|
13602
|
+
function getCanonicalDiagnostic(message, ...args) {
|
|
13603
|
+
return {
|
|
13604
|
+
code: message.code,
|
|
13605
|
+
messageText: formatMessage(message, ...args)
|
|
13606
|
+
};
|
|
13607
|
+
}
|
|
13600
13608
|
function getSpanOfTokenAtPosition(sourceFile, pos) {
|
|
13601
13609
|
const scanner = createScanner(
|
|
13602
13610
|
sourceFile.languageVersion,
|
|
@@ -17409,7 +17417,9 @@ function compareDiagnostics(d1, d2) {
|
|
|
17409
17417
|
return compareDiagnosticsSkipRelatedInformation(d1, d2) || compareRelatedInformation(d1, d2) || 0 /* EqualTo */;
|
|
17410
17418
|
}
|
|
17411
17419
|
function compareDiagnosticsSkipRelatedInformation(d1, d2) {
|
|
17412
|
-
|
|
17420
|
+
const code1 = getDiagnosticCode(d1);
|
|
17421
|
+
const code2 = getDiagnosticCode(d2);
|
|
17422
|
+
return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(code1, code2) || compareMessageText(d1, d2) || 0 /* EqualTo */;
|
|
17413
17423
|
}
|
|
17414
17424
|
function compareRelatedInformation(d1, d2) {
|
|
17415
17425
|
if (!d1.relatedInformation && !d2.relatedInformation) {
|
|
@@ -17423,21 +17433,32 @@ function compareRelatedInformation(d1, d2) {
|
|
|
17423
17433
|
}
|
|
17424
17434
|
return d1.relatedInformation ? -1 /* LessThan */ : 1 /* GreaterThan */;
|
|
17425
17435
|
}
|
|
17426
|
-
function compareMessageText(
|
|
17427
|
-
|
|
17428
|
-
|
|
17436
|
+
function compareMessageText(d1, d2) {
|
|
17437
|
+
let headMsg1 = getDiagnosticMessage(d1);
|
|
17438
|
+
let headMsg2 = getDiagnosticMessage(d2);
|
|
17439
|
+
if (typeof headMsg1 !== "string") {
|
|
17440
|
+
headMsg1 = headMsg1.messageText;
|
|
17429
17441
|
}
|
|
17430
|
-
if (typeof
|
|
17431
|
-
|
|
17442
|
+
if (typeof headMsg2 !== "string") {
|
|
17443
|
+
headMsg2 = headMsg2.messageText;
|
|
17432
17444
|
}
|
|
17433
|
-
|
|
17434
|
-
|
|
17445
|
+
const chain1 = typeof d1.messageText !== "string" ? d1.messageText.next : void 0;
|
|
17446
|
+
const chain2 = typeof d2.messageText !== "string" ? d2.messageText.next : void 0;
|
|
17447
|
+
let res = compareStringsCaseSensitive(headMsg1, headMsg2);
|
|
17448
|
+
if (res) {
|
|
17449
|
+
return res;
|
|
17435
17450
|
}
|
|
17436
|
-
|
|
17451
|
+
res = compareMessageChain(chain1, chain2);
|
|
17437
17452
|
if (res) {
|
|
17438
17453
|
return res;
|
|
17439
17454
|
}
|
|
17440
|
-
|
|
17455
|
+
if (d1.canonicalHead && !d2.canonicalHead) {
|
|
17456
|
+
return -1 /* LessThan */;
|
|
17457
|
+
}
|
|
17458
|
+
if (d2.canonicalHead && !d1.canonicalHead) {
|
|
17459
|
+
return 1 /* GreaterThan */;
|
|
17460
|
+
}
|
|
17461
|
+
return 0 /* EqualTo */;
|
|
17441
17462
|
}
|
|
17442
17463
|
function compareMessageChain(c1, c2) {
|
|
17443
17464
|
if (c1 === void 0 && c2 === void 0) {
|
|
@@ -17491,7 +17512,19 @@ function compareMessageChainContent(c1, c2) {
|
|
|
17491
17512
|
return 0 /* EqualTo */;
|
|
17492
17513
|
}
|
|
17493
17514
|
function diagnosticsEqualityComparer(d1, d2) {
|
|
17494
|
-
|
|
17515
|
+
const code1 = getDiagnosticCode(d1);
|
|
17516
|
+
const code2 = getDiagnosticCode(d2);
|
|
17517
|
+
const msg1 = getDiagnosticMessage(d1);
|
|
17518
|
+
const msg2 = getDiagnosticMessage(d2);
|
|
17519
|
+
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);
|
|
17520
|
+
}
|
|
17521
|
+
function getDiagnosticCode(d) {
|
|
17522
|
+
var _a;
|
|
17523
|
+
return ((_a = d.canonicalHead) == null ? void 0 : _a.code) || d.code;
|
|
17524
|
+
}
|
|
17525
|
+
function getDiagnosticMessage(d) {
|
|
17526
|
+
var _a;
|
|
17527
|
+
return ((_a = d.canonicalHead) == null ? void 0 : _a.messageText) || d.messageText;
|
|
17495
17528
|
}
|
|
17496
17529
|
function messageTextEqualityComparer(m1, m2) {
|
|
17497
17530
|
const t1 = typeof m1 === "string" ? m1 : m1.messageText;
|
|
@@ -45748,6 +45781,14 @@ function createTypeChecker(host) {
|
|
|
45748
45781
|
return void 0;
|
|
45749
45782
|
return type;
|
|
45750
45783
|
},
|
|
45784
|
+
createTypeReference: (target, typeArguments) => {
|
|
45785
|
+
if (target !== emptyGenericType && getObjectFlags(target) & 3 /* ClassOrInterface */) {
|
|
45786
|
+
const interfaceType = target;
|
|
45787
|
+
if (some(interfaceType.typeParameters)) {
|
|
45788
|
+
return createTypeReference(interfaceType, typeArguments);
|
|
45789
|
+
}
|
|
45790
|
+
}
|
|
45791
|
+
},
|
|
45751
45792
|
isSymbolAccessible,
|
|
45752
45793
|
isArrayType,
|
|
45753
45794
|
isTupleType,
|
|
@@ -46218,7 +46259,6 @@ function createTypeChecker(host) {
|
|
|
46218
46259
|
};
|
|
46219
46260
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
|
46220
46261
|
var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
|
|
46221
|
-
var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
|
|
46222
46262
|
var asyncIterationTypesResolver = {
|
|
46223
46263
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
|
46224
46264
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
|
@@ -47025,6 +47065,7 @@ function createTypeChecker(host) {
|
|
|
47025
47065
|
);
|
|
47026
47066
|
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;
|
|
47027
47067
|
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
47068
|
+
diagnostic.canonicalHead = getCanonicalDiagnostic(nameNotFoundMessage, diagnosticName(nameArg));
|
|
47028
47069
|
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
47029
47070
|
if (suggestion.valueDeclaration) {
|
|
47030
47071
|
addRelatedInfo(
|
|
@@ -48096,12 +48137,6 @@ function createTypeChecker(host) {
|
|
|
48096
48137
|
}
|
|
48097
48138
|
}
|
|
48098
48139
|
}
|
|
48099
|
-
function markConstEnumAliasAsReferenced(symbol) {
|
|
48100
|
-
const links = getSymbolLinks(symbol);
|
|
48101
|
-
if (!links.constEnumReferenced) {
|
|
48102
|
-
links.constEnumReferenced = true;
|
|
48103
|
-
}
|
|
48104
|
-
}
|
|
48105
48140
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
48106
48141
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
48107
48142
|
entityName = entityName.parent;
|
|
@@ -50362,7 +50397,36 @@ function createTypeChecker(host) {
|
|
|
50362
50397
|
}
|
|
50363
50398
|
let typeArgumentNodes;
|
|
50364
50399
|
if (typeArguments.length > 0) {
|
|
50365
|
-
|
|
50400
|
+
let typeParameterCount;
|
|
50401
|
+
if (type2.target.typeParameters) {
|
|
50402
|
+
typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
|
|
50403
|
+
if (isReferenceToType(type2, getGlobalIterableType(
|
|
50404
|
+
/*reportErrors*/
|
|
50405
|
+
false
|
|
50406
|
+
)) || isReferenceToType(type2, getGlobalIterableIteratorType(
|
|
50407
|
+
/*reportErrors*/
|
|
50408
|
+
false
|
|
50409
|
+
)) || isReferenceToType(type2, getGlobalAsyncIterableType(
|
|
50410
|
+
/*reportErrors*/
|
|
50411
|
+
false
|
|
50412
|
+
)) || isReferenceToType(type2, getGlobalAsyncIterableIteratorType(
|
|
50413
|
+
/*reportErrors*/
|
|
50414
|
+
false
|
|
50415
|
+
))) {
|
|
50416
|
+
if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
|
|
50417
|
+
while (typeParameterCount > 0) {
|
|
50418
|
+
const typeArgument = typeArguments[typeParameterCount - 1];
|
|
50419
|
+
const defaultType = getDefaultFromTypeParameter(type2.target.typeParameters[typeParameterCount - 1]);
|
|
50420
|
+
if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
|
|
50421
|
+
break;
|
|
50422
|
+
}
|
|
50423
|
+
typeParameterCount--;
|
|
50424
|
+
}
|
|
50425
|
+
}
|
|
50426
|
+
}
|
|
50427
|
+
} else {
|
|
50428
|
+
typeParameterCount = 0;
|
|
50429
|
+
}
|
|
50366
50430
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50367
50431
|
}
|
|
50368
50432
|
const flags = context.flags;
|
|
@@ -54803,7 +54867,7 @@ function createTypeChecker(host) {
|
|
|
54803
54867
|
}
|
|
54804
54868
|
type = anyType;
|
|
54805
54869
|
}
|
|
54806
|
-
links.type = type;
|
|
54870
|
+
links.type ?? (links.type = type);
|
|
54807
54871
|
}
|
|
54808
54872
|
return links.type;
|
|
54809
54873
|
}
|
|
@@ -54821,7 +54885,7 @@ function createTypeChecker(host) {
|
|
|
54821
54885
|
}
|
|
54822
54886
|
writeType = anyType;
|
|
54823
54887
|
}
|
|
54824
|
-
links.writeType = writeType || getTypeOfAccessors(symbol);
|
|
54888
|
+
links.writeType ?? (links.writeType = writeType || getTypeOfAccessors(symbol));
|
|
54825
54889
|
}
|
|
54826
54890
|
return links.writeType;
|
|
54827
54891
|
}
|
|
@@ -54898,10 +54962,10 @@ function createTypeChecker(host) {
|
|
|
54898
54962
|
true
|
|
54899
54963
|
);
|
|
54900
54964
|
const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
|
|
54901
|
-
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;
|
|
54965
|
+
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);
|
|
54902
54966
|
if (!popTypeResolution()) {
|
|
54903
54967
|
reportCircularityError(exportSymbol ?? symbol);
|
|
54904
|
-
return links.type = errorType;
|
|
54968
|
+
return links.type ?? (links.type = errorType);
|
|
54905
54969
|
}
|
|
54906
54970
|
}
|
|
54907
54971
|
return links.type;
|
|
@@ -55167,7 +55231,7 @@ function createTypeChecker(host) {
|
|
|
55167
55231
|
}
|
|
55168
55232
|
if (!popTypeResolution()) {
|
|
55169
55233
|
error(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
55170
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
55234
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
55171
55235
|
}
|
|
55172
55236
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
55173
55237
|
const err = error(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
@@ -55184,9 +55248,9 @@ function createTypeChecker(host) {
|
|
|
55184
55248
|
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)));
|
|
55185
55249
|
}
|
|
55186
55250
|
}
|
|
55187
|
-
return type.resolvedBaseConstructorType = errorType;
|
|
55251
|
+
return type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = errorType);
|
|
55188
55252
|
}
|
|
55189
|
-
type.resolvedBaseConstructorType = baseConstructorType;
|
|
55253
|
+
type.resolvedBaseConstructorType ?? (type.resolvedBaseConstructorType = baseConstructorType);
|
|
55190
55254
|
}
|
|
55191
55255
|
return type.resolvedBaseConstructorType;
|
|
55192
55256
|
}
|
|
@@ -55427,7 +55491,7 @@ function createTypeChecker(host) {
|
|
|
55427
55491
|
error(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
55428
55492
|
}
|
|
55429
55493
|
}
|
|
55430
|
-
links.declaredType = type;
|
|
55494
|
+
links.declaredType ?? (links.declaredType = type);
|
|
55431
55495
|
}
|
|
55432
55496
|
return links.declaredType;
|
|
55433
55497
|
}
|
|
@@ -56545,6 +56609,7 @@ function createTypeChecker(host) {
|
|
|
56545
56609
|
}
|
|
56546
56610
|
}
|
|
56547
56611
|
function getTypeOfMappedSymbol(symbol) {
|
|
56612
|
+
var _a;
|
|
56548
56613
|
if (!symbol.links.type) {
|
|
56549
56614
|
const mappedType = symbol.links.mappedType;
|
|
56550
56615
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -56563,7 +56628,7 @@ function createTypeChecker(host) {
|
|
|
56563
56628
|
error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
56564
56629
|
type = errorType;
|
|
56565
56630
|
}
|
|
56566
|
-
symbol.links.type = type;
|
|
56631
|
+
(_a = symbol.links).type ?? (_a.type = type);
|
|
56567
56632
|
}
|
|
56568
56633
|
return symbol.links.type;
|
|
56569
56634
|
}
|
|
@@ -56916,7 +56981,7 @@ function createTypeChecker(host) {
|
|
|
56916
56981
|
}
|
|
56917
56982
|
result = circularConstraintType;
|
|
56918
56983
|
}
|
|
56919
|
-
t.immediateBaseConstraint = result || noConstraintType;
|
|
56984
|
+
t.immediateBaseConstraint ?? (t.immediateBaseConstraint = result || noConstraintType);
|
|
56920
56985
|
}
|
|
56921
56986
|
return t.immediateBaseConstraint;
|
|
56922
56987
|
}
|
|
@@ -57790,7 +57855,7 @@ function createTypeChecker(host) {
|
|
|
57790
57855
|
}
|
|
57791
57856
|
type = anyType;
|
|
57792
57857
|
}
|
|
57793
|
-
signature.resolvedReturnType = type;
|
|
57858
|
+
signature.resolvedReturnType ?? (signature.resolvedReturnType = type);
|
|
57794
57859
|
}
|
|
57795
57860
|
return signature.resolvedReturnType;
|
|
57796
57861
|
}
|
|
@@ -58136,9 +58201,9 @@ function createTypeChecker(host) {
|
|
|
58136
58201
|
const node = type.node;
|
|
58137
58202
|
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
|
|
58138
58203
|
if (popTypeResolution()) {
|
|
58139
|
-
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
58204
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
|
|
58140
58205
|
} else {
|
|
58141
|
-
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
58206
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
|
|
58142
58207
|
error(
|
|
58143
58208
|
type.node || currentNode,
|
|
58144
58209
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
@@ -58691,7 +58756,7 @@ function createTypeChecker(host) {
|
|
|
58691
58756
|
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
|
|
58692
58757
|
"AsyncIterable",
|
|
58693
58758
|
/*arity*/
|
|
58694
|
-
|
|
58759
|
+
3,
|
|
58695
58760
|
reportErrors2
|
|
58696
58761
|
)) || emptyGenericType;
|
|
58697
58762
|
}
|
|
@@ -58707,7 +58772,7 @@ function createTypeChecker(host) {
|
|
|
58707
58772
|
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
|
|
58708
58773
|
"AsyncIterableIterator",
|
|
58709
58774
|
/*arity*/
|
|
58710
|
-
|
|
58775
|
+
3,
|
|
58711
58776
|
reportErrors2
|
|
58712
58777
|
)) || emptyGenericType;
|
|
58713
58778
|
}
|
|
@@ -58723,7 +58788,7 @@ function createTypeChecker(host) {
|
|
|
58723
58788
|
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
|
|
58724
58789
|
"Iterable",
|
|
58725
58790
|
/*arity*/
|
|
58726
|
-
|
|
58791
|
+
3,
|
|
58727
58792
|
reportErrors2
|
|
58728
58793
|
)) || emptyGenericType;
|
|
58729
58794
|
}
|
|
@@ -58739,7 +58804,7 @@ function createTypeChecker(host) {
|
|
|
58739
58804
|
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
|
|
58740
58805
|
"IterableIterator",
|
|
58741
58806
|
/*arity*/
|
|
58742
|
-
|
|
58807
|
+
3,
|
|
58743
58808
|
reportErrors2
|
|
58744
58809
|
)) || emptyGenericType;
|
|
58745
58810
|
}
|
|
@@ -58921,7 +58986,7 @@ function createTypeChecker(host) {
|
|
|
58921
58986
|
return createTypeFromGenericGlobalType(getGlobalIterableType(
|
|
58922
58987
|
/*reportErrors*/
|
|
58923
58988
|
true
|
|
58924
|
-
), [iteratedType]);
|
|
58989
|
+
), [iteratedType, voidType, undefinedType]);
|
|
58925
58990
|
}
|
|
58926
58991
|
function createArrayType(elementType, readonly) {
|
|
58927
58992
|
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
|
@@ -63197,6 +63262,16 @@ function createTypeChecker(host) {
|
|
|
63197
63262
|
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
63198
63263
|
}
|
|
63199
63264
|
if (!headMessage2 && maybeSuppress) {
|
|
63265
|
+
const savedErrorState = captureErrorCalculationState();
|
|
63266
|
+
reportRelationError(headMessage2, source2, target2);
|
|
63267
|
+
let canonical;
|
|
63268
|
+
if (errorInfo && errorInfo !== savedErrorState.errorInfo) {
|
|
63269
|
+
canonical = { code: errorInfo.code, messageText: errorInfo.messageText };
|
|
63270
|
+
}
|
|
63271
|
+
resetErrorInfo(savedErrorState);
|
|
63272
|
+
if (canonical && errorInfo) {
|
|
63273
|
+
errorInfo.canonicalHead = canonical;
|
|
63274
|
+
}
|
|
63200
63275
|
lastSkippedInfo = [source2, target2];
|
|
63201
63276
|
return;
|
|
63202
63277
|
}
|
|
@@ -65185,6 +65260,7 @@ function createTypeChecker(host) {
|
|
|
65185
65260
|
if (!links.variances) {
|
|
65186
65261
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
65187
65262
|
const oldVarianceComputation = inVarianceComputation;
|
|
65263
|
+
const saveResolutionStart = resolutionStart;
|
|
65188
65264
|
if (!inVarianceComputation) {
|
|
65189
65265
|
inVarianceComputation = true;
|
|
65190
65266
|
resolutionStart = resolutionTargets.length;
|
|
@@ -65219,7 +65295,7 @@ function createTypeChecker(host) {
|
|
|
65219
65295
|
}
|
|
65220
65296
|
if (!oldVarianceComputation) {
|
|
65221
65297
|
inVarianceComputation = false;
|
|
65222
|
-
resolutionStart =
|
|
65298
|
+
resolutionStart = saveResolutionStart;
|
|
65223
65299
|
}
|
|
65224
65300
|
links.variances = variances;
|
|
65225
65301
|
(_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
|
|
@@ -69412,7 +69488,7 @@ function createTypeChecker(host) {
|
|
|
69412
69488
|
reportCircularityError(declaration.symbol);
|
|
69413
69489
|
return true;
|
|
69414
69490
|
}
|
|
69415
|
-
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
69491
|
+
links.parameterInitializerContainsUndefined ?? (links.parameterInitializerContainsUndefined = containsUndefined);
|
|
69416
69492
|
}
|
|
69417
69493
|
return links.parameterInitializerContainsUndefined;
|
|
69418
69494
|
}
|
|
@@ -69474,8 +69550,6 @@ function createTypeChecker(host) {
|
|
|
69474
69550
|
) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
69475
69551
|
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
|
|
69476
69552
|
markAliasSymbolAsReferenced(symbol);
|
|
69477
|
-
} else {
|
|
69478
|
-
markConstEnumAliasAsReferenced(symbol);
|
|
69479
69553
|
}
|
|
69480
69554
|
}
|
|
69481
69555
|
}
|
|
@@ -71219,7 +71293,7 @@ function createTypeChecker(host) {
|
|
|
71219
71293
|
}
|
|
71220
71294
|
function checkGrammarRegularExpressionLiteral(node) {
|
|
71221
71295
|
const sourceFile = getSourceFileOfNode(node);
|
|
71222
|
-
if (!hasParseDiagnostics(sourceFile)) {
|
|
71296
|
+
if (!hasParseDiagnostics(sourceFile) && !node.isUnterminated) {
|
|
71223
71297
|
let lastError;
|
|
71224
71298
|
scanner ?? (scanner = createScanner(
|
|
71225
71299
|
99 /* ESNext */,
|
|
@@ -74821,8 +74895,13 @@ function createTypeChecker(host) {
|
|
|
74821
74895
|
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
|
74822
74896
|
return cached;
|
|
74823
74897
|
}
|
|
74898
|
+
const saveResolutionStart = resolutionStart;
|
|
74899
|
+
if (!cached) {
|
|
74900
|
+
resolutionStart = resolutionTargets.length;
|
|
74901
|
+
}
|
|
74824
74902
|
links.resolvedSignature = resolvingSignature;
|
|
74825
74903
|
let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
|
|
74904
|
+
resolutionStart = saveResolutionStart;
|
|
74826
74905
|
if (result !== resolvingSignature) {
|
|
74827
74906
|
if (links.resolvedSignature !== resolvingSignature) {
|
|
74828
74907
|
result = links.resolvedSignature;
|
|
@@ -76134,24 +76213,14 @@ function createTypeChecker(host) {
|
|
|
76134
76213
|
void 0
|
|
76135
76214
|
) || unknownType;
|
|
76136
76215
|
if (globalGeneratorType === emptyGenericType) {
|
|
76137
|
-
const
|
|
76216
|
+
const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
|
|
76138
76217
|
/*reportErrors*/
|
|
76139
76218
|
false
|
|
76140
76219
|
);
|
|
76141
|
-
|
|
76142
|
-
|
|
76143
|
-
const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
|
|
76144
|
-
if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
|
|
76145
|
-
if (globalType !== emptyGenericType) {
|
|
76146
|
-
return createTypeFromGenericGlobalType(globalType, [yieldType]);
|
|
76147
|
-
}
|
|
76148
|
-
resolver.getGlobalIterableIteratorType(
|
|
76149
|
-
/*reportErrors*/
|
|
76150
|
-
true
|
|
76151
|
-
);
|
|
76152
|
-
return emptyObjectType;
|
|
76220
|
+
if (globalIterableIteratorType !== emptyGenericType) {
|
|
76221
|
+
return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
|
|
76153
76222
|
}
|
|
76154
|
-
resolver.
|
|
76223
|
+
resolver.getGlobalIterableIteratorType(
|
|
76155
76224
|
/*reportErrors*/
|
|
76156
76225
|
true
|
|
76157
76226
|
);
|
|
@@ -81287,41 +81356,14 @@ function createTypeChecker(host) {
|
|
|
81287
81356
|
function getIterationTypesOfIterableCached(type, resolver) {
|
|
81288
81357
|
return getCachedIterationTypes(type, resolver.iterableCacheKey);
|
|
81289
81358
|
}
|
|
81290
|
-
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
81291
|
-
const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
|
|
81292
|
-
globalType,
|
|
81293
|
-
resolver,
|
|
81294
|
-
/*errorNode*/
|
|
81295
|
-
void 0,
|
|
81296
|
-
/*errorOutputContainer*/
|
|
81297
|
-
void 0,
|
|
81298
|
-
/*noCache*/
|
|
81299
|
-
false
|
|
81300
|
-
);
|
|
81301
|
-
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81302
|
-
}
|
|
81303
81359
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
81304
|
-
|
|
81305
|
-
if (isReferenceToType(type, globalType = resolver.getGlobalIterableType(
|
|
81360
|
+
if (isReferenceToType(type, resolver.getGlobalIterableType(
|
|
81306
81361
|
/*reportErrors*/
|
|
81307
81362
|
false
|
|
81308
|
-
)) || isReferenceToType(type,
|
|
81363
|
+
)) || isReferenceToType(type, resolver.getGlobalIterableIteratorType(
|
|
81309
81364
|
/*reportErrors*/
|
|
81310
81365
|
false
|
|
81311
|
-
))
|
|
81312
|
-
const [yieldType] = getTypeArguments(type);
|
|
81313
|
-
const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
|
|
81314
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
|
|
81315
|
-
yieldType,
|
|
81316
|
-
/*errorNode*/
|
|
81317
|
-
void 0
|
|
81318
|
-
) || yieldType, resolver.resolveIterationType(
|
|
81319
|
-
returnType,
|
|
81320
|
-
/*errorNode*/
|
|
81321
|
-
void 0
|
|
81322
|
-
) || returnType, nextType));
|
|
81323
|
-
}
|
|
81324
|
-
if (isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
81366
|
+
)) || isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
81325
81367
|
/*reportErrors*/
|
|
81326
81368
|
false
|
|
81327
81369
|
))) {
|
|
@@ -81366,10 +81408,10 @@ function createTypeChecker(host) {
|
|
|
81366
81408
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
81367
81409
|
/*reportErrors*/
|
|
81368
81410
|
false
|
|
81369
|
-
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
81411
|
+
) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
|
|
81370
81412
|
/*reportErrors*/
|
|
81371
81413
|
false
|
|
81372
|
-
))
|
|
81414
|
+
), [anyType, anyType, anyType]))
|
|
81373
81415
|
);
|
|
81374
81416
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
81375
81417
|
}
|
|
@@ -81399,26 +81441,10 @@ function createTypeChecker(host) {
|
|
|
81399
81441
|
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
|
|
81400
81442
|
}
|
|
81401
81443
|
function getIterationTypesOfIteratorFast(type, resolver) {
|
|
81402
|
-
|
|
81444
|
+
if (isReferenceToType(type, resolver.getGlobalIterableIteratorType(
|
|
81403
81445
|
/*reportErrors*/
|
|
81404
81446
|
false
|
|
81405
|
-
)
|
|
81406
|
-
if (isReferenceToType(type, globalType)) {
|
|
81407
|
-
const [yieldType] = getTypeArguments(type);
|
|
81408
|
-
const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
|
|
81409
|
-
globalType,
|
|
81410
|
-
resolver,
|
|
81411
|
-
/*errorNode*/
|
|
81412
|
-
void 0,
|
|
81413
|
-
/*errorOutputContainer*/
|
|
81414
|
-
void 0,
|
|
81415
|
-
/*noCache*/
|
|
81416
|
-
false
|
|
81417
|
-
);
|
|
81418
|
-
const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81419
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
81420
|
-
}
|
|
81421
|
-
if (isReferenceToType(type, resolver.getGlobalIteratorType(
|
|
81447
|
+
)) || isReferenceToType(type, resolver.getGlobalIteratorType(
|
|
81422
81448
|
/*reportErrors*/
|
|
81423
81449
|
false
|
|
81424
81450
|
)) || isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
@@ -120811,12 +120837,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120811
120837
|
return file;
|
|
120812
120838
|
}
|
|
120813
120839
|
function addFileIncludeReason(file, reason) {
|
|
120814
|
-
if (file)
|
|
120815
|
-
const existing = fileReasons.get(file.path);
|
|
120816
|
-
if (some(existing, (r) => fileIncludeReasonIsEqual(r, reason)))
|
|
120817
|
-
return;
|
|
120840
|
+
if (file)
|
|
120818
120841
|
fileReasons.add(file.path, reason);
|
|
120819
|
-
}
|
|
120820
120842
|
}
|
|
120821
120843
|
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
120822
120844
|
if (redirectedPath) {
|