@typescript-deploys/pr-build 5.7.0-pr-59767-2 → 5.7.0-pr-59860-2
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/cs/diagnosticMessages.generated.json +4 -0
- package/lib/de/diagnosticMessages.generated.json +4 -0
- package/lib/es/diagnosticMessages.generated.json +4 -0
- package/lib/fr/diagnosticMessages.generated.json +4 -0
- package/lib/it/diagnosticMessages.generated.json +4 -0
- package/lib/ja/diagnosticMessages.generated.json +4 -0
- package/lib/ko/diagnosticMessages.generated.json +4 -0
- package/lib/lib.esnext.array.d.ts +1 -1
- package/lib/pl/diagnosticMessages.generated.json +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +4 -0
- package/lib/ru/diagnosticMessages.generated.json +4 -0
- package/lib/tr/diagnosticMessages.generated.json +4 -0
- package/lib/tsc.js +484 -186
- package/lib/typescript.d.ts +9 -5
- package/lib/typescript.js +640 -195
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -0
- package/package.json +16 -16
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.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240904`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -426,7 +426,10 @@ function deduplicateSorted(array, comparer) {
|
|
|
426
426
|
for (let i = 1; i < array.length; i++) {
|
|
427
427
|
const next = array[i];
|
|
428
428
|
switch (comparer(next, last2)) {
|
|
429
|
+
// equality comparison
|
|
429
430
|
case true:
|
|
431
|
+
// relational comparison
|
|
432
|
+
// falls through
|
|
430
433
|
case 0 /* EqualTo */:
|
|
431
434
|
continue;
|
|
432
435
|
case -1 /* LessThan */:
|
|
@@ -1079,7 +1082,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
|
|
|
1079
1082
|
for (let i = 0; i < values.length; i++) {
|
|
1080
1083
|
const v = values[i];
|
|
1081
1084
|
const pattern = getPattern(v);
|
|
1082
|
-
if (
|
|
1085
|
+
if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
|
|
1083
1086
|
longestMatchPrefixLength = pattern.prefix.length;
|
|
1084
1087
|
matchedValue = v;
|
|
1085
1088
|
}
|
|
@@ -3285,10 +3288,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
|
|
|
3285
3288
|
SyntaxKind4[SyntaxKind4["JSDocImportTag"] = 351] = "JSDocImportTag";
|
|
3286
3289
|
SyntaxKind4[SyntaxKind4["SyntaxList"] = 352] = "SyntaxList";
|
|
3287
3290
|
SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 353] = "NotEmittedStatement";
|
|
3288
|
-
SyntaxKind4[SyntaxKind4["
|
|
3289
|
-
SyntaxKind4[SyntaxKind4["
|
|
3290
|
-
SyntaxKind4[SyntaxKind4["
|
|
3291
|
-
SyntaxKind4[SyntaxKind4["
|
|
3291
|
+
SyntaxKind4[SyntaxKind4["NotEmittedTypeElement"] = 354] = "NotEmittedTypeElement";
|
|
3292
|
+
SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 355] = "PartiallyEmittedExpression";
|
|
3293
|
+
SyntaxKind4[SyntaxKind4["CommaListExpression"] = 356] = "CommaListExpression";
|
|
3294
|
+
SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression";
|
|
3295
|
+
SyntaxKind4[SyntaxKind4["Count"] = 358] = "Count";
|
|
3292
3296
|
SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
|
|
3293
3297
|
SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
|
|
3294
3298
|
SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
|
|
@@ -4609,6 +4613,7 @@ function createSystemWatchFunctions({
|
|
|
4609
4613
|
return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
|
|
4610
4614
|
case "UseFsEventsOnParentDirectory":
|
|
4611
4615
|
useNonPollingWatchers2 = true;
|
|
4616
|
+
// fall through
|
|
4612
4617
|
default:
|
|
4613
4618
|
return useNonPollingWatchers2 ? (
|
|
4614
4619
|
// Use notifications from FS to watch with falling back to fs.watchFile
|
|
@@ -7269,7 +7274,6 @@ var Diagnostics = {
|
|
|
7269
7274
|
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
7270
7275
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
|
|
7271
7276
|
Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
|
|
7272
|
-
Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
|
|
7273
7277
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
7274
7278
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
7275
7279
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -8136,6 +8140,7 @@ function computeLineStarts(text) {
|
|
|
8136
8140
|
if (text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
8137
8141
|
pos++;
|
|
8138
8142
|
}
|
|
8143
|
+
// falls through
|
|
8139
8144
|
case 10 /* lineFeed */:
|
|
8140
8145
|
result.push(lineStart);
|
|
8141
8146
|
lineStart = pos;
|
|
@@ -8240,6 +8245,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
|
|
|
8240
8245
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
8241
8246
|
pos++;
|
|
8242
8247
|
}
|
|
8248
|
+
// falls through
|
|
8243
8249
|
case 10 /* lineFeed */:
|
|
8244
8250
|
pos++;
|
|
8245
8251
|
if (stopAfterLineBreak) {
|
|
@@ -8386,6 +8392,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
|
|
|
8386
8392
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
8387
8393
|
pos++;
|
|
8388
8394
|
}
|
|
8395
|
+
// falls through
|
|
8389
8396
|
case 10 /* lineFeed */:
|
|
8390
8397
|
pos++;
|
|
8391
8398
|
if (trailing) {
|
|
@@ -8951,12 +8958,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8951
8958
|
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
8952
8959
|
return "\0";
|
|
8953
8960
|
}
|
|
8961
|
+
// '\01', '\011'
|
|
8962
|
+
// falls through
|
|
8954
8963
|
case 49 /* _1 */:
|
|
8955
8964
|
case 50 /* _2 */:
|
|
8956
8965
|
case 51 /* _3 */:
|
|
8957
8966
|
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
8958
8967
|
pos++;
|
|
8959
8968
|
}
|
|
8969
|
+
// '\17', '\177'
|
|
8970
|
+
// falls through
|
|
8960
8971
|
case 52 /* _4 */:
|
|
8961
8972
|
case 53 /* _5 */:
|
|
8962
8973
|
case 54 /* _6 */:
|
|
@@ -9054,10 +9065,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9054
9065
|
}
|
|
9055
9066
|
tokenFlags |= 4096 /* HexEscape */;
|
|
9056
9067
|
return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
|
|
9068
|
+
// when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
|
|
9069
|
+
// the line terminator is interpreted to be "the empty code unit sequence".
|
|
9057
9070
|
case 13 /* carriageReturn */:
|
|
9058
9071
|
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
9059
9072
|
pos++;
|
|
9060
9073
|
}
|
|
9074
|
+
// falls through
|
|
9061
9075
|
case 10 /* lineFeed */:
|
|
9062
9076
|
case 8232 /* lineSeparator */:
|
|
9063
9077
|
case 8233 /* paragraphSeparator */:
|
|
@@ -9488,6 +9502,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9488
9502
|
tokenFlags |= 256 /* OctalSpecifier */;
|
|
9489
9503
|
return token = checkBigIntSuffix();
|
|
9490
9504
|
}
|
|
9505
|
+
// falls through
|
|
9491
9506
|
case 49 /* _1 */:
|
|
9492
9507
|
case 50 /* _2 */:
|
|
9493
9508
|
case 51 /* _3 */:
|
|
@@ -10007,6 +10022,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10007
10022
|
break;
|
|
10008
10023
|
}
|
|
10009
10024
|
}
|
|
10025
|
+
// falls through
|
|
10010
10026
|
case 42 /* asterisk */:
|
|
10011
10027
|
case 43 /* plus */:
|
|
10012
10028
|
case 63 /* question */:
|
|
@@ -10037,6 +10053,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10037
10053
|
if (isInGroup) {
|
|
10038
10054
|
return;
|
|
10039
10055
|
}
|
|
10056
|
+
// falls through
|
|
10040
10057
|
case 93 /* closeBracket */:
|
|
10041
10058
|
case 125 /* closeBrace */:
|
|
10042
10059
|
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
@@ -10099,6 +10116,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10099
10116
|
error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
10100
10117
|
break;
|
|
10101
10118
|
}
|
|
10119
|
+
// falls through
|
|
10102
10120
|
default:
|
|
10103
10121
|
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
10104
10122
|
/*atomEscape*/
|
|
@@ -10236,6 +10254,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10236
10254
|
let start2 = pos;
|
|
10237
10255
|
let operand;
|
|
10238
10256
|
switch (text.slice(pos, pos + 2)) {
|
|
10257
|
+
// TODO: don't use slice
|
|
10239
10258
|
case "--":
|
|
10240
10259
|
case "&&":
|
|
10241
10260
|
error(Diagnostics.Expected_a_class_set_operand);
|
|
@@ -10341,6 +10360,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10341
10360
|
}
|
|
10342
10361
|
start2 = pos;
|
|
10343
10362
|
switch (text.slice(pos, pos + 2)) {
|
|
10363
|
+
// TODO: don't use slice
|
|
10344
10364
|
case "--":
|
|
10345
10365
|
case "&&":
|
|
10346
10366
|
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
@@ -10438,6 +10458,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10438
10458
|
}
|
|
10439
10459
|
}
|
|
10440
10460
|
pos--;
|
|
10461
|
+
// falls through
|
|
10441
10462
|
default:
|
|
10442
10463
|
return scanClassSetCharacter();
|
|
10443
10464
|
}
|
|
@@ -10584,6 +10605,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10584
10605
|
return true;
|
|
10585
10606
|
case 80 /* P */:
|
|
10586
10607
|
isCharacterComplement = true;
|
|
10608
|
+
// falls through
|
|
10587
10609
|
case 112 /* p */:
|
|
10588
10610
|
pos++;
|
|
10589
10611
|
if (charCodeChecked(pos) === 123 /* openBrace */) {
|
|
@@ -10891,6 +10913,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10891
10913
|
if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
10892
10914
|
pos++;
|
|
10893
10915
|
}
|
|
10916
|
+
// falls through
|
|
10894
10917
|
case 10 /* lineFeed */:
|
|
10895
10918
|
tokenFlags |= 1 /* PrecedingLineBreak */;
|
|
10896
10919
|
return token = 4 /* NewLineTrivia */;
|
|
@@ -11095,28 +11118,33 @@ function isExternalModuleNameRelative(moduleName) {
|
|
|
11095
11118
|
function sortAndDeduplicateDiagnostics(diagnostics) {
|
|
11096
11119
|
return sortAndDeduplicate(diagnostics, compareDiagnostics, diagnosticsEqualityComparer);
|
|
11097
11120
|
}
|
|
11121
|
+
var targetToLibMap = /* @__PURE__ */ new Map([
|
|
11122
|
+
[99 /* ESNext */, "lib.esnext.full.d.ts"],
|
|
11123
|
+
[10 /* ES2023 */, "lib.es2023.full.d.ts"],
|
|
11124
|
+
[9 /* ES2022 */, "lib.es2022.full.d.ts"],
|
|
11125
|
+
[8 /* ES2021 */, "lib.es2021.full.d.ts"],
|
|
11126
|
+
[7 /* ES2020 */, "lib.es2020.full.d.ts"],
|
|
11127
|
+
[6 /* ES2019 */, "lib.es2019.full.d.ts"],
|
|
11128
|
+
[5 /* ES2018 */, "lib.es2018.full.d.ts"],
|
|
11129
|
+
[4 /* ES2017 */, "lib.es2017.full.d.ts"],
|
|
11130
|
+
[3 /* ES2016 */, "lib.es2016.full.d.ts"],
|
|
11131
|
+
[2 /* ES2015 */, "lib.es6.d.ts"]
|
|
11132
|
+
// We don't use lib.es2015.full.d.ts due to breaking change.
|
|
11133
|
+
]);
|
|
11098
11134
|
function getDefaultLibFileName(options) {
|
|
11099
|
-
|
|
11135
|
+
const target = getEmitScriptTarget(options);
|
|
11136
|
+
switch (target) {
|
|
11100
11137
|
case 99 /* ESNext */:
|
|
11101
|
-
return "lib.esnext.full.d.ts";
|
|
11102
11138
|
case 10 /* ES2023 */:
|
|
11103
|
-
return "lib.es2023.full.d.ts";
|
|
11104
11139
|
case 9 /* ES2022 */:
|
|
11105
|
-
return "lib.es2022.full.d.ts";
|
|
11106
11140
|
case 8 /* ES2021 */:
|
|
11107
|
-
return "lib.es2021.full.d.ts";
|
|
11108
11141
|
case 7 /* ES2020 */:
|
|
11109
|
-
return "lib.es2020.full.d.ts";
|
|
11110
11142
|
case 6 /* ES2019 */:
|
|
11111
|
-
return "lib.es2019.full.d.ts";
|
|
11112
11143
|
case 5 /* ES2018 */:
|
|
11113
|
-
return "lib.es2018.full.d.ts";
|
|
11114
11144
|
case 4 /* ES2017 */:
|
|
11115
|
-
return "lib.es2017.full.d.ts";
|
|
11116
11145
|
case 3 /* ES2016 */:
|
|
11117
|
-
return "lib.es2016.full.d.ts";
|
|
11118
11146
|
case 2 /* ES2015 */:
|
|
11119
|
-
return
|
|
11147
|
+
return targetToLibMap.get(target);
|
|
11120
11148
|
default:
|
|
11121
11149
|
return "lib.d.ts";
|
|
11122
11150
|
}
|
|
@@ -11916,7 +11944,7 @@ function isModifierLike(node) {
|
|
|
11916
11944
|
}
|
|
11917
11945
|
function isTypeElement(node) {
|
|
11918
11946
|
const kind = node.kind;
|
|
11919
|
-
return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */;
|
|
11947
|
+
return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 354 /* NotEmittedTypeElement */;
|
|
11920
11948
|
}
|
|
11921
11949
|
function isObjectLiteralElementLike(node) {
|
|
11922
11950
|
const kind = node.kind;
|
|
@@ -11975,7 +12003,9 @@ function isObjectBindingOrAssignmentElement(node) {
|
|
|
11975
12003
|
switch (node.kind) {
|
|
11976
12004
|
case 208 /* BindingElement */:
|
|
11977
12005
|
case 303 /* PropertyAssignment */:
|
|
12006
|
+
// AssignmentProperty
|
|
11978
12007
|
case 304 /* ShorthandPropertyAssignment */:
|
|
12008
|
+
// AssignmentProperty
|
|
11979
12009
|
case 305 /* SpreadAssignment */:
|
|
11980
12010
|
return true;
|
|
11981
12011
|
}
|
|
@@ -11993,11 +12023,17 @@ function isArrayBindingOrAssignmentElement(node) {
|
|
|
11993
12023
|
switch (node.kind) {
|
|
11994
12024
|
case 208 /* BindingElement */:
|
|
11995
12025
|
case 232 /* OmittedExpression */:
|
|
12026
|
+
// Elision
|
|
11996
12027
|
case 230 /* SpreadElement */:
|
|
12028
|
+
// AssignmentRestElement
|
|
11997
12029
|
case 209 /* ArrayLiteralExpression */:
|
|
12030
|
+
// ArrayAssignmentPattern
|
|
11998
12031
|
case 210 /* ObjectLiteralExpression */:
|
|
12032
|
+
// ObjectAssignmentPattern
|
|
11999
12033
|
case 80 /* Identifier */:
|
|
12034
|
+
// DestructuringAssignmentTarget
|
|
12000
12035
|
case 211 /* PropertyAccessExpression */:
|
|
12036
|
+
// DestructuringAssignmentTarget
|
|
12001
12037
|
case 212 /* ElementAccessExpression */:
|
|
12002
12038
|
return true;
|
|
12003
12039
|
}
|
|
@@ -12058,6 +12094,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
12058
12094
|
case 218 /* FunctionExpression */:
|
|
12059
12095
|
case 80 /* Identifier */:
|
|
12060
12096
|
case 81 /* PrivateIdentifier */:
|
|
12097
|
+
// technically this is only an Expression if it's in a `#field in expr` BinaryExpression
|
|
12061
12098
|
case 14 /* RegularExpressionLiteral */:
|
|
12062
12099
|
case 9 /* NumericLiteral */:
|
|
12063
12100
|
case 10 /* BigIntLiteral */:
|
|
@@ -12073,6 +12110,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
12073
12110
|
case 233 /* ExpressionWithTypeArguments */:
|
|
12074
12111
|
case 236 /* MetaProperty */:
|
|
12075
12112
|
case 102 /* ImportKeyword */:
|
|
12113
|
+
// technically this is only an Expression if it's in a CallExpression
|
|
12076
12114
|
case 282 /* MissingDeclaration */:
|
|
12077
12115
|
return true;
|
|
12078
12116
|
default:
|
|
@@ -12119,8 +12157,8 @@ function isExpressionKind(kind) {
|
|
|
12119
12157
|
case 230 /* SpreadElement */:
|
|
12120
12158
|
case 234 /* AsExpression */:
|
|
12121
12159
|
case 232 /* OmittedExpression */:
|
|
12122
|
-
case
|
|
12123
|
-
case
|
|
12160
|
+
case 356 /* CommaListExpression */:
|
|
12161
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
12124
12162
|
case 238 /* SatisfiesExpression */:
|
|
12125
12163
|
return true;
|
|
12126
12164
|
default:
|
|
@@ -13739,6 +13777,8 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
13739
13777
|
}
|
|
13740
13778
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
13741
13779
|
}
|
|
13780
|
+
// This list is a work in progress. Add missing node kinds to improve their error
|
|
13781
|
+
// spans.
|
|
13742
13782
|
case 260 /* VariableDeclaration */:
|
|
13743
13783
|
case 208 /* BindingElement */:
|
|
13744
13784
|
case 263 /* ClassDeclaration */:
|
|
@@ -13910,6 +13950,8 @@ function isPartOfTypeNode(node) {
|
|
|
13910
13950
|
return isPartOfTypeExpressionWithTypeArguments(node);
|
|
13911
13951
|
case 168 /* TypeParameter */:
|
|
13912
13952
|
return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
|
|
13953
|
+
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
13954
|
+
// above them to find the lowest container
|
|
13913
13955
|
case 80 /* Identifier */:
|
|
13914
13956
|
if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
|
|
13915
13957
|
node = node.parent;
|
|
@@ -13917,6 +13959,7 @@ function isPartOfTypeNode(node) {
|
|
|
13917
13959
|
node = node.parent;
|
|
13918
13960
|
}
|
|
13919
13961
|
Debug.assert(node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
|
|
13962
|
+
// falls through
|
|
13920
13963
|
case 166 /* QualifiedName */:
|
|
13921
13964
|
case 211 /* PropertyAccessExpression */:
|
|
13922
13965
|
case 110 /* ThisKeyword */: {
|
|
@@ -14182,6 +14225,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
14182
14225
|
if (!includeArrowFunctions) {
|
|
14183
14226
|
continue;
|
|
14184
14227
|
}
|
|
14228
|
+
// falls through
|
|
14185
14229
|
case 262 /* FunctionDeclaration */:
|
|
14186
14230
|
case 218 /* FunctionExpression */:
|
|
14187
14231
|
case 267 /* ModuleDeclaration */:
|
|
@@ -14204,6 +14248,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
14204
14248
|
}
|
|
14205
14249
|
function isThisContainerOrFunctionBlock(node) {
|
|
14206
14250
|
switch (node.kind) {
|
|
14251
|
+
// Arrow functions use the same scope, but may do so in a "delayed" manner
|
|
14252
|
+
// For example, `const getThis = () => this` may be before a super() call in a derived constructor
|
|
14207
14253
|
case 219 /* ArrowFunction */:
|
|
14208
14254
|
case 262 /* FunctionDeclaration */:
|
|
14209
14255
|
case 218 /* FunctionExpression */:
|
|
@@ -14270,6 +14316,7 @@ function getSuperContainer(node, stopOnFunctions) {
|
|
|
14270
14316
|
if (!stopOnFunctions) {
|
|
14271
14317
|
continue;
|
|
14272
14318
|
}
|
|
14319
|
+
// falls through
|
|
14273
14320
|
case 172 /* PropertyDeclaration */:
|
|
14274
14321
|
case 171 /* PropertySignature */:
|
|
14275
14322
|
case 174 /* MethodDeclaration */:
|
|
@@ -14323,6 +14370,7 @@ function getEntityNameFromTypeNode(node) {
|
|
|
14323
14370
|
return node.typeName;
|
|
14324
14371
|
case 233 /* ExpressionWithTypeArguments */:
|
|
14325
14372
|
return isEntityNameExpression(node.expression) ? node.expression : void 0;
|
|
14373
|
+
// TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s.
|
|
14326
14374
|
case 80 /* Identifier */:
|
|
14327
14375
|
case 166 /* QualifiedName */:
|
|
14328
14376
|
return node;
|
|
@@ -14487,6 +14535,7 @@ function isExpressionNode(node) {
|
|
|
14487
14535
|
if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
|
|
14488
14536
|
return true;
|
|
14489
14537
|
}
|
|
14538
|
+
// falls through
|
|
14490
14539
|
case 9 /* NumericLiteral */:
|
|
14491
14540
|
case 10 /* BigIntLiteral */:
|
|
14492
14541
|
case 11 /* StringLiteral */:
|
|
@@ -15491,6 +15540,7 @@ function getFunctionFlags(node) {
|
|
|
15491
15540
|
if (node.asteriskToken) {
|
|
15492
15541
|
flags |= 1 /* Generator */;
|
|
15493
15542
|
}
|
|
15543
|
+
// falls through
|
|
15494
15544
|
case 219 /* ArrowFunction */:
|
|
15495
15545
|
if (hasSyntacticModifier(node, 1024 /* Async */)) {
|
|
15496
15546
|
flags |= 2 /* Async */;
|
|
@@ -15725,7 +15775,7 @@ function getOperator(expression) {
|
|
|
15725
15775
|
}
|
|
15726
15776
|
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
15727
15777
|
switch (nodeKind) {
|
|
15728
|
-
case
|
|
15778
|
+
case 356 /* CommaListExpression */:
|
|
15729
15779
|
return 0 /* Comma */;
|
|
15730
15780
|
case 230 /* SpreadElement */:
|
|
15731
15781
|
return 1 /* Spread */;
|
|
@@ -15757,6 +15807,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
|
15757
15807
|
default:
|
|
15758
15808
|
return getBinaryOperatorPrecedence(operatorKind);
|
|
15759
15809
|
}
|
|
15810
|
+
// TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
|
|
15760
15811
|
case 216 /* TypeAssertionExpression */:
|
|
15761
15812
|
case 235 /* NonNullExpression */:
|
|
15762
15813
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -17255,11 +17306,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
|
17255
17306
|
if (stopAtCallExpressions) {
|
|
17256
17307
|
return node;
|
|
17257
17308
|
}
|
|
17309
|
+
// falls through
|
|
17258
17310
|
case 234 /* AsExpression */:
|
|
17259
17311
|
case 212 /* ElementAccessExpression */:
|
|
17260
17312
|
case 211 /* PropertyAccessExpression */:
|
|
17261
17313
|
case 235 /* NonNullExpression */:
|
|
17262
|
-
case
|
|
17314
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
17263
17315
|
case 238 /* SatisfiesExpression */:
|
|
17264
17316
|
node = node.expression;
|
|
17265
17317
|
continue;
|
|
@@ -17646,12 +17698,6 @@ function createComputedCompilerOptions(options) {
|
|
|
17646
17698
|
return options;
|
|
17647
17699
|
}
|
|
17648
17700
|
var computedOptions = createComputedCompilerOptions({
|
|
17649
|
-
allowImportingTsExtensions: {
|
|
17650
|
-
dependencies: ["rewriteRelativeImportExtensions"],
|
|
17651
|
-
computeValue: (compilerOptions) => {
|
|
17652
|
-
return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
|
|
17653
|
-
}
|
|
17654
|
-
},
|
|
17655
17701
|
target: {
|
|
17656
17702
|
dependencies: ["module"],
|
|
17657
17703
|
computeValue: (compilerOptions) => {
|
|
@@ -17865,7 +17911,6 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
17865
17911
|
}
|
|
17866
17912
|
}
|
|
17867
17913
|
});
|
|
17868
|
-
var getAllowImportingTsExtensions = computedOptions.allowImportingTsExtensions.computeValue;
|
|
17869
17914
|
var getEmitScriptTarget = computedOptions.target.computeValue;
|
|
17870
17915
|
var getEmitModuleKind = computedOptions.module.computeValue;
|
|
17871
17916
|
var getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
|
|
@@ -18406,8 +18451,33 @@ function tryParsePattern(pattern) {
|
|
|
18406
18451
|
suffix: pattern.substr(indexOfStar + 1)
|
|
18407
18452
|
};
|
|
18408
18453
|
}
|
|
18454
|
+
var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
|
|
18409
18455
|
function tryParsePatterns(paths) {
|
|
18410
|
-
|
|
18456
|
+
let result = parsedPatternsCache.get(paths);
|
|
18457
|
+
if (result !== void 0) {
|
|
18458
|
+
return result;
|
|
18459
|
+
}
|
|
18460
|
+
let matchableStringSet;
|
|
18461
|
+
let patterns;
|
|
18462
|
+
const pathList = getOwnKeys(paths);
|
|
18463
|
+
for (const path of pathList) {
|
|
18464
|
+
const patternOrStr = tryParsePattern(path);
|
|
18465
|
+
if (patternOrStr === void 0) {
|
|
18466
|
+
continue;
|
|
18467
|
+
} else if (typeof patternOrStr === "string") {
|
|
18468
|
+
(matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
|
|
18469
|
+
} else {
|
|
18470
|
+
(patterns ?? (patterns = [])).push(patternOrStr);
|
|
18471
|
+
}
|
|
18472
|
+
}
|
|
18473
|
+
parsedPatternsCache.set(
|
|
18474
|
+
paths,
|
|
18475
|
+
result = {
|
|
18476
|
+
matchableStringSet,
|
|
18477
|
+
patterns
|
|
18478
|
+
}
|
|
18479
|
+
);
|
|
18480
|
+
return result;
|
|
18411
18481
|
}
|
|
18412
18482
|
function positionIsSynthesized(pos) {
|
|
18413
18483
|
return !(pos >= 0);
|
|
@@ -18432,15 +18502,13 @@ var emptyFileSystemEntries = {
|
|
|
18432
18502
|
files: emptyArray,
|
|
18433
18503
|
directories: emptyArray
|
|
18434
18504
|
};
|
|
18435
|
-
function matchPatternOrExact(
|
|
18436
|
-
const patterns =
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
patterns.push(patternOrString);
|
|
18443
|
-
}
|
|
18505
|
+
function matchPatternOrExact(parsedPatterns, candidate) {
|
|
18506
|
+
const { matchableStringSet, patterns } = parsedPatterns;
|
|
18507
|
+
if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
|
|
18508
|
+
return candidate;
|
|
18509
|
+
}
|
|
18510
|
+
if (patterns === void 0 || patterns.length === 0) {
|
|
18511
|
+
return void 0;
|
|
18444
18512
|
}
|
|
18445
18513
|
return findBestPatternMatch(patterns, (_) => _, candidate);
|
|
18446
18514
|
}
|
|
@@ -18517,6 +18585,7 @@ function isJsonEqual(a, b) {
|
|
|
18517
18585
|
function parsePseudoBigInt(stringValue) {
|
|
18518
18586
|
let log2Base;
|
|
18519
18587
|
switch (stringValue.charCodeAt(1)) {
|
|
18588
|
+
// "x" in "0x123"
|
|
18520
18589
|
case 98 /* b */:
|
|
18521
18590
|
case 66 /* B */:
|
|
18522
18591
|
log2Base = 1;
|
|
@@ -18754,7 +18823,7 @@ function getContainingNodeArray(node) {
|
|
|
18754
18823
|
return parent.types;
|
|
18755
18824
|
case 189 /* TupleType */:
|
|
18756
18825
|
case 209 /* ArrayLiteralExpression */:
|
|
18757
|
-
case
|
|
18826
|
+
case 356 /* CommaListExpression */:
|
|
18758
18827
|
case 275 /* NamedImports */:
|
|
18759
18828
|
case 279 /* NamedExports */:
|
|
18760
18829
|
return parent.elements;
|
|
@@ -19187,6 +19256,7 @@ function createNameResolver({
|
|
|
19187
19256
|
switch (location.kind) {
|
|
19188
19257
|
case 307 /* SourceFile */:
|
|
19189
19258
|
if (!isExternalOrCommonJsModule(location)) break;
|
|
19259
|
+
// falls through
|
|
19190
19260
|
case 267 /* ModuleDeclaration */:
|
|
19191
19261
|
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
19192
19262
|
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
@@ -19270,6 +19340,14 @@ function createNameResolver({
|
|
|
19270
19340
|
}
|
|
19271
19341
|
}
|
|
19272
19342
|
break;
|
|
19343
|
+
// It is not legal to reference a class's own type parameters from a computed property name that
|
|
19344
|
+
// belongs to the class. For example:
|
|
19345
|
+
//
|
|
19346
|
+
// function foo<T>() { return '' }
|
|
19347
|
+
// class C<T> { // <-- Class's own type parameter T
|
|
19348
|
+
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
|
|
19349
|
+
// }
|
|
19350
|
+
//
|
|
19273
19351
|
case 167 /* ComputedPropertyName */:
|
|
19274
19352
|
grandparent = location.parent.parent;
|
|
19275
19353
|
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
@@ -19285,6 +19363,7 @@ function createNameResolver({
|
|
|
19285
19363
|
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
19286
19364
|
break;
|
|
19287
19365
|
}
|
|
19366
|
+
// falls through
|
|
19288
19367
|
case 174 /* MethodDeclaration */:
|
|
19289
19368
|
case 176 /* Constructor */:
|
|
19290
19369
|
case 177 /* GetAccessor */:
|
|
@@ -19929,6 +20008,7 @@ function createParenthesizerRules(factory2) {
|
|
|
19929
20008
|
function parenthesizeConstituentTypeOfUnionType(type) {
|
|
19930
20009
|
switch (type.kind) {
|
|
19931
20010
|
case 192 /* UnionType */:
|
|
20011
|
+
// Not strictly necessary, but a union containing a union should have been flattened
|
|
19932
20012
|
case 193 /* IntersectionType */:
|
|
19933
20013
|
return factory2.createParenthesizedType(type);
|
|
19934
20014
|
}
|
|
@@ -20699,6 +20779,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20699
20779
|
createSyntheticExpression,
|
|
20700
20780
|
createSyntaxList,
|
|
20701
20781
|
createNotEmittedStatement,
|
|
20782
|
+
createNotEmittedTypeElement,
|
|
20702
20783
|
createPartiallyEmittedExpression,
|
|
20703
20784
|
updatePartiallyEmittedExpression,
|
|
20704
20785
|
createCommaListExpression,
|
|
@@ -23725,7 +23806,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23725
23806
|
return node;
|
|
23726
23807
|
}
|
|
23727
23808
|
function createPartiallyEmittedExpression(expression, original) {
|
|
23728
|
-
const node = createBaseNode(
|
|
23809
|
+
const node = createBaseNode(355 /* PartiallyEmittedExpression */);
|
|
23729
23810
|
node.expression = expression;
|
|
23730
23811
|
node.original = original;
|
|
23731
23812
|
node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
|
|
@@ -23735,6 +23816,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23735
23816
|
function updatePartiallyEmittedExpression(node, expression) {
|
|
23736
23817
|
return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
|
|
23737
23818
|
}
|
|
23819
|
+
function createNotEmittedTypeElement() {
|
|
23820
|
+
return createBaseNode(354 /* NotEmittedTypeElement */);
|
|
23821
|
+
}
|
|
23738
23822
|
function flattenCommaElements(node) {
|
|
23739
23823
|
if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
|
|
23740
23824
|
if (isCommaListExpression(node)) {
|
|
@@ -23747,7 +23831,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23747
23831
|
return node;
|
|
23748
23832
|
}
|
|
23749
23833
|
function createCommaListExpression(elements) {
|
|
23750
|
-
const node = createBaseNode(
|
|
23834
|
+
const node = createBaseNode(356 /* CommaListExpression */);
|
|
23751
23835
|
node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
|
|
23752
23836
|
node.transformFlags |= propagateChildrenFlags(node.elements);
|
|
23753
23837
|
return node;
|
|
@@ -23756,7 +23840,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23756
23840
|
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
|
|
23757
23841
|
}
|
|
23758
23842
|
function createSyntheticReferenceExpression(expression, thisArg) {
|
|
23759
|
-
const node = createBaseNode(
|
|
23843
|
+
const node = createBaseNode(357 /* SyntheticReferenceExpression */);
|
|
23760
23844
|
node.expression = expression;
|
|
23761
23845
|
node.thisArg = thisArg;
|
|
23762
23846
|
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
|
|
@@ -24003,7 +24087,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
24003
24087
|
return updateNonNullExpression(outerExpression, expression);
|
|
24004
24088
|
case 233 /* ExpressionWithTypeArguments */:
|
|
24005
24089
|
return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
|
|
24006
|
-
case
|
|
24090
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
24007
24091
|
return updatePartiallyEmittedExpression(outerExpression, expression);
|
|
24008
24092
|
}
|
|
24009
24093
|
}
|
|
@@ -24548,7 +24632,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
|
|
|
24548
24632
|
case 216 /* TypeAssertionExpression */:
|
|
24549
24633
|
case 238 /* SatisfiesExpression */:
|
|
24550
24634
|
case 234 /* AsExpression */:
|
|
24551
|
-
case
|
|
24635
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
24552
24636
|
case 217 /* ParenthesizedExpression */:
|
|
24553
24637
|
case 108 /* SuperKeyword */:
|
|
24554
24638
|
return -2147483648 /* OuterExpressionExcludes */;
|
|
@@ -26189,10 +26273,10 @@ function isMetaProperty(node) {
|
|
|
26189
26273
|
return node.kind === 236 /* MetaProperty */;
|
|
26190
26274
|
}
|
|
26191
26275
|
function isPartiallyEmittedExpression(node) {
|
|
26192
|
-
return node.kind ===
|
|
26276
|
+
return node.kind === 355 /* PartiallyEmittedExpression */;
|
|
26193
26277
|
}
|
|
26194
26278
|
function isCommaListExpression(node) {
|
|
26195
|
-
return node.kind ===
|
|
26279
|
+
return node.kind === 356 /* CommaListExpression */;
|
|
26196
26280
|
}
|
|
26197
26281
|
function isTemplateSpan(node) {
|
|
26198
26282
|
return node.kind === 239 /* TemplateSpan */;
|
|
@@ -26321,7 +26405,7 @@ function isNotEmittedStatement(node) {
|
|
|
26321
26405
|
return node.kind === 353 /* NotEmittedStatement */;
|
|
26322
26406
|
}
|
|
26323
26407
|
function isSyntheticReference(node) {
|
|
26324
|
-
return node.kind ===
|
|
26408
|
+
return node.kind === 357 /* SyntheticReferenceExpression */;
|
|
26325
26409
|
}
|
|
26326
26410
|
function isExternalModuleReference(node) {
|
|
26327
26411
|
return node.kind === 283 /* ExternalModuleReference */;
|
|
@@ -26902,7 +26986,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
|
26902
26986
|
return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
|
|
26903
26987
|
case 235 /* NonNullExpression */:
|
|
26904
26988
|
return (kinds & 4 /* NonNullAssertions */) !== 0;
|
|
26905
|
-
case
|
|
26989
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
26906
26990
|
return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
|
|
26907
26991
|
}
|
|
26908
26992
|
return false;
|
|
@@ -27342,10 +27426,13 @@ var BinaryExpressionState;
|
|
|
27342
27426
|
switch (currentState) {
|
|
27343
27427
|
case enter:
|
|
27344
27428
|
if (machine.onLeft) return left;
|
|
27429
|
+
// falls through
|
|
27345
27430
|
case left:
|
|
27346
27431
|
if (machine.onOperator) return operator;
|
|
27432
|
+
// falls through
|
|
27347
27433
|
case operator:
|
|
27348
27434
|
if (machine.onRight) return right;
|
|
27435
|
+
// falls through
|
|
27349
27436
|
case right:
|
|
27350
27437
|
return exit;
|
|
27351
27438
|
case exit:
|
|
@@ -27973,7 +28060,7 @@ var forEachChildTable = {
|
|
|
27973
28060
|
[282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
|
|
27974
28061
|
return visitNodes(cbNode, cbNodes, node.modifiers);
|
|
27975
28062
|
},
|
|
27976
|
-
[
|
|
28063
|
+
[356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
|
|
27977
28064
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
27978
28065
|
},
|
|
27979
28066
|
[284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
|
|
@@ -28069,7 +28156,7 @@ var forEachChildTable = {
|
|
|
28069
28156
|
[331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
|
|
28070
28157
|
[337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
|
|
28071
28158
|
[351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
|
|
28072
|
-
[
|
|
28159
|
+
[355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
|
|
28073
28160
|
};
|
|
28074
28161
|
function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
|
|
28075
28162
|
return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
|
|
@@ -28424,6 +28511,7 @@ var Parser;
|
|
|
28424
28511
|
expression2 = parseLiteralNode();
|
|
28425
28512
|
break;
|
|
28426
28513
|
}
|
|
28514
|
+
// falls through
|
|
28427
28515
|
default:
|
|
28428
28516
|
expression2 = parseObjectLiteralExpression();
|
|
28429
28517
|
break;
|
|
@@ -29345,6 +29433,7 @@ var Parser;
|
|
|
29345
29433
|
case 25 /* DotToken */:
|
|
29346
29434
|
return true;
|
|
29347
29435
|
}
|
|
29436
|
+
// falls through
|
|
29348
29437
|
case 11 /* ArgumentExpressions */:
|
|
29349
29438
|
return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
|
|
29350
29439
|
case 16 /* Parameters */:
|
|
@@ -29378,6 +29467,7 @@ var Parser;
|
|
|
29378
29467
|
return true;
|
|
29379
29468
|
case 26 /* Count */:
|
|
29380
29469
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
29470
|
+
// Not a real context, only a marker.
|
|
29381
29471
|
default:
|
|
29382
29472
|
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
|
|
29383
29473
|
}
|
|
@@ -29694,6 +29784,7 @@ var Parser;
|
|
|
29694
29784
|
case 3 /* SwitchClauseStatements */:
|
|
29695
29785
|
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
|
|
29696
29786
|
case 18 /* RestProperties */:
|
|
29787
|
+
// fallthrough
|
|
29697
29788
|
case 4 /* TypeMembers */:
|
|
29698
29789
|
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
|
|
29699
29790
|
case 5 /* ClassMembers */:
|
|
@@ -29741,6 +29832,7 @@ var Parser;
|
|
|
29741
29832
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
29742
29833
|
case 26 /* Count */:
|
|
29743
29834
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
29835
|
+
// Not a real context, only a marker.
|
|
29744
29836
|
default:
|
|
29745
29837
|
Debug.assertNever(context);
|
|
29746
29838
|
}
|
|
@@ -30665,10 +30757,12 @@ var Parser;
|
|
|
30665
30757
|
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
|
|
30666
30758
|
case 67 /* AsteriskEqualsToken */:
|
|
30667
30759
|
scanner.reScanAsteriskEqualsToken();
|
|
30760
|
+
// falls through
|
|
30668
30761
|
case 42 /* AsteriskToken */:
|
|
30669
30762
|
return parseJSDocAllType();
|
|
30670
30763
|
case 61 /* QuestionQuestionToken */:
|
|
30671
30764
|
scanner.reScanQuestionToken();
|
|
30765
|
+
// falls through
|
|
30672
30766
|
case 58 /* QuestionToken */:
|
|
30673
30767
|
return parseJSDocUnknownOrNullableType();
|
|
30674
30768
|
case 100 /* FunctionKeyword */:
|
|
@@ -31546,6 +31640,7 @@ var Parser;
|
|
|
31546
31640
|
if (isAwaitExpression2()) {
|
|
31547
31641
|
return parseAwaitExpression();
|
|
31548
31642
|
}
|
|
31643
|
+
// falls through
|
|
31549
31644
|
default:
|
|
31550
31645
|
return parseUpdateExpression();
|
|
31551
31646
|
}
|
|
@@ -31565,6 +31660,8 @@ var Parser;
|
|
|
31565
31660
|
if (languageVariant !== 1 /* JSX */) {
|
|
31566
31661
|
return false;
|
|
31567
31662
|
}
|
|
31663
|
+
// We are in JSX context and the token is part of JSXElement.
|
|
31664
|
+
// falls through
|
|
31568
31665
|
default:
|
|
31569
31666
|
return true;
|
|
31570
31667
|
}
|
|
@@ -32138,10 +32235,16 @@ var Parser;
|
|
|
32138
32235
|
}
|
|
32139
32236
|
function canFollowTypeArgumentsInExpression() {
|
|
32140
32237
|
switch (token()) {
|
|
32238
|
+
// These tokens can follow a type argument list in a call expression.
|
|
32141
32239
|
case 21 /* OpenParenToken */:
|
|
32240
|
+
// foo<x>(
|
|
32142
32241
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
32242
|
+
// foo<T> `...`
|
|
32143
32243
|
case 16 /* TemplateHead */:
|
|
32144
32244
|
return true;
|
|
32245
|
+
// A type argument list followed by `<` never makes sense, and a type argument list followed
|
|
32246
|
+
// by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
|
|
32247
|
+
// this context, `+` and `-` are unary operators, not binary operators.
|
|
32145
32248
|
case 30 /* LessThanToken */:
|
|
32146
32249
|
case 32 /* GreaterThanToken */:
|
|
32147
32250
|
case 40 /* PlusToken */:
|
|
@@ -32159,6 +32262,7 @@ var Parser;
|
|
|
32159
32262
|
false
|
|
32160
32263
|
);
|
|
32161
32264
|
}
|
|
32265
|
+
// falls through
|
|
32162
32266
|
case 9 /* NumericLiteral */:
|
|
32163
32267
|
case 10 /* BigIntLiteral */:
|
|
32164
32268
|
case 11 /* StringLiteral */:
|
|
@@ -32662,6 +32766,27 @@ var Parser;
|
|
|
32662
32766
|
return isUsingDeclaration();
|
|
32663
32767
|
case 135 /* AwaitKeyword */:
|
|
32664
32768
|
return isAwaitUsingDeclaration();
|
|
32769
|
+
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
|
|
32770
|
+
// however, an identifier cannot be followed by another identifier on the same line. This is what we
|
|
32771
|
+
// count on to parse out the respective declarations. For instance, we exploit this to say that
|
|
32772
|
+
//
|
|
32773
|
+
// namespace n
|
|
32774
|
+
//
|
|
32775
|
+
// can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
|
|
32776
|
+
//
|
|
32777
|
+
// namespace
|
|
32778
|
+
// n
|
|
32779
|
+
//
|
|
32780
|
+
// as the identifier 'namespace' on one line followed by the identifier 'n' on another.
|
|
32781
|
+
// We need to look one token ahead to see if it permissible to try parsing a declaration.
|
|
32782
|
+
//
|
|
32783
|
+
// *Note*: 'interface' is actually a strict mode reserved word. So while
|
|
32784
|
+
//
|
|
32785
|
+
// "use strict"
|
|
32786
|
+
// interface
|
|
32787
|
+
// I {}
|
|
32788
|
+
//
|
|
32789
|
+
// could be legal, it would add complexity for very little gain.
|
|
32665
32790
|
case 120 /* InterfaceKeyword */:
|
|
32666
32791
|
case 156 /* TypeKeyword */:
|
|
32667
32792
|
return nextTokenIsIdentifierOnSameLine();
|
|
@@ -32734,6 +32859,9 @@ var Parser;
|
|
|
32734
32859
|
case 111 /* ThrowKeyword */:
|
|
32735
32860
|
case 113 /* TryKeyword */:
|
|
32736
32861
|
case 89 /* DebuggerKeyword */:
|
|
32862
|
+
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
|
|
32863
|
+
// however, we say they are here so that we may gracefully parse them and error later.
|
|
32864
|
+
// falls through
|
|
32737
32865
|
case 85 /* CatchKeyword */:
|
|
32738
32866
|
case 98 /* FinallyKeyword */:
|
|
32739
32867
|
return true;
|
|
@@ -32872,6 +33000,8 @@ var Parser;
|
|
|
32872
33000
|
case 111 /* ThrowKeyword */:
|
|
32873
33001
|
return parseThrowStatement();
|
|
32874
33002
|
case 113 /* TryKeyword */:
|
|
33003
|
+
// Include 'catch' and 'finally' for error recovery.
|
|
33004
|
+
// falls through
|
|
32875
33005
|
case 85 /* CatchKeyword */:
|
|
32876
33006
|
case 98 /* FinallyKeyword */:
|
|
32877
33007
|
return parseTryStatement();
|
|
@@ -33290,10 +33420,15 @@ var Parser;
|
|
|
33290
33420
|
}
|
|
33291
33421
|
switch (token()) {
|
|
33292
33422
|
case 21 /* OpenParenToken */:
|
|
33423
|
+
// Method declaration
|
|
33293
33424
|
case 30 /* LessThanToken */:
|
|
33425
|
+
// Generic Method declaration
|
|
33294
33426
|
case 54 /* ExclamationToken */:
|
|
33427
|
+
// Non-null assertion on property name
|
|
33295
33428
|
case 59 /* ColonToken */:
|
|
33429
|
+
// Type Annotation for declaration
|
|
33296
33430
|
case 64 /* EqualsToken */:
|
|
33431
|
+
// Initializer for declaration
|
|
33297
33432
|
case 58 /* QuestionToken */:
|
|
33298
33433
|
return true;
|
|
33299
33434
|
default:
|
|
@@ -34200,6 +34335,7 @@ var Parser;
|
|
|
34200
34335
|
linkEnd = scanner.getTokenEnd();
|
|
34201
34336
|
break;
|
|
34202
34337
|
}
|
|
34338
|
+
// fallthrough if it's not a {@link sequence
|
|
34203
34339
|
default:
|
|
34204
34340
|
state = 2 /* SavingComments */;
|
|
34205
34341
|
pushComment(scanner.getTokenText());
|
|
@@ -34458,6 +34594,8 @@ var Parser;
|
|
|
34458
34594
|
indent2 += 1;
|
|
34459
34595
|
break;
|
|
34460
34596
|
}
|
|
34597
|
+
// record the * as a comment
|
|
34598
|
+
// falls through
|
|
34461
34599
|
default:
|
|
34462
34600
|
if (state !== 3 /* SavingBackticks */) {
|
|
34463
34601
|
state = 2 /* SavingComments */;
|
|
@@ -35538,6 +35676,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
|
|
|
35538
35676
|
case "jsximportsource":
|
|
35539
35677
|
case "jsxruntime":
|
|
35540
35678
|
return;
|
|
35679
|
+
// Accessed directly
|
|
35541
35680
|
default:
|
|
35542
35681
|
Debug.fail("Unhandled pragma kind");
|
|
35543
35682
|
}
|
|
@@ -36659,15 +36798,6 @@ var commandOptionsWithoutBuild = [
|
|
|
36659
36798
|
defaultValueDescription: false,
|
|
36660
36799
|
transpileOptionValue: void 0
|
|
36661
36800
|
},
|
|
36662
|
-
{
|
|
36663
|
-
name: "rewriteRelativeImportExtensions",
|
|
36664
|
-
type: "boolean",
|
|
36665
|
-
affectsSemanticDiagnostics: true,
|
|
36666
|
-
affectsBuildInfo: true,
|
|
36667
|
-
category: Diagnostics.Modules,
|
|
36668
|
-
description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
|
|
36669
|
-
defaultValueDescription: false
|
|
36670
|
-
},
|
|
36671
36801
|
{
|
|
36672
36802
|
name: "resolvePackageJsonExports",
|
|
36673
36803
|
type: "boolean",
|
|
@@ -37400,6 +37530,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
|
|
|
37400
37530
|
case "listOrElement":
|
|
37401
37531
|
Debug.fail("listOrElement not supported here");
|
|
37402
37532
|
break;
|
|
37533
|
+
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
|
37403
37534
|
default:
|
|
37404
37535
|
options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
|
|
37405
37536
|
i++;
|
|
@@ -37733,6 +37864,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
|
|
|
37733
37864
|
return false;
|
|
37734
37865
|
case 106 /* NullKeyword */:
|
|
37735
37866
|
return null;
|
|
37867
|
+
// eslint-disable-line no-restricted-syntax
|
|
37736
37868
|
case 11 /* StringLiteral */:
|
|
37737
37869
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
37738
37870
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
@@ -38197,8 +38329,6 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
38197
38329
|
validatedFilesSpecBeforeSubstitution,
|
|
38198
38330
|
validatedIncludeSpecsBeforeSubstitution,
|
|
38199
38331
|
validatedExcludeSpecsBeforeSubstitution,
|
|
38200
|
-
pathPatterns: void 0,
|
|
38201
|
-
// Initialized on first use
|
|
38202
38332
|
isDefaultIncludeSpec
|
|
38203
38333
|
};
|
|
38204
38334
|
}
|
|
@@ -39823,8 +39953,7 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
|
|
|
39823
39953
|
}
|
|
39824
39954
|
}
|
|
39825
39955
|
function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
|
|
39826
|
-
|
|
39827
|
-
const { baseUrl, paths, configFile } = state.compilerOptions;
|
|
39956
|
+
const { baseUrl, paths } = state.compilerOptions;
|
|
39828
39957
|
if (paths && !pathIsRelative(moduleName)) {
|
|
39829
39958
|
if (state.traceEnabled) {
|
|
39830
39959
|
if (baseUrl) {
|
|
@@ -39833,7 +39962,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
|
|
|
39833
39962
|
trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
|
|
39834
39963
|
}
|
|
39835
39964
|
const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
|
|
39836
|
-
const pathPatterns =
|
|
39965
|
+
const pathPatterns = tryParsePatterns(paths);
|
|
39837
39966
|
return tryLoadModuleUsingPaths(
|
|
39838
39967
|
extensions,
|
|
39839
39968
|
moduleName,
|
|
@@ -40505,17 +40634,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
40505
40634
|
if (state.traceEnabled) {
|
|
40506
40635
|
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, moduleName);
|
|
40507
40636
|
}
|
|
40508
|
-
const
|
|
40509
|
-
|
|
40510
|
-
moduleName,
|
|
40511
|
-
candidate,
|
|
40512
|
-
versionPaths.paths,
|
|
40513
|
-
/*pathPatterns*/
|
|
40514
|
-
void 0,
|
|
40515
|
-
loader,
|
|
40516
|
-
onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
|
|
40517
|
-
state
|
|
40518
|
-
);
|
|
40637
|
+
const pathPatterns = tryParsePatterns(versionPaths.paths);
|
|
40638
|
+
const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
|
|
40519
40639
|
if (result) {
|
|
40520
40640
|
return removeIgnoredPackageId(result.value);
|
|
40521
40641
|
}
|
|
@@ -41107,17 +41227,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
41107
41227
|
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
41108
41228
|
}
|
|
41109
41229
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
41110
|
-
const
|
|
41111
|
-
|
|
41112
|
-
rest,
|
|
41113
|
-
packageDirectory,
|
|
41114
|
-
versionPaths.paths,
|
|
41115
|
-
/*pathPatterns*/
|
|
41116
|
-
void 0,
|
|
41117
|
-
loader,
|
|
41118
|
-
!packageDirectoryExists,
|
|
41119
|
-
state
|
|
41120
|
-
);
|
|
41230
|
+
const pathPatterns = tryParsePatterns(versionPaths.paths);
|
|
41231
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
|
|
41121
41232
|
if (fromPaths) {
|
|
41122
41233
|
return fromPaths.value;
|
|
41123
41234
|
}
|
|
@@ -41125,7 +41236,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
41125
41236
|
return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
41126
41237
|
}
|
|
41127
41238
|
function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
|
|
41128
|
-
pathPatterns || (pathPatterns = tryParsePatterns(paths));
|
|
41129
41239
|
const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
|
|
41130
41240
|
if (matchedPattern) {
|
|
41131
41241
|
const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
|
|
@@ -41301,7 +41411,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
41301
41411
|
}
|
|
41302
41412
|
}
|
|
41303
41413
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
41304
|
-
return
|
|
41414
|
+
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
41305
41415
|
}
|
|
41306
41416
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
41307
41417
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -41386,20 +41496,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
|
|
|
41386
41496
|
}
|
|
41387
41497
|
function getModuleInstanceStateWorker(node, visited) {
|
|
41388
41498
|
switch (node.kind) {
|
|
41499
|
+
// 1. interface declarations, type alias declarations
|
|
41389
41500
|
case 264 /* InterfaceDeclaration */:
|
|
41390
41501
|
case 265 /* TypeAliasDeclaration */:
|
|
41391
41502
|
return 0 /* NonInstantiated */;
|
|
41503
|
+
// 2. const enum declarations
|
|
41392
41504
|
case 266 /* EnumDeclaration */:
|
|
41393
41505
|
if (isEnumConst(node)) {
|
|
41394
41506
|
return 2 /* ConstEnumOnly */;
|
|
41395
41507
|
}
|
|
41396
41508
|
break;
|
|
41509
|
+
// 3. non-exported import declarations
|
|
41397
41510
|
case 272 /* ImportDeclaration */:
|
|
41398
41511
|
case 271 /* ImportEqualsDeclaration */:
|
|
41399
41512
|
if (!hasSyntacticModifier(node, 32 /* Export */)) {
|
|
41400
41513
|
return 0 /* NonInstantiated */;
|
|
41401
41514
|
}
|
|
41402
41515
|
break;
|
|
41516
|
+
// 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
|
|
41403
41517
|
case 278 /* ExportDeclaration */:
|
|
41404
41518
|
const exportDeclaration = node;
|
|
41405
41519
|
if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
|
|
@@ -41416,6 +41530,7 @@ function getModuleInstanceStateWorker(node, visited) {
|
|
|
41416
41530
|
return state;
|
|
41417
41531
|
}
|
|
41418
41532
|
break;
|
|
41533
|
+
// 5. other uninstantiated module declarations.
|
|
41419
41534
|
case 268 /* ModuleBlock */: {
|
|
41420
41535
|
let state = 0 /* NonInstantiated */;
|
|
41421
41536
|
forEachChild(node, (n) => {
|
|
@@ -42014,6 +42129,7 @@ function createBinder() {
|
|
|
42014
42129
|
case 351 /* JSDocImportTag */:
|
|
42015
42130
|
bindJSDocImportTag(node);
|
|
42016
42131
|
break;
|
|
42132
|
+
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
|
|
42017
42133
|
case 307 /* SourceFile */: {
|
|
42018
42134
|
bindEachFunctionsFirst(node.statements);
|
|
42019
42135
|
bind(node.endOfFileToken);
|
|
@@ -42034,6 +42150,7 @@ function createBinder() {
|
|
|
42034
42150
|
case 303 /* PropertyAssignment */:
|
|
42035
42151
|
case 230 /* SpreadElement */:
|
|
42036
42152
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
42153
|
+
// falls through
|
|
42037
42154
|
default:
|
|
42038
42155
|
bindEachChild(node);
|
|
42039
42156
|
break;
|
|
@@ -42055,6 +42172,7 @@ function createBinder() {
|
|
|
42055
42172
|
if (isJSDocTypeAssertion(expr)) {
|
|
42056
42173
|
return false;
|
|
42057
42174
|
}
|
|
42175
|
+
// fallthrough
|
|
42058
42176
|
case 235 /* NonNullExpression */:
|
|
42059
42177
|
return isNarrowingExpression(expr.expression);
|
|
42060
42178
|
case 226 /* BinaryExpression */:
|
|
@@ -42886,6 +43004,10 @@ function createBinder() {
|
|
|
42886
43004
|
}
|
|
42887
43005
|
function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
|
|
42888
43006
|
switch (container.kind) {
|
|
43007
|
+
// Modules, source files, and classes need specialized handling for how their
|
|
43008
|
+
// members are declared (for example, a member of a class will go into a specific
|
|
43009
|
+
// symbol table depending on if it is static or not). We defer to specialized
|
|
43010
|
+
// handlers to take care of declaring these child members.
|
|
42889
43011
|
case 267 /* ModuleDeclaration */:
|
|
42890
43012
|
return declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
42891
43013
|
case 307 /* SourceFile */:
|
|
@@ -43027,6 +43149,7 @@ function createBinder() {
|
|
|
43027
43149
|
declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
43028
43150
|
break;
|
|
43029
43151
|
}
|
|
43152
|
+
// falls through
|
|
43030
43153
|
default:
|
|
43031
43154
|
Debug.assertNode(blockScopeContainer, canHaveLocals);
|
|
43032
43155
|
if (!blockScopeContainer.locals) {
|
|
@@ -43347,6 +43470,7 @@ function createBinder() {
|
|
|
43347
43470
|
}
|
|
43348
43471
|
function bindWorker(node) {
|
|
43349
43472
|
switch (node.kind) {
|
|
43473
|
+
/* Strict mode checks */
|
|
43350
43474
|
case 80 /* Identifier */:
|
|
43351
43475
|
if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
|
|
43352
43476
|
let parentNode = node.parent;
|
|
@@ -43356,6 +43480,7 @@ function createBinder() {
|
|
|
43356
43480
|
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
|
43357
43481
|
break;
|
|
43358
43482
|
}
|
|
43483
|
+
// falls through
|
|
43359
43484
|
case 110 /* ThisKeyword */:
|
|
43360
43485
|
if (currentFlow && (isExpression(node) || parent.kind === 304 /* ShorthandPropertyAssignment */)) {
|
|
43361
43486
|
node.flowNode = currentFlow;
|
|
@@ -43444,6 +43569,7 @@ function createBinder() {
|
|
|
43444
43569
|
return;
|
|
43445
43570
|
case 182 /* TypePredicate */:
|
|
43446
43571
|
break;
|
|
43572
|
+
// Binding the children will handle everything
|
|
43447
43573
|
case 168 /* TypeParameter */:
|
|
43448
43574
|
return bindTypeParameter(node);
|
|
43449
43575
|
case 169 /* Parameter */:
|
|
@@ -43508,6 +43634,7 @@ function createBinder() {
|
|
|
43508
43634
|
return bindObjectDefinePrototypeProperty(node);
|
|
43509
43635
|
case 0 /* None */:
|
|
43510
43636
|
break;
|
|
43637
|
+
// Nothing to do
|
|
43511
43638
|
default:
|
|
43512
43639
|
return Debug.fail("Unknown call expression assignment declaration kind");
|
|
43513
43640
|
}
|
|
@@ -43515,6 +43642,7 @@ function createBinder() {
|
|
|
43515
43642
|
bindCallExpression(node);
|
|
43516
43643
|
}
|
|
43517
43644
|
break;
|
|
43645
|
+
// Members of classes, interfaces, and modules
|
|
43518
43646
|
case 231 /* ClassExpression */:
|
|
43519
43647
|
case 263 /* ClassDeclaration */:
|
|
43520
43648
|
inStrictMode = true;
|
|
@@ -43527,10 +43655,12 @@ function createBinder() {
|
|
|
43527
43655
|
return bindEnumDeclaration(node);
|
|
43528
43656
|
case 267 /* ModuleDeclaration */:
|
|
43529
43657
|
return bindModuleDeclaration(node);
|
|
43658
|
+
// Jsx-attributes
|
|
43530
43659
|
case 292 /* JsxAttributes */:
|
|
43531
43660
|
return bindJsxAttributes(node);
|
|
43532
43661
|
case 291 /* JsxAttribute */:
|
|
43533
43662
|
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
|
43663
|
+
// Imports and exports
|
|
43534
43664
|
case 271 /* ImportEqualsDeclaration */:
|
|
43535
43665
|
case 274 /* NamespaceImport */:
|
|
43536
43666
|
case 276 /* ImportSpecifier */:
|
|
@@ -43551,6 +43681,7 @@ function createBinder() {
|
|
|
43551
43681
|
if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
|
|
43552
43682
|
return;
|
|
43553
43683
|
}
|
|
43684
|
+
// falls through
|
|
43554
43685
|
case 268 /* ModuleBlock */:
|
|
43555
43686
|
return updateStrictModeStatementList(node.statements);
|
|
43556
43687
|
case 341 /* JSDocParameterTag */:
|
|
@@ -43560,6 +43691,7 @@ function createBinder() {
|
|
|
43560
43691
|
if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
|
|
43561
43692
|
break;
|
|
43562
43693
|
}
|
|
43694
|
+
// falls through
|
|
43563
43695
|
case 348 /* JSDocPropertyTag */:
|
|
43564
43696
|
const propTag = node;
|
|
43565
43697
|
const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
|
|
@@ -43772,6 +43904,7 @@ function createBinder() {
|
|
|
43772
43904
|
declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
|
|
43773
43905
|
}
|
|
43774
43906
|
break;
|
|
43907
|
+
// Namespaces are not allowed in javascript files, so do nothing here
|
|
43775
43908
|
case 267 /* ModuleDeclaration */:
|
|
43776
43909
|
break;
|
|
43777
43910
|
default:
|
|
@@ -44268,6 +44401,7 @@ function getContainerFlags(node) {
|
|
|
44268
44401
|
if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
|
|
44269
44402
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
|
|
44270
44403
|
}
|
|
44404
|
+
// falls through
|
|
44271
44405
|
case 176 /* Constructor */:
|
|
44272
44406
|
case 262 /* FunctionDeclaration */:
|
|
44273
44407
|
case 173 /* MethodSignature */:
|
|
@@ -47321,6 +47455,7 @@ function createTypeChecker(host) {
|
|
|
47321
47455
|
if (isEntityNameExpression(node.expression)) {
|
|
47322
47456
|
return node.expression;
|
|
47323
47457
|
}
|
|
47458
|
+
// falls through
|
|
47324
47459
|
default:
|
|
47325
47460
|
return void 0;
|
|
47326
47461
|
}
|
|
@@ -49176,6 +49311,7 @@ function createTypeChecker(host) {
|
|
|
49176
49311
|
if (!isExternalOrCommonJsModule(location)) {
|
|
49177
49312
|
break;
|
|
49178
49313
|
}
|
|
49314
|
+
// falls through
|
|
49179
49315
|
case 267 /* ModuleDeclaration */:
|
|
49180
49316
|
const sym = getSymbolOfDeclaration(location);
|
|
49181
49317
|
if (result = callback(
|
|
@@ -50598,6 +50734,9 @@ function createTypeChecker(host) {
|
|
|
50598
50734
|
}
|
|
50599
50735
|
function createTypeNodesFromResolvedType(resolvedType) {
|
|
50600
50736
|
if (checkTruncationLength(context)) {
|
|
50737
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
50738
|
+
return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
|
|
50739
|
+
}
|
|
50601
50740
|
return [factory.createPropertySignature(
|
|
50602
50741
|
/*modifiers*/
|
|
50603
50742
|
void 0,
|
|
@@ -50635,15 +50774,20 @@ function createTypeChecker(host) {
|
|
|
50635
50774
|
}
|
|
50636
50775
|
}
|
|
50637
50776
|
if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
|
|
50638
|
-
|
|
50639
|
-
|
|
50640
|
-
|
|
50641
|
-
|
|
50642
|
-
|
|
50643
|
-
|
|
50644
|
-
|
|
50645
|
-
|
|
50646
|
-
|
|
50777
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
50778
|
+
const typeElement = typeElements.pop();
|
|
50779
|
+
typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
|
|
50780
|
+
} else {
|
|
50781
|
+
typeElements.push(factory.createPropertySignature(
|
|
50782
|
+
/*modifiers*/
|
|
50783
|
+
void 0,
|
|
50784
|
+
`... ${properties.length - i} more ...`,
|
|
50785
|
+
/*questionToken*/
|
|
50786
|
+
void 0,
|
|
50787
|
+
/*type*/
|
|
50788
|
+
void 0
|
|
50789
|
+
));
|
|
50790
|
+
}
|
|
50647
50791
|
addPropertyToElementList(properties[properties.length - 1], context, typeElements);
|
|
50648
50792
|
break;
|
|
50649
50793
|
}
|
|
@@ -50661,7 +50805,7 @@ function createTypeChecker(host) {
|
|
|
50661
50805
|
void 0
|
|
50662
50806
|
);
|
|
50663
50807
|
}
|
|
50664
|
-
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50808
|
+
return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
|
|
50665
50809
|
}
|
|
50666
50810
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
50667
50811
|
var _a;
|
|
@@ -50797,15 +50941,17 @@ function createTypeChecker(host) {
|
|
|
50797
50941
|
if (some(types)) {
|
|
50798
50942
|
if (checkTruncationLength(context)) {
|
|
50799
50943
|
if (!isBareList) {
|
|
50800
|
-
return [
|
|
50801
|
-
"
|
|
50802
|
-
|
|
50803
|
-
|
|
50804
|
-
|
|
50944
|
+
return [
|
|
50945
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
|
|
50946
|
+
"...",
|
|
50947
|
+
/*typeArguments*/
|
|
50948
|
+
void 0
|
|
50949
|
+
)
|
|
50950
|
+
];
|
|
50805
50951
|
} else if (types.length > 2) {
|
|
50806
50952
|
return [
|
|
50807
50953
|
typeToTypeNodeHelper(types[0], context),
|
|
50808
|
-
factory.createTypeReferenceNode(
|
|
50954
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
|
|
50809
50955
|
`... ${types.length - 2} more ...`,
|
|
50810
50956
|
/*typeArguments*/
|
|
50811
50957
|
void 0
|
|
@@ -50821,11 +50967,13 @@ function createTypeChecker(host) {
|
|
|
50821
50967
|
for (const type of types) {
|
|
50822
50968
|
i++;
|
|
50823
50969
|
if (checkTruncationLength(context) && i + 2 < types.length - 1) {
|
|
50824
|
-
result.push(
|
|
50825
|
-
`... ${types.length - i} more
|
|
50826
|
-
|
|
50827
|
-
|
|
50828
|
-
|
|
50970
|
+
result.push(
|
|
50971
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
|
|
50972
|
+
`... ${types.length - i} more ...`,
|
|
50973
|
+
/*typeArguments*/
|
|
50974
|
+
void 0
|
|
50975
|
+
)
|
|
50976
|
+
);
|
|
50829
50977
|
const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
|
|
50830
50978
|
if (typeNode2) {
|
|
50831
50979
|
result.push(typeNode2);
|
|
@@ -53420,6 +53568,7 @@ function createTypeChecker(host) {
|
|
|
53420
53568
|
);
|
|
53421
53569
|
break;
|
|
53422
53570
|
}
|
|
53571
|
+
// else fall through and treat commonjs require just like import=
|
|
53423
53572
|
case 271 /* ImportEqualsDeclaration */:
|
|
53424
53573
|
if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
|
|
53425
53574
|
serializeMaybeAliasAssignment(symbol);
|
|
@@ -54192,6 +54341,7 @@ function createTypeChecker(host) {
|
|
|
54192
54341
|
if (isBindingPattern(node.name) && !node.name.elements.length) {
|
|
54193
54342
|
return false;
|
|
54194
54343
|
}
|
|
54344
|
+
// falls through
|
|
54195
54345
|
case 267 /* ModuleDeclaration */:
|
|
54196
54346
|
case 263 /* ClassDeclaration */:
|
|
54197
54347
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -54216,6 +54366,8 @@ function createTypeChecker(host) {
|
|
|
54216
54366
|
if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
|
|
54217
54367
|
return false;
|
|
54218
54368
|
}
|
|
54369
|
+
// Public properties/methods are visible if its parents are visible, so:
|
|
54370
|
+
// falls through
|
|
54219
54371
|
case 176 /* Constructor */:
|
|
54220
54372
|
case 180 /* ConstructSignature */:
|
|
54221
54373
|
case 179 /* CallSignature */:
|
|
@@ -54233,14 +54385,20 @@ function createTypeChecker(host) {
|
|
|
54233
54385
|
case 196 /* ParenthesizedType */:
|
|
54234
54386
|
case 202 /* NamedTupleMember */:
|
|
54235
54387
|
return isDeclarationVisible(node.parent);
|
|
54388
|
+
// Default binding, import specifier and namespace import is visible
|
|
54389
|
+
// only on demand so by default it is not visible
|
|
54236
54390
|
case 273 /* ImportClause */:
|
|
54237
54391
|
case 274 /* NamespaceImport */:
|
|
54238
54392
|
case 276 /* ImportSpecifier */:
|
|
54239
54393
|
return false;
|
|
54394
|
+
// Type parameters are always visible
|
|
54240
54395
|
case 168 /* TypeParameter */:
|
|
54396
|
+
// Source file and namespace export are always visible
|
|
54397
|
+
// falls through
|
|
54241
54398
|
case 307 /* SourceFile */:
|
|
54242
54399
|
case 270 /* NamespaceExportDeclaration */:
|
|
54243
54400
|
return true;
|
|
54401
|
+
// Export assignments do not create name bindings outside the module
|
|
54244
54402
|
case 277 /* ExportAssignment */:
|
|
54245
54403
|
return false;
|
|
54246
54404
|
default:
|
|
@@ -56185,11 +56343,20 @@ function createTypeChecker(host) {
|
|
|
56185
56343
|
return type;
|
|
56186
56344
|
}
|
|
56187
56345
|
function isLateBindableName(node) {
|
|
56346
|
+
return isLateBindableAST(node) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
56347
|
+
}
|
|
56348
|
+
function isLateBindableIndexSignature(node) {
|
|
56349
|
+
return isLateBindableAST(node) && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
56350
|
+
}
|
|
56351
|
+
function isLateBindableAST(node) {
|
|
56188
56352
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
56189
56353
|
return false;
|
|
56190
56354
|
}
|
|
56191
56355
|
const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
|
|
56192
|
-
return isEntityNameExpression(expr)
|
|
56356
|
+
return isEntityNameExpression(expr);
|
|
56357
|
+
}
|
|
56358
|
+
function isTypeUsableAsIndexSignature(type) {
|
|
56359
|
+
return isTypeAssignableTo(type, stringNumberSymbolType);
|
|
56193
56360
|
}
|
|
56194
56361
|
function isLateBoundName(name) {
|
|
56195
56362
|
return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
|
|
@@ -56198,6 +56365,10 @@ function createTypeChecker(host) {
|
|
|
56198
56365
|
const name = getNameOfDeclaration(node);
|
|
56199
56366
|
return !!name && isLateBindableName(name);
|
|
56200
56367
|
}
|
|
56368
|
+
function hasLateBindableIndexSignature(node) {
|
|
56369
|
+
const name = getNameOfDeclaration(node);
|
|
56370
|
+
return !!name && isLateBindableIndexSignature(name);
|
|
56371
|
+
}
|
|
56201
56372
|
function hasBindableName(node) {
|
|
56202
56373
|
return !hasDynamicName(node) || hasLateBindableName(node);
|
|
56203
56374
|
}
|
|
@@ -56251,6 +56422,24 @@ function createTypeChecker(host) {
|
|
|
56251
56422
|
}
|
|
56252
56423
|
return links.resolvedSymbol;
|
|
56253
56424
|
}
|
|
56425
|
+
function lateBindIndexSignature(parent, earlySymbols, lateSymbols, decl) {
|
|
56426
|
+
let indexSymbol = lateSymbols.get("__index" /* Index */);
|
|
56427
|
+
if (!indexSymbol) {
|
|
56428
|
+
const early = earlySymbols == null ? void 0 : earlySymbols.get("__index" /* Index */);
|
|
56429
|
+
if (!early) {
|
|
56430
|
+
indexSymbol = createSymbol(0 /* None */, "__index" /* Index */, 4096 /* Late */);
|
|
56431
|
+
} else {
|
|
56432
|
+
indexSymbol = cloneSymbol(early);
|
|
56433
|
+
indexSymbol.links.checkFlags |= 4096 /* Late */;
|
|
56434
|
+
}
|
|
56435
|
+
lateSymbols.set("__index" /* Index */, indexSymbol);
|
|
56436
|
+
}
|
|
56437
|
+
if (!indexSymbol.declarations) {
|
|
56438
|
+
indexSymbol.declarations = [decl];
|
|
56439
|
+
} else if (!decl.symbol.isReplaceableByMethod) {
|
|
56440
|
+
indexSymbol.declarations.push(decl);
|
|
56441
|
+
}
|
|
56442
|
+
}
|
|
56254
56443
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
56255
56444
|
const links = getSymbolLinks(symbol);
|
|
56256
56445
|
if (!links[resolutionKind]) {
|
|
@@ -56265,6 +56454,8 @@ function createTypeChecker(host) {
|
|
|
56265
56454
|
if (isStatic2 === hasStaticModifier(member)) {
|
|
56266
56455
|
if (hasLateBindableName(member)) {
|
|
56267
56456
|
lateBindMember(symbol, earlySymbols, lateSymbols, member);
|
|
56457
|
+
} else if (hasLateBindableIndexSignature(member)) {
|
|
56458
|
+
lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
|
|
56268
56459
|
}
|
|
56269
56460
|
}
|
|
56270
56461
|
}
|
|
@@ -58528,7 +58719,7 @@ function createTypeChecker(host) {
|
|
|
58528
58719
|
return signature.isolatedSignatureType;
|
|
58529
58720
|
}
|
|
58530
58721
|
function getIndexSymbol(symbol) {
|
|
58531
|
-
return symbol.members ? getIndexSymbolFromSymbolTable(symbol
|
|
58722
|
+
return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
|
|
58532
58723
|
}
|
|
58533
58724
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
|
58534
58725
|
return symbolTable.get("__index" /* Index */);
|
|
@@ -58544,15 +58735,25 @@ function createTypeChecker(host) {
|
|
|
58544
58735
|
if (indexSymbol.declarations) {
|
|
58545
58736
|
const indexInfos = [];
|
|
58546
58737
|
for (const declaration of indexSymbol.declarations) {
|
|
58547
|
-
if (declaration
|
|
58548
|
-
|
|
58549
|
-
|
|
58550
|
-
|
|
58551
|
-
|
|
58552
|
-
|
|
58553
|
-
|
|
58554
|
-
|
|
58738
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
58739
|
+
if (declaration.parameters.length === 1) {
|
|
58740
|
+
const parameter = declaration.parameters[0];
|
|
58741
|
+
if (parameter.type) {
|
|
58742
|
+
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
58743
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
58744
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
|
|
58745
|
+
}
|
|
58746
|
+
});
|
|
58747
|
+
}
|
|
58555
58748
|
}
|
|
58749
|
+
} else if (hasLateBindableIndexSignature(declaration)) {
|
|
58750
|
+
const declName = isBinaryExpression(declaration) ? declaration.left : declaration.name;
|
|
58751
|
+
const keyType = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
|
|
58752
|
+
forEachType(keyType, (keyType2) => {
|
|
58753
|
+
if (isValidIndexKeyType(keyType2) && !findIndexInfo(indexInfos, keyType2)) {
|
|
58754
|
+
indexInfos.push(createIndexInfo(keyType2, getTypeOfVariableOrParameterOrProperty(declaration.symbol), hasEffectiveModifier(declaration, 8 /* Readonly */)));
|
|
58755
|
+
}
|
|
58756
|
+
});
|
|
58556
58757
|
}
|
|
58557
58758
|
}
|
|
58558
58759
|
return indexInfos;
|
|
@@ -61790,6 +61991,9 @@ function createTypeChecker(host) {
|
|
|
61790
61991
|
return getTypeFromTemplateTypeNode(node);
|
|
61791
61992
|
case 205 /* ImportType */:
|
|
61792
61993
|
return getTypeFromImportTypeNode(node);
|
|
61994
|
+
// This function assumes that an identifier, qualified name, or property access expression is a type expression
|
|
61995
|
+
// Callers should first ensure this by calling `isPartOfTypeNode`
|
|
61996
|
+
// TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s.
|
|
61793
61997
|
case 80 /* Identifier */:
|
|
61794
61998
|
case 166 /* QualifiedName */:
|
|
61795
61999
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -62037,6 +62241,7 @@ function createTypeChecker(host) {
|
|
|
62037
62241
|
return !!tp.isThisType;
|
|
62038
62242
|
case 80 /* Identifier */:
|
|
62039
62243
|
return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
|
|
62244
|
+
// use worker because we're looking for === equality
|
|
62040
62245
|
case 186 /* TypeQuery */:
|
|
62041
62246
|
const entityName = node2.exprName;
|
|
62042
62247
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
@@ -62456,6 +62661,7 @@ function createTypeChecker(host) {
|
|
|
62456
62661
|
if (!isConstAssertion(node)) {
|
|
62457
62662
|
break;
|
|
62458
62663
|
}
|
|
62664
|
+
// fallthrough
|
|
62459
62665
|
case 294 /* JsxExpression */:
|
|
62460
62666
|
case 217 /* ParenthesizedExpression */:
|
|
62461
62667
|
return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
|
|
@@ -63551,7 +63757,7 @@ function createTypeChecker(host) {
|
|
|
63551
63757
|
const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2);
|
|
63552
63758
|
let generalizedSource = source2;
|
|
63553
63759
|
let generalizedSourceType = sourceType;
|
|
63554
|
-
if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
|
|
63760
|
+
if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) {
|
|
63555
63761
|
generalizedSource = getBaseTypeOfLiteralType(source2);
|
|
63556
63762
|
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
|
|
63557
63763
|
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
|
|
@@ -67775,6 +67981,7 @@ function createTypeChecker(host) {
|
|
|
67775
67981
|
if (isCallExpression(node.parent)) {
|
|
67776
67982
|
return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
|
|
67777
67983
|
}
|
|
67984
|
+
// falls through
|
|
67778
67985
|
default:
|
|
67779
67986
|
if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
67780
67987
|
return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
|
|
@@ -67808,6 +68015,7 @@ function createTypeChecker(host) {
|
|
|
67808
68015
|
const symbol = getResolvedSymbol(node);
|
|
67809
68016
|
return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
|
|
67810
68017
|
}
|
|
68018
|
+
// falls through
|
|
67811
68019
|
case 110 /* ThisKeyword */:
|
|
67812
68020
|
return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
|
|
67813
68021
|
case 235 /* NonNullExpression */:
|
|
@@ -69361,6 +69569,9 @@ function createTypeChecker(host) {
|
|
|
69361
69569
|
break;
|
|
69362
69570
|
case 28 /* CommaToken */:
|
|
69363
69571
|
return narrowType(type, expr.right, assumeTrue);
|
|
69572
|
+
// Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
|
|
69573
|
+
// expressions down to individual conditional control flows. However, we may encounter them when analyzing
|
|
69574
|
+
// aliased conditional expressions.
|
|
69364
69575
|
case 56 /* AmpersandAmpersandToken */:
|
|
69365
69576
|
return assumeTrue ? narrowType(
|
|
69366
69577
|
narrowType(
|
|
@@ -69804,6 +70015,7 @@ function createTypeChecker(host) {
|
|
|
69804
70015
|
}
|
|
69805
70016
|
}
|
|
69806
70017
|
}
|
|
70018
|
+
// falls through
|
|
69807
70019
|
case 110 /* ThisKeyword */:
|
|
69808
70020
|
case 108 /* SuperKeyword */:
|
|
69809
70021
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -77622,6 +77834,7 @@ function createTypeChecker(host) {
|
|
|
77622
77834
|
hasError = true;
|
|
77623
77835
|
break;
|
|
77624
77836
|
}
|
|
77837
|
+
// fallthrough
|
|
77625
77838
|
case 7 /* ES2022 */:
|
|
77626
77839
|
case 99 /* ESNext */:
|
|
77627
77840
|
case 200 /* Preserve */:
|
|
@@ -77629,6 +77842,7 @@ function createTypeChecker(host) {
|
|
|
77629
77842
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
77630
77843
|
break;
|
|
77631
77844
|
}
|
|
77845
|
+
// fallthrough
|
|
77632
77846
|
default:
|
|
77633
77847
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
77634
77848
|
const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
|
|
@@ -78046,9 +78260,13 @@ function createTypeChecker(host) {
|
|
|
78046
78260
|
return true;
|
|
78047
78261
|
}
|
|
78048
78262
|
return false;
|
|
78263
|
+
// Some forms listed here for clarity
|
|
78049
78264
|
case 222 /* VoidExpression */:
|
|
78265
|
+
// Explicit opt-out
|
|
78050
78266
|
case 216 /* TypeAssertionExpression */:
|
|
78267
|
+
// Not SEF, but can produce useful type warnings
|
|
78051
78268
|
case 234 /* AsExpression */:
|
|
78269
|
+
// Not SEF, but can produce useful type warnings
|
|
78052
78270
|
default:
|
|
78053
78271
|
return false;
|
|
78054
78272
|
}
|
|
@@ -79294,6 +79512,7 @@ function createTypeChecker(host) {
|
|
|
79294
79512
|
if (node.expression.kind === 102 /* ImportKeyword */) {
|
|
79295
79513
|
return checkImportCallExpression(node);
|
|
79296
79514
|
}
|
|
79515
|
+
// falls through
|
|
79297
79516
|
case 214 /* NewExpression */:
|
|
79298
79517
|
return checkCallExpression(node, checkMode);
|
|
79299
79518
|
case 215 /* TaggedTemplateExpression */:
|
|
@@ -79382,7 +79601,7 @@ function createTypeChecker(host) {
|
|
|
79382
79601
|
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
79383
79602
|
if (modifiers) {
|
|
79384
79603
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
79385
|
-
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (
|
|
79604
|
+
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79386
79605
|
error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79387
79606
|
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
79388
79607
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
@@ -79663,6 +79882,7 @@ function createTypeChecker(host) {
|
|
|
79663
79882
|
if (useDefineForClassFields) {
|
|
79664
79883
|
break;
|
|
79665
79884
|
}
|
|
79885
|
+
// fall through
|
|
79666
79886
|
case "prototype":
|
|
79667
79887
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
79668
79888
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
@@ -79709,15 +79929,17 @@ function createTypeChecker(host) {
|
|
|
79709
79929
|
if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
|
|
79710
79930
|
const indexSignatureMap = /* @__PURE__ */ new Map();
|
|
79711
79931
|
for (const declaration of indexSymbol.declarations) {
|
|
79712
|
-
if (declaration
|
|
79713
|
-
|
|
79714
|
-
|
|
79715
|
-
|
|
79716
|
-
entry
|
|
79717
|
-
|
|
79718
|
-
|
|
79719
|
-
|
|
79720
|
-
|
|
79932
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
79933
|
+
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
79934
|
+
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
|
|
79935
|
+
const entry = indexSignatureMap.get(getTypeId(type));
|
|
79936
|
+
if (entry) {
|
|
79937
|
+
entry.declarations.push(declaration);
|
|
79938
|
+
} else {
|
|
79939
|
+
indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
|
|
79940
|
+
}
|
|
79941
|
+
});
|
|
79942
|
+
}
|
|
79721
79943
|
}
|
|
79722
79944
|
}
|
|
79723
79945
|
indexSignatureMap.forEach((entry) => {
|
|
@@ -80406,6 +80628,8 @@ function createTypeChecker(host) {
|
|
|
80406
80628
|
switch (d.kind) {
|
|
80407
80629
|
case 264 /* InterfaceDeclaration */:
|
|
80408
80630
|
case 265 /* TypeAliasDeclaration */:
|
|
80631
|
+
// A jsdoc typedef and callback are, by definition, type aliases.
|
|
80632
|
+
// falls through
|
|
80409
80633
|
case 346 /* JSDocTypedefTag */:
|
|
80410
80634
|
case 338 /* JSDocCallbackTag */:
|
|
80411
80635
|
case 340 /* JSDocEnumTag */:
|
|
@@ -80426,6 +80650,8 @@ function createTypeChecker(host) {
|
|
|
80426
80650
|
return 1 /* ExportValue */;
|
|
80427
80651
|
}
|
|
80428
80652
|
d = expression;
|
|
80653
|
+
// The below options all declare an Alias, which is allowed to merge with other values within the importing module.
|
|
80654
|
+
// falls through
|
|
80429
80655
|
case 271 /* ImportEqualsDeclaration */:
|
|
80430
80656
|
case 274 /* NamespaceImport */:
|
|
80431
80657
|
case 273 /* ImportClause */:
|
|
@@ -80439,6 +80665,7 @@ function createTypeChecker(host) {
|
|
|
80439
80665
|
case 208 /* BindingElement */:
|
|
80440
80666
|
case 262 /* FunctionDeclaration */:
|
|
80441
80667
|
case 276 /* ImportSpecifier */:
|
|
80668
|
+
// https://github.com/Microsoft/TypeScript/pull/7591
|
|
80442
80669
|
case 80 /* Identifier */:
|
|
80443
80670
|
return 1 /* ExportValue */;
|
|
80444
80671
|
case 173 /* MethodSignature */:
|
|
@@ -80787,6 +81014,7 @@ function createTypeChecker(host) {
|
|
|
80787
81014
|
headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
80788
81015
|
break;
|
|
80789
81016
|
}
|
|
81017
|
+
// falls through
|
|
80790
81018
|
case 169 /* Parameter */:
|
|
80791
81019
|
headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
80792
81020
|
break;
|
|
@@ -84008,6 +84236,7 @@ function createTypeChecker(host) {
|
|
|
84008
84236
|
break;
|
|
84009
84237
|
case 271 /* ImportEqualsDeclaration */:
|
|
84010
84238
|
if (isInternalModuleImportEqualsDeclaration(node)) break;
|
|
84239
|
+
// falls through
|
|
84011
84240
|
case 272 /* ImportDeclaration */:
|
|
84012
84241
|
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
|
|
84013
84242
|
break;
|
|
@@ -84020,6 +84249,7 @@ function createTypeChecker(host) {
|
|
|
84020
84249
|
}
|
|
84021
84250
|
break;
|
|
84022
84251
|
}
|
|
84252
|
+
// falls through
|
|
84023
84253
|
case 263 /* ClassDeclaration */:
|
|
84024
84254
|
case 266 /* EnumDeclaration */:
|
|
84025
84255
|
case 262 /* FunctionDeclaration */:
|
|
@@ -84696,6 +84926,7 @@ function createTypeChecker(host) {
|
|
|
84696
84926
|
return checkJSDocPropertyTag(node);
|
|
84697
84927
|
case 317 /* JSDocFunctionType */:
|
|
84698
84928
|
checkJSDocFunctionType(node);
|
|
84929
|
+
// falls through
|
|
84699
84930
|
case 315 /* JSDocNonNullableType */:
|
|
84700
84931
|
case 314 /* JSDocNullableType */:
|
|
84701
84932
|
case 312 /* JSDocAllType */:
|
|
@@ -85119,6 +85350,7 @@ function createTypeChecker(host) {
|
|
|
85119
85350
|
switch (location.kind) {
|
|
85120
85351
|
case 307 /* SourceFile */:
|
|
85121
85352
|
if (!isExternalModule(location)) break;
|
|
85353
|
+
// falls through
|
|
85122
85354
|
case 267 /* ModuleDeclaration */:
|
|
85123
85355
|
copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
|
|
85124
85356
|
break;
|
|
@@ -85130,6 +85362,9 @@ function createTypeChecker(host) {
|
|
|
85130
85362
|
if (className) {
|
|
85131
85363
|
copySymbol(location.symbol, meaning);
|
|
85132
85364
|
}
|
|
85365
|
+
// this fall-through is necessary because we would like to handle
|
|
85366
|
+
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
|
|
85367
|
+
// falls through
|
|
85133
85368
|
case 263 /* ClassDeclaration */:
|
|
85134
85369
|
case 264 /* InterfaceDeclaration */:
|
|
85135
85370
|
if (!isStaticSymbol) {
|
|
@@ -85238,6 +85473,7 @@ function createTypeChecker(host) {
|
|
|
85238
85473
|
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
85239
85474
|
return void 0;
|
|
85240
85475
|
}
|
|
85476
|
+
// falls through
|
|
85241
85477
|
case 4 /* ThisProperty */:
|
|
85242
85478
|
case 2 /* ModuleExports */:
|
|
85243
85479
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
@@ -85531,6 +85767,7 @@ function createTypeChecker(host) {
|
|
|
85531
85767
|
if (!isThisInTypeQuery(node)) {
|
|
85532
85768
|
return getSymbolOfNameOrPropertyAccessExpression(node);
|
|
85533
85769
|
}
|
|
85770
|
+
// falls through
|
|
85534
85771
|
case 110 /* ThisKeyword */:
|
|
85535
85772
|
const container = getThisContainer(
|
|
85536
85773
|
node,
|
|
@@ -85548,6 +85785,7 @@ function createTypeChecker(host) {
|
|
|
85548
85785
|
if (isInExpressionContext(node)) {
|
|
85549
85786
|
return checkExpression(node).symbol;
|
|
85550
85787
|
}
|
|
85788
|
+
// falls through
|
|
85551
85789
|
case 197 /* ThisType */:
|
|
85552
85790
|
return getTypeFromThisTypeNode(node).symbol;
|
|
85553
85791
|
case 108 /* SuperKeyword */:
|
|
@@ -85570,6 +85808,7 @@ function createTypeChecker(host) {
|
|
|
85570
85808
|
if (isCallExpression(parent) && isBindableObjectDefinePropertyCall(parent) && parent.arguments[1] === node) {
|
|
85571
85809
|
return getSymbolOfDeclaration(parent);
|
|
85572
85810
|
}
|
|
85811
|
+
// falls through
|
|
85573
85812
|
case 9 /* NumericLiteral */:
|
|
85574
85813
|
const objectType = isElementAccessExpression(parent) ? parent.argumentExpression === node ? getTypeOfExpression(parent.expression) : void 0 : isLiteralTypeNode(parent) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
|
|
85575
85814
|
return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
|
|
@@ -85599,6 +85838,7 @@ function createTypeChecker(host) {
|
|
|
85599
85838
|
const symbol = getIntrinsicTagSymbol(node.parent);
|
|
85600
85839
|
return symbol === unknownSymbol ? void 0 : symbol;
|
|
85601
85840
|
}
|
|
85841
|
+
// falls through
|
|
85602
85842
|
default:
|
|
85603
85843
|
return void 0;
|
|
85604
85844
|
}
|
|
@@ -86607,7 +86847,29 @@ function createTypeChecker(host) {
|
|
|
86607
86847
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
86608
86848
|
},
|
|
86609
86849
|
isImportRequiredByAugmentation,
|
|
86610
|
-
isDefinitelyReferenceToGlobalSymbolObject
|
|
86850
|
+
isDefinitelyReferenceToGlobalSymbolObject,
|
|
86851
|
+
createLateBoundIndexSignatures: (cls, enclosing, flags, internalFlags, tracker) => {
|
|
86852
|
+
const sym = cls.symbol;
|
|
86853
|
+
const staticInfos = getIndexInfosOfType(getTypeOfSymbol(sym));
|
|
86854
|
+
const instanceIndexSymbol = getIndexSymbol(sym);
|
|
86855
|
+
const instanceInfos = instanceIndexSymbol && getIndexInfosOfIndexSymbol(instanceIndexSymbol);
|
|
86856
|
+
let result;
|
|
86857
|
+
for (const infoList of [staticInfos, instanceInfos]) {
|
|
86858
|
+
if (!length(infoList)) continue;
|
|
86859
|
+
result || (result = []);
|
|
86860
|
+
for (const info of infoList) {
|
|
86861
|
+
if (info.declaration) continue;
|
|
86862
|
+
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
|
86863
|
+
if (node && infoList === staticInfos) {
|
|
86864
|
+
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
|
86865
|
+
}
|
|
86866
|
+
if (node) {
|
|
86867
|
+
result.push(node);
|
|
86868
|
+
}
|
|
86869
|
+
}
|
|
86870
|
+
}
|
|
86871
|
+
return result;
|
|
86872
|
+
}
|
|
86611
86873
|
};
|
|
86612
86874
|
function isImportRequiredByAugmentation(node) {
|
|
86613
86875
|
const file = getSourceFileOfNode(node);
|
|
@@ -87693,6 +87955,7 @@ function createTypeChecker(host) {
|
|
|
87693
87955
|
);
|
|
87694
87956
|
break;
|
|
87695
87957
|
}
|
|
87958
|
+
// fallthrough
|
|
87696
87959
|
case 7 /* ES2022 */:
|
|
87697
87960
|
case 99 /* ESNext */:
|
|
87698
87961
|
case 200 /* Preserve */:
|
|
@@ -87700,6 +87963,7 @@ function createTypeChecker(host) {
|
|
|
87700
87963
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
87701
87964
|
break;
|
|
87702
87965
|
}
|
|
87966
|
+
// fallthrough
|
|
87703
87967
|
default:
|
|
87704
87968
|
diagnostics.add(
|
|
87705
87969
|
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
|
|
@@ -89876,13 +90140,13 @@ var visitEachChildTable = {
|
|
|
89876
90140
|
);
|
|
89877
90141
|
},
|
|
89878
90142
|
// Transformation nodes
|
|
89879
|
-
[
|
|
90143
|
+
[355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
89880
90144
|
return context.factory.updatePartiallyEmittedExpression(
|
|
89881
90145
|
node,
|
|
89882
90146
|
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
|
|
89883
90147
|
);
|
|
89884
90148
|
},
|
|
89885
|
-
[
|
|
90149
|
+
[356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
89886
90150
|
return context.factory.updateCommaListExpression(
|
|
89887
90151
|
node,
|
|
89888
90152
|
nodesVisitor(node.elements, visitor, isExpression)
|
|
@@ -91806,6 +92070,8 @@ function transformTypeScript(context) {
|
|
|
91806
92070
|
case 148 /* ReadonlyKeyword */:
|
|
91807
92071
|
case 103 /* InKeyword */:
|
|
91808
92072
|
case 147 /* OutKeyword */:
|
|
92073
|
+
// TypeScript accessibility and readonly modifiers are elided
|
|
92074
|
+
// falls through
|
|
91809
92075
|
case 188 /* ArrayType */:
|
|
91810
92076
|
case 189 /* TupleType */:
|
|
91811
92077
|
case 190 /* OptionalType */:
|
|
@@ -91834,6 +92100,8 @@ function transformTypeScript(context) {
|
|
|
91834
92100
|
case 199 /* IndexedAccessType */:
|
|
91835
92101
|
case 200 /* MappedType */:
|
|
91836
92102
|
case 201 /* LiteralType */:
|
|
92103
|
+
// TypeScript type nodes are elided.
|
|
92104
|
+
// falls through
|
|
91837
92105
|
case 181 /* IndexSignature */:
|
|
91838
92106
|
return void 0;
|
|
91839
92107
|
case 265 /* TypeAliasDeclaration */:
|
|
@@ -93041,17 +93309,10 @@ function transformTypeScript(context) {
|
|
|
93041
93309
|
/*modifiers*/
|
|
93042
93310
|
void 0,
|
|
93043
93311
|
importClause,
|
|
93044
|
-
|
|
93312
|
+
node.moduleSpecifier,
|
|
93045
93313
|
node.attributes
|
|
93046
93314
|
) : void 0;
|
|
93047
93315
|
}
|
|
93048
|
-
function rewriteModuleSpecifier(node) {
|
|
93049
|
-
if (!node || !compilerOptions.rewriteRelativeImportExtensions || !isStringLiteral(node) || !pathIsRelative(node.text) || isDeclarationFileName(node.text)) {
|
|
93050
|
-
return node;
|
|
93051
|
-
}
|
|
93052
|
-
const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
|
|
93053
|
-
return updatedText !== node.text ? setOriginalNode(setTextRange(factory2.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
|
|
93054
|
-
}
|
|
93055
93316
|
function visitImportClause(node) {
|
|
93056
93317
|
Debug.assert(!node.isTypeOnly);
|
|
93057
93318
|
const name = shouldEmitAliasDeclaration(node) ? node.name : void 0;
|
|
@@ -93084,14 +93345,7 @@ function transformTypeScript(context) {
|
|
|
93084
93345
|
return void 0;
|
|
93085
93346
|
}
|
|
93086
93347
|
if (!node.exportClause || isNamespaceExport(node.exportClause)) {
|
|
93087
|
-
return
|
|
93088
|
-
node,
|
|
93089
|
-
node.modifiers,
|
|
93090
|
-
node.isTypeOnly,
|
|
93091
|
-
node.exportClause,
|
|
93092
|
-
rewriteModuleSpecifier(node.moduleSpecifier),
|
|
93093
|
-
node.attributes
|
|
93094
|
-
);
|
|
93348
|
+
return node;
|
|
93095
93349
|
}
|
|
93096
93350
|
const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
|
|
93097
93351
|
const exportClause = visitNode(
|
|
@@ -93105,7 +93359,7 @@ function transformTypeScript(context) {
|
|
|
93105
93359
|
void 0,
|
|
93106
93360
|
node.isTypeOnly,
|
|
93107
93361
|
exportClause,
|
|
93108
|
-
|
|
93362
|
+
node.moduleSpecifier,
|
|
93109
93363
|
node.attributes
|
|
93110
93364
|
) : void 0;
|
|
93111
93365
|
}
|
|
@@ -93130,24 +93384,8 @@ function transformTypeScript(context) {
|
|
|
93130
93384
|
return void 0;
|
|
93131
93385
|
}
|
|
93132
93386
|
if (isExternalModuleImportEqualsDeclaration(node)) {
|
|
93133
|
-
|
|
93134
|
-
|
|
93135
|
-
}
|
|
93136
|
-
const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleReference.expression);
|
|
93137
|
-
if (updatedModuleSpecifier !== node.moduleReference.expression) {
|
|
93138
|
-
return visitEachChild(
|
|
93139
|
-
factory2.updateImportEqualsDeclaration(
|
|
93140
|
-
node,
|
|
93141
|
-
node.modifiers,
|
|
93142
|
-
node.isTypeOnly,
|
|
93143
|
-
node.name,
|
|
93144
|
-
factory2.updateExternalModuleReference(node.moduleReference, updatedModuleSpecifier)
|
|
93145
|
-
),
|
|
93146
|
-
visitor,
|
|
93147
|
-
context
|
|
93148
|
-
);
|
|
93149
|
-
}
|
|
93150
|
-
return visitEachChild(node, visitor, context);
|
|
93387
|
+
const isReferenced = shouldEmitAliasDeclaration(node);
|
|
93388
|
+
return isReferenced ? visitEachChild(node, visitor, context) : void 0;
|
|
93151
93389
|
}
|
|
93152
93390
|
if (!shouldEmitImportEqualsDeclaration(node)) {
|
|
93153
93391
|
return void 0;
|
|
@@ -93546,7 +93784,7 @@ function transformClassFields(context) {
|
|
|
93546
93784
|
/*discarded*/
|
|
93547
93785
|
true
|
|
93548
93786
|
);
|
|
93549
|
-
case
|
|
93787
|
+
case 356 /* CommaListExpression */:
|
|
93550
93788
|
return visitCommaListExpression(
|
|
93551
93789
|
node,
|
|
93552
93790
|
/*discarded*/
|
|
@@ -95486,6 +95724,7 @@ function transformClassFields(context) {
|
|
|
95486
95724
|
if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
|
|
95487
95725
|
break;
|
|
95488
95726
|
}
|
|
95727
|
+
// falls through
|
|
95489
95728
|
case 262 /* FunctionDeclaration */:
|
|
95490
95729
|
case 176 /* Constructor */:
|
|
95491
95730
|
case 177 /* GetAccessor */:
|
|
@@ -95761,6 +96000,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
95761
96000
|
case 197 /* ThisType */:
|
|
95762
96001
|
case 205 /* ImportType */:
|
|
95763
96002
|
break;
|
|
96003
|
+
// handle JSDoc types from an invalid parse
|
|
95764
96004
|
case 312 /* JSDocAllType */:
|
|
95765
96005
|
case 313 /* JSDocUnknownType */:
|
|
95766
96006
|
case 317 /* JSDocFunctionType */:
|
|
@@ -96606,6 +96846,7 @@ function transformESDecorators(context) {
|
|
|
96606
96846
|
return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
|
|
96607
96847
|
case 169 /* Parameter */:
|
|
96608
96848
|
return visitParameterDeclaration(node);
|
|
96849
|
+
// Support NamedEvaluation to ensure the correct class name for class expressions.
|
|
96609
96850
|
case 226 /* BinaryExpression */:
|
|
96610
96851
|
return visitBinaryExpression(
|
|
96611
96852
|
node,
|
|
@@ -96626,7 +96867,7 @@ function transformESDecorators(context) {
|
|
|
96626
96867
|
return visitForStatement(node);
|
|
96627
96868
|
case 244 /* ExpressionStatement */:
|
|
96628
96869
|
return visitExpressionStatement(node);
|
|
96629
|
-
case
|
|
96870
|
+
case 356 /* CommaListExpression */:
|
|
96630
96871
|
return visitCommaListExpression(
|
|
96631
96872
|
node,
|
|
96632
96873
|
/*discarded*/
|
|
@@ -96638,7 +96879,7 @@ function transformESDecorators(context) {
|
|
|
96638
96879
|
/*discarded*/
|
|
96639
96880
|
false
|
|
96640
96881
|
);
|
|
96641
|
-
case
|
|
96882
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
96642
96883
|
return visitPartiallyEmittedExpression(
|
|
96643
96884
|
node,
|
|
96644
96885
|
/*discarded*/
|
|
@@ -96662,6 +96903,7 @@ function transformESDecorators(context) {
|
|
|
96662
96903
|
case 167 /* ComputedPropertyName */:
|
|
96663
96904
|
return visitComputedPropertyName(node);
|
|
96664
96905
|
case 174 /* MethodDeclaration */:
|
|
96906
|
+
// object literal methods and accessors
|
|
96665
96907
|
case 178 /* SetAccessor */:
|
|
96666
96908
|
case 177 /* GetAccessor */:
|
|
96667
96909
|
case 218 /* FunctionExpression */:
|
|
@@ -96724,7 +96966,7 @@ function transformESDecorators(context) {
|
|
|
96724
96966
|
/*discarded*/
|
|
96725
96967
|
true
|
|
96726
96968
|
);
|
|
96727
|
-
case
|
|
96969
|
+
case 356 /* CommaListExpression */:
|
|
96728
96970
|
return visitCommaListExpression(
|
|
96729
96971
|
node,
|
|
96730
96972
|
/*discarded*/
|
|
@@ -99306,7 +99548,7 @@ function transformES2018(context) {
|
|
|
99306
99548
|
return visitObjectLiteralExpression(node);
|
|
99307
99549
|
case 226 /* BinaryExpression */:
|
|
99308
99550
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
99309
|
-
case
|
|
99551
|
+
case 356 /* CommaListExpression */:
|
|
99310
99552
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
99311
99553
|
case 299 /* CatchClause */:
|
|
99312
99554
|
return visitCatchClause(node);
|
|
@@ -102446,6 +102688,7 @@ function transformES2015(context) {
|
|
|
102446
102688
|
switch (node.kind) {
|
|
102447
102689
|
case 126 /* StaticKeyword */:
|
|
102448
102690
|
return void 0;
|
|
102691
|
+
// elide static keyword
|
|
102449
102692
|
case 263 /* ClassDeclaration */:
|
|
102450
102693
|
return visitClassDeclaration(node);
|
|
102451
102694
|
case 231 /* ClassExpression */:
|
|
@@ -102524,7 +102767,7 @@ function transformES2015(context) {
|
|
|
102524
102767
|
return visitParenthesizedExpression(node, expressionResultIsUnused2);
|
|
102525
102768
|
case 226 /* BinaryExpression */:
|
|
102526
102769
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
102527
|
-
case
|
|
102770
|
+
case 356 /* CommaListExpression */:
|
|
102528
102771
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
102529
102772
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
102530
102773
|
case 16 /* TemplateHead */:
|
|
@@ -102908,12 +103151,14 @@ function transformES2015(context) {
|
|
|
102908
103151
|
return false;
|
|
102909
103152
|
}
|
|
102910
103153
|
switch (node.kind) {
|
|
103154
|
+
// stop at function boundaries
|
|
102911
103155
|
case 219 /* ArrowFunction */:
|
|
102912
103156
|
case 218 /* FunctionExpression */:
|
|
102913
103157
|
case 262 /* FunctionDeclaration */:
|
|
102914
103158
|
case 176 /* Constructor */:
|
|
102915
103159
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
102916
103160
|
return false;
|
|
103161
|
+
// only step into computed property names for class and object literal elements
|
|
102917
103162
|
case 177 /* GetAccessor */:
|
|
102918
103163
|
case 178 /* SetAccessor */:
|
|
102919
103164
|
case 174 /* MethodDeclaration */:
|
|
@@ -103122,12 +103367,14 @@ function transformES2015(context) {
|
|
|
103122
103367
|
return factory2.createPartiallyEmittedExpression(node.right, node);
|
|
103123
103368
|
}
|
|
103124
103369
|
switch (node.kind) {
|
|
103370
|
+
// stop at function boundaries
|
|
103125
103371
|
case 219 /* ArrowFunction */:
|
|
103126
103372
|
case 218 /* FunctionExpression */:
|
|
103127
103373
|
case 262 /* FunctionDeclaration */:
|
|
103128
103374
|
case 176 /* Constructor */:
|
|
103129
103375
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
103130
103376
|
return node;
|
|
103377
|
+
// only step into computed property names for class and object literal elements
|
|
103131
103378
|
case 177 /* GetAccessor */:
|
|
103132
103379
|
case 178 /* SetAccessor */:
|
|
103133
103380
|
case 174 /* MethodDeclaration */:
|
|
@@ -103173,12 +103420,14 @@ function transformES2015(context) {
|
|
|
103173
103420
|
);
|
|
103174
103421
|
}
|
|
103175
103422
|
switch (node.kind) {
|
|
103423
|
+
// stop at function boundaries
|
|
103176
103424
|
case 219 /* ArrowFunction */:
|
|
103177
103425
|
case 218 /* FunctionExpression */:
|
|
103178
103426
|
case 262 /* FunctionDeclaration */:
|
|
103179
103427
|
case 176 /* Constructor */:
|
|
103180
103428
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
103181
103429
|
return node;
|
|
103430
|
+
// only step into computed property names for class and object literal elements
|
|
103182
103431
|
case 177 /* GetAccessor */:
|
|
103183
103432
|
case 178 /* SetAccessor */:
|
|
103184
103433
|
case 174 /* MethodDeclaration */:
|
|
@@ -105810,7 +106059,7 @@ function transformGenerators(context) {
|
|
|
105810
106059
|
switch (node.kind) {
|
|
105811
106060
|
case 226 /* BinaryExpression */:
|
|
105812
106061
|
return visitBinaryExpression(node);
|
|
105813
|
-
case
|
|
106062
|
+
case 356 /* CommaListExpression */:
|
|
105814
106063
|
return visitCommaListExpression(node);
|
|
105815
106064
|
case 227 /* ConditionalExpression */:
|
|
105816
106065
|
return visitConditionalExpression(node);
|
|
@@ -108201,7 +108450,7 @@ function transformModule(context) {
|
|
|
108201
108450
|
return visitExpressionStatement(node);
|
|
108202
108451
|
case 217 /* ParenthesizedExpression */:
|
|
108203
108452
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
108204
|
-
case
|
|
108453
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
108205
108454
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
108206
108455
|
case 213 /* CallExpression */:
|
|
108207
108456
|
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
@@ -109961,6 +110210,7 @@ function transformSystemModule(context) {
|
|
|
109961
110210
|
if (!entry.importClause) {
|
|
109962
110211
|
break;
|
|
109963
110212
|
}
|
|
110213
|
+
// falls through
|
|
109964
110214
|
case 271 /* ImportEqualsDeclaration */:
|
|
109965
110215
|
Debug.assert(importVariableName !== void 0);
|
|
109966
110216
|
statements.push(
|
|
@@ -110595,7 +110845,7 @@ function transformSystemModule(context) {
|
|
|
110595
110845
|
return visitExpressionStatement(node);
|
|
110596
110846
|
case 217 /* ParenthesizedExpression */:
|
|
110597
110847
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
110598
|
-
case
|
|
110848
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
110599
110849
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
110600
110850
|
case 226 /* BinaryExpression */:
|
|
110601
110851
|
if (isDestructuringAssignment(node)) {
|
|
@@ -112194,6 +112444,7 @@ function transformDeclarations(context) {
|
|
|
112194
112444
|
case 265 /* TypeAliasDeclaration */:
|
|
112195
112445
|
case 266 /* EnumDeclaration */:
|
|
112196
112446
|
return !resolver.isDeclarationVisible(node);
|
|
112447
|
+
// The following should be doing their own visibility checks based on filtering their members
|
|
112197
112448
|
case 260 /* VariableDeclaration */:
|
|
112198
112449
|
return !getBindingNameVisible(node);
|
|
112199
112450
|
case 271 /* ImportEqualsDeclaration */:
|
|
@@ -113088,7 +113339,8 @@ function transformDeclarations(context) {
|
|
|
113088
113339
|
void 0
|
|
113089
113340
|
)
|
|
113090
113341
|
] : void 0;
|
|
113091
|
-
const
|
|
113342
|
+
const lateIndexes = resolver.createLateBoundIndexSignatures(input, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
113343
|
+
const memberNodes = concatenate(concatenate(concatenate(privateIdentifier, lateIndexes), parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
|
|
113092
113344
|
const members = factory2.createNodeArray(memberNodes);
|
|
113093
113345
|
const extendsClause = getEffectiveBaseTypeNode(input);
|
|
113094
113346
|
if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
|
|
@@ -113475,7 +113727,7 @@ function noEmitNotification(hint, node, callback) {
|
|
|
113475
113727
|
}
|
|
113476
113728
|
function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
|
|
113477
113729
|
var _a, _b;
|
|
113478
|
-
const enabledSyntaxKindFeatures = new Array(
|
|
113730
|
+
const enabledSyntaxKindFeatures = new Array(358 /* Count */);
|
|
113479
113731
|
let lexicalEnvironmentVariableDeclarations;
|
|
113480
113732
|
let lexicalEnvironmentFunctionDeclarations;
|
|
113481
113733
|
let lexicalEnvironmentStatements;
|
|
@@ -114393,7 +114645,8 @@ var notImplementedResolver = {
|
|
|
114393
114645
|
isBindingCapturedByNode: notImplemented,
|
|
114394
114646
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
114395
114647
|
isImportRequiredByAugmentation: notImplemented,
|
|
114396
|
-
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
|
|
114648
|
+
isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
|
|
114649
|
+
createLateBoundIndexSignatures: notImplemented
|
|
114397
114650
|
};
|
|
114398
114651
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
114399
114652
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -114678,6 +114931,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114678
114931
|
if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
|
|
114679
114932
|
return pipelineEmitWithNotification;
|
|
114680
114933
|
}
|
|
114934
|
+
// falls through
|
|
114681
114935
|
case 1 /* Substitution */:
|
|
114682
114936
|
if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
|
|
114683
114937
|
if (currentParenthesizerRule) {
|
|
@@ -114685,14 +114939,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114685
114939
|
}
|
|
114686
114940
|
return pipelineEmitWithSubstitution;
|
|
114687
114941
|
}
|
|
114942
|
+
// falls through
|
|
114688
114943
|
case 2 /* Comments */:
|
|
114689
114944
|
if (shouldEmitComments(node)) {
|
|
114690
114945
|
return pipelineEmitWithComments;
|
|
114691
114946
|
}
|
|
114947
|
+
// falls through
|
|
114692
114948
|
case 3 /* SourceMaps */:
|
|
114693
114949
|
if (shouldEmitSourceMaps(node)) {
|
|
114694
114950
|
return pipelineEmitWithSourceMaps;
|
|
114695
114951
|
}
|
|
114952
|
+
// falls through
|
|
114696
114953
|
case 4 /* Emit */:
|
|
114697
114954
|
return pipelineEmitWithHint;
|
|
114698
114955
|
default:
|
|
@@ -114744,6 +115001,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114744
115001
|
}
|
|
114745
115002
|
if (hint === 4 /* Unspecified */) {
|
|
114746
115003
|
switch (node.kind) {
|
|
115004
|
+
// Pseudo-literals
|
|
114747
115005
|
case 16 /* TemplateHead */:
|
|
114748
115006
|
case 17 /* TemplateMiddle */:
|
|
114749
115007
|
case 18 /* TemplateTail */:
|
|
@@ -114752,20 +115010,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114752
115010
|
/*jsxAttributeEscape*/
|
|
114753
115011
|
false
|
|
114754
115012
|
);
|
|
115013
|
+
// Identifiers
|
|
114755
115014
|
case 80 /* Identifier */:
|
|
114756
115015
|
return emitIdentifier(node);
|
|
115016
|
+
// PrivateIdentifiers
|
|
114757
115017
|
case 81 /* PrivateIdentifier */:
|
|
114758
115018
|
return emitPrivateIdentifier(node);
|
|
115019
|
+
// Parse tree nodes
|
|
115020
|
+
// Names
|
|
114759
115021
|
case 166 /* QualifiedName */:
|
|
114760
115022
|
return emitQualifiedName(node);
|
|
114761
115023
|
case 167 /* ComputedPropertyName */:
|
|
114762
115024
|
return emitComputedPropertyName(node);
|
|
115025
|
+
// Signature elements
|
|
114763
115026
|
case 168 /* TypeParameter */:
|
|
114764
115027
|
return emitTypeParameter(node);
|
|
114765
115028
|
case 169 /* Parameter */:
|
|
114766
115029
|
return emitParameter(node);
|
|
114767
115030
|
case 170 /* Decorator */:
|
|
114768
115031
|
return emitDecorator(node);
|
|
115032
|
+
// Type members
|
|
114769
115033
|
case 171 /* PropertySignature */:
|
|
114770
115034
|
return emitPropertySignature(node);
|
|
114771
115035
|
case 172 /* PropertyDeclaration */:
|
|
@@ -114787,6 +115051,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114787
115051
|
return emitConstructSignature(node);
|
|
114788
115052
|
case 181 /* IndexSignature */:
|
|
114789
115053
|
return emitIndexSignature(node);
|
|
115054
|
+
// Types
|
|
114790
115055
|
case 182 /* TypePredicate */:
|
|
114791
115056
|
return emitTypePredicate(node);
|
|
114792
115057
|
case 183 /* TypeReference */:
|
|
@@ -114805,6 +115070,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114805
115070
|
return emitTupleType(node);
|
|
114806
115071
|
case 190 /* OptionalType */:
|
|
114807
115072
|
return emitOptionalType(node);
|
|
115073
|
+
// SyntaxKind.RestType is handled below
|
|
114808
115074
|
case 192 /* UnionType */:
|
|
114809
115075
|
return emitUnionType(node);
|
|
114810
115076
|
case 193 /* IntersectionType */:
|
|
@@ -114835,16 +115101,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114835
115101
|
return emitTemplateTypeSpan(node);
|
|
114836
115102
|
case 205 /* ImportType */:
|
|
114837
115103
|
return emitImportTypeNode(node);
|
|
115104
|
+
// Binding patterns
|
|
114838
115105
|
case 206 /* ObjectBindingPattern */:
|
|
114839
115106
|
return emitObjectBindingPattern(node);
|
|
114840
115107
|
case 207 /* ArrayBindingPattern */:
|
|
114841
115108
|
return emitArrayBindingPattern(node);
|
|
114842
115109
|
case 208 /* BindingElement */:
|
|
114843
115110
|
return emitBindingElement(node);
|
|
115111
|
+
// Misc
|
|
114844
115112
|
case 239 /* TemplateSpan */:
|
|
114845
115113
|
return emitTemplateSpan(node);
|
|
114846
115114
|
case 240 /* SemicolonClassElement */:
|
|
114847
115115
|
return emitSemicolonClassElement();
|
|
115116
|
+
// Statements
|
|
114848
115117
|
case 241 /* Block */:
|
|
114849
115118
|
return emitBlock(node);
|
|
114850
115119
|
case 243 /* VariableStatement */:
|
|
@@ -114886,6 +115155,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114886
115155
|
return emitTryStatement(node);
|
|
114887
115156
|
case 259 /* DebuggerStatement */:
|
|
114888
115157
|
return emitDebuggerStatement(node);
|
|
115158
|
+
// Declarations
|
|
114889
115159
|
case 260 /* VariableDeclaration */:
|
|
114890
115160
|
return emitVariableDeclaration(node);
|
|
114891
115161
|
case 261 /* VariableDeclarationList */:
|
|
@@ -114936,8 +115206,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114936
115206
|
return emitImportAttribute(node);
|
|
114937
115207
|
case 282 /* MissingDeclaration */:
|
|
114938
115208
|
return;
|
|
115209
|
+
// Module references
|
|
114939
115210
|
case 283 /* ExternalModuleReference */:
|
|
114940
115211
|
return emitExternalModuleReference(node);
|
|
115212
|
+
// JSX (non-expression)
|
|
114941
115213
|
case 12 /* JsxText */:
|
|
114942
115214
|
return emitJsxText(node);
|
|
114943
115215
|
case 286 /* JsxOpeningElement */:
|
|
@@ -114956,6 +115228,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114956
115228
|
return emitJsxExpression(node);
|
|
114957
115229
|
case 295 /* JsxNamespacedName */:
|
|
114958
115230
|
return emitJsxNamespacedName(node);
|
|
115231
|
+
// Clauses
|
|
114959
115232
|
case 296 /* CaseClause */:
|
|
114960
115233
|
return emitCaseClause(node);
|
|
114961
115234
|
case 297 /* DefaultClause */:
|
|
@@ -114964,18 +115237,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114964
115237
|
return emitHeritageClause(node);
|
|
114965
115238
|
case 299 /* CatchClause */:
|
|
114966
115239
|
return emitCatchClause(node);
|
|
115240
|
+
// Property assignments
|
|
114967
115241
|
case 303 /* PropertyAssignment */:
|
|
114968
115242
|
return emitPropertyAssignment(node);
|
|
114969
115243
|
case 304 /* ShorthandPropertyAssignment */:
|
|
114970
115244
|
return emitShorthandPropertyAssignment(node);
|
|
114971
115245
|
case 305 /* SpreadAssignment */:
|
|
114972
115246
|
return emitSpreadAssignment(node);
|
|
115247
|
+
// Enum
|
|
114973
115248
|
case 306 /* EnumMember */:
|
|
114974
115249
|
return emitEnumMember(node);
|
|
115250
|
+
// Top-level nodes
|
|
114975
115251
|
case 307 /* SourceFile */:
|
|
114976
115252
|
return emitSourceFile(node);
|
|
114977
115253
|
case 308 /* Bundle */:
|
|
114978
115254
|
return Debug.fail("Bundles should be printed using printBundle");
|
|
115255
|
+
// JSDoc nodes (only used in codefixes currently)
|
|
114979
115256
|
case 309 /* JSDocTypeExpression */:
|
|
114980
115257
|
return emitJSDocTypeExpression(node);
|
|
114981
115258
|
case 310 /* JSDocNameReference */:
|
|
@@ -115013,6 +115290,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115013
115290
|
case 330 /* JSDocAuthorTag */:
|
|
115014
115291
|
case 331 /* JSDocDeprecatedTag */:
|
|
115015
115292
|
return;
|
|
115293
|
+
// SyntaxKind.JSDocClassTag (see JSDocTag, above)
|
|
115016
115294
|
case 333 /* JSDocPublicTag */:
|
|
115017
115295
|
case 334 /* JSDocPrivateTag */:
|
|
115018
115296
|
case 335 /* JSDocProtectedTag */:
|
|
@@ -115022,6 +115300,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115022
115300
|
return emitJSDocCallbackTag(node);
|
|
115023
115301
|
case 339 /* JSDocOverloadTag */:
|
|
115024
115302
|
return emitJSDocOverloadTag(node);
|
|
115303
|
+
// SyntaxKind.JSDocEnumTag (see below)
|
|
115025
115304
|
case 341 /* JSDocParameterTag */:
|
|
115026
115305
|
case 348 /* JSDocPropertyTag */:
|
|
115027
115306
|
return emitJSDocPropertyLikeTag(node);
|
|
@@ -115040,7 +115319,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115040
115319
|
return emitJSDocSeeTag(node);
|
|
115041
115320
|
case 351 /* JSDocImportTag */:
|
|
115042
115321
|
return emitJSDocImportTag(node);
|
|
115322
|
+
// SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
|
|
115323
|
+
// Transformation nodes
|
|
115043
115324
|
case 353 /* NotEmittedStatement */:
|
|
115325
|
+
case 354 /* NotEmittedTypeElement */:
|
|
115044
115326
|
return;
|
|
115045
115327
|
}
|
|
115046
115328
|
if (isExpression(node)) {
|
|
@@ -115058,6 +115340,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115058
115340
|
}
|
|
115059
115341
|
if (hint === 1 /* Expression */) {
|
|
115060
115342
|
switch (node.kind) {
|
|
115343
|
+
// Literals
|
|
115061
115344
|
case 9 /* NumericLiteral */:
|
|
115062
115345
|
case 10 /* BigIntLiteral */:
|
|
115063
115346
|
return emitNumericOrBigIntLiteral(node);
|
|
@@ -115069,10 +115352,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115069
115352
|
/*jsxAttributeEscape*/
|
|
115070
115353
|
false
|
|
115071
115354
|
);
|
|
115355
|
+
// Identifiers
|
|
115072
115356
|
case 80 /* Identifier */:
|
|
115073
115357
|
return emitIdentifier(node);
|
|
115074
115358
|
case 81 /* PrivateIdentifier */:
|
|
115075
115359
|
return emitPrivateIdentifier(node);
|
|
115360
|
+
// Expressions
|
|
115076
115361
|
case 209 /* ArrayLiteralExpression */:
|
|
115077
115362
|
return emitArrayLiteralExpression(node);
|
|
115078
115363
|
case 210 /* ObjectLiteralExpression */:
|
|
@@ -115135,21 +115420,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115135
115420
|
return Debug.fail("SyntheticExpression should never be printed.");
|
|
115136
115421
|
case 282 /* MissingDeclaration */:
|
|
115137
115422
|
return;
|
|
115423
|
+
// JSX
|
|
115138
115424
|
case 284 /* JsxElement */:
|
|
115139
115425
|
return emitJsxElement(node);
|
|
115140
115426
|
case 285 /* JsxSelfClosingElement */:
|
|
115141
115427
|
return emitJsxSelfClosingElement(node);
|
|
115142
115428
|
case 288 /* JsxFragment */:
|
|
115143
115429
|
return emitJsxFragment(node);
|
|
115430
|
+
// Synthesized list
|
|
115144
115431
|
case 352 /* SyntaxList */:
|
|
115145
115432
|
return Debug.fail("SyntaxList should not be printed");
|
|
115433
|
+
// Transformation nodes
|
|
115146
115434
|
case 353 /* NotEmittedStatement */:
|
|
115147
115435
|
return;
|
|
115148
|
-
case
|
|
115436
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
115149
115437
|
return emitPartiallyEmittedExpression(node);
|
|
115150
|
-
case
|
|
115438
|
+
case 356 /* CommaListExpression */:
|
|
115151
115439
|
return emitCommaList(node);
|
|
115152
|
-
case
|
|
115440
|
+
case 357 /* SyntheticReferenceExpression */:
|
|
115153
115441
|
return Debug.fail("SyntheticReferenceExpression should not be printed");
|
|
115154
115442
|
}
|
|
115155
115443
|
}
|
|
@@ -121286,6 +121574,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121286
121574
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
|
121287
121575
|
return "skip";
|
|
121288
121576
|
}
|
|
121577
|
+
// falls through
|
|
121289
121578
|
case 173 /* MethodSignature */:
|
|
121290
121579
|
case 176 /* Constructor */:
|
|
121291
121580
|
case 177 /* GetAccessor */:
|
|
@@ -121417,6 +121706,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121417
121706
|
diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
|
|
121418
121707
|
return "skip";
|
|
121419
121708
|
}
|
|
121709
|
+
// falls through
|
|
121420
121710
|
case 243 /* VariableStatement */:
|
|
121421
121711
|
if (nodes === parent.modifiers) {
|
|
121422
121712
|
checkModifiers(parent.modifiers, parent.kind === 243 /* VariableStatement */);
|
|
@@ -121459,6 +121749,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121459
121749
|
if (isConstValid) {
|
|
121460
121750
|
continue;
|
|
121461
121751
|
}
|
|
121752
|
+
// to report error,
|
|
121753
|
+
// falls through
|
|
121462
121754
|
case 125 /* PublicKeyword */:
|
|
121463
121755
|
case 123 /* PrivateKeyword */:
|
|
121464
121756
|
case 124 /* ProtectedKeyword */:
|
|
@@ -121470,6 +121762,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121470
121762
|
case 147 /* OutKeyword */:
|
|
121471
121763
|
diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
|
121472
121764
|
break;
|
|
121765
|
+
// These are all legal modifiers.
|
|
121473
121766
|
case 126 /* StaticKeyword */:
|
|
121474
121767
|
case 95 /* ExportKeyword */:
|
|
121475
121768
|
case 90 /* DefaultKeyword */:
|
|
@@ -122516,7 +122809,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122516
122809
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
122517
122810
|
}
|
|
122518
122811
|
}
|
|
122519
|
-
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly
|
|
122812
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
122520
122813
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
122521
122814
|
}
|
|
122522
122815
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
@@ -126875,6 +127168,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
|
|
|
126875
127168
|
if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
|
|
126876
127169
|
pos--;
|
|
126877
127170
|
}
|
|
127171
|
+
// falls through
|
|
126878
127172
|
case 13 /* carriageReturn */:
|
|
126879
127173
|
break;
|
|
126880
127174
|
default:
|
|
@@ -128361,6 +128655,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
128361
128655
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
128362
128656
|
step++;
|
|
128363
128657
|
break;
|
|
128658
|
+
// Should never be done
|
|
128364
128659
|
case 3 /* Done */:
|
|
128365
128660
|
default:
|
|
128366
128661
|
assertType(step);
|
|
@@ -128901,6 +129196,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
128901
129196
|
status.type = 2 /* UpToDateWithUpstreamTypes */;
|
|
128902
129197
|
break;
|
|
128903
129198
|
}
|
|
129199
|
+
// falls through
|
|
128904
129200
|
case 15 /* UpToDateWithInputFileText */:
|
|
128905
129201
|
case 2 /* UpToDateWithUpstreamTypes */:
|
|
128906
129202
|
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
|
|
@@ -129418,6 +129714,8 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
129418
129714
|
relName(state, configFileName)
|
|
129419
129715
|
);
|
|
129420
129716
|
case 16 /* ContainerOnly */:
|
|
129717
|
+
// Don't report status on "solution" projects
|
|
129718
|
+
// falls through
|
|
129421
129719
|
case 13 /* ComputingUpstream */:
|
|
129422
129720
|
break;
|
|
129423
129721
|
default:
|