typescript 5.7.0-dev.20240830 → 5.7.0-dev.20240831
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +329 -58
- package/lib/typescript.d.ts +9 -4
- package/lib/typescript.js +477 -62
- package/package.json +17 -17
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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240831`;
|
|
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 */:
|
|
@@ -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
|
|
@@ -8135,6 +8140,7 @@ function computeLineStarts(text) {
|
|
|
8135
8140
|
if (text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
8136
8141
|
pos++;
|
|
8137
8142
|
}
|
|
8143
|
+
// falls through
|
|
8138
8144
|
case 10 /* lineFeed */:
|
|
8139
8145
|
result.push(lineStart);
|
|
8140
8146
|
lineStart = pos;
|
|
@@ -8239,6 +8245,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
|
|
|
8239
8245
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
8240
8246
|
pos++;
|
|
8241
8247
|
}
|
|
8248
|
+
// falls through
|
|
8242
8249
|
case 10 /* lineFeed */:
|
|
8243
8250
|
pos++;
|
|
8244
8251
|
if (stopAfterLineBreak) {
|
|
@@ -8385,6 +8392,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
|
|
|
8385
8392
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
8386
8393
|
pos++;
|
|
8387
8394
|
}
|
|
8395
|
+
// falls through
|
|
8388
8396
|
case 10 /* lineFeed */:
|
|
8389
8397
|
pos++;
|
|
8390
8398
|
if (trailing) {
|
|
@@ -8950,12 +8958,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8950
8958
|
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
8951
8959
|
return "\0";
|
|
8952
8960
|
}
|
|
8961
|
+
// '\01', '\011'
|
|
8962
|
+
// falls through
|
|
8953
8963
|
case 49 /* _1 */:
|
|
8954
8964
|
case 50 /* _2 */:
|
|
8955
8965
|
case 51 /* _3 */:
|
|
8956
8966
|
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
8957
8967
|
pos++;
|
|
8958
8968
|
}
|
|
8969
|
+
// '\17', '\177'
|
|
8970
|
+
// falls through
|
|
8959
8971
|
case 52 /* _4 */:
|
|
8960
8972
|
case 53 /* _5 */:
|
|
8961
8973
|
case 54 /* _6 */:
|
|
@@ -9053,10 +9065,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9053
9065
|
}
|
|
9054
9066
|
tokenFlags |= 4096 /* HexEscape */;
|
|
9055
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".
|
|
9056
9070
|
case 13 /* carriageReturn */:
|
|
9057
9071
|
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
9058
9072
|
pos++;
|
|
9059
9073
|
}
|
|
9074
|
+
// falls through
|
|
9060
9075
|
case 10 /* lineFeed */:
|
|
9061
9076
|
case 8232 /* lineSeparator */:
|
|
9062
9077
|
case 8233 /* paragraphSeparator */:
|
|
@@ -9487,6 +9502,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9487
9502
|
tokenFlags |= 256 /* OctalSpecifier */;
|
|
9488
9503
|
return token = checkBigIntSuffix();
|
|
9489
9504
|
}
|
|
9505
|
+
// falls through
|
|
9490
9506
|
case 49 /* _1 */:
|
|
9491
9507
|
case 50 /* _2 */:
|
|
9492
9508
|
case 51 /* _3 */:
|
|
@@ -10006,6 +10022,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10006
10022
|
break;
|
|
10007
10023
|
}
|
|
10008
10024
|
}
|
|
10025
|
+
// falls through
|
|
10009
10026
|
case 42 /* asterisk */:
|
|
10010
10027
|
case 43 /* plus */:
|
|
10011
10028
|
case 63 /* question */:
|
|
@@ -10036,6 +10053,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10036
10053
|
if (isInGroup) {
|
|
10037
10054
|
return;
|
|
10038
10055
|
}
|
|
10056
|
+
// falls through
|
|
10039
10057
|
case 93 /* closeBracket */:
|
|
10040
10058
|
case 125 /* closeBrace */:
|
|
10041
10059
|
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
@@ -10098,6 +10116,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10098
10116
|
error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
10099
10117
|
break;
|
|
10100
10118
|
}
|
|
10119
|
+
// falls through
|
|
10101
10120
|
default:
|
|
10102
10121
|
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
10103
10122
|
/*atomEscape*/
|
|
@@ -10235,6 +10254,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10235
10254
|
let start2 = pos;
|
|
10236
10255
|
let operand;
|
|
10237
10256
|
switch (text.slice(pos, pos + 2)) {
|
|
10257
|
+
// TODO: don't use slice
|
|
10238
10258
|
case "--":
|
|
10239
10259
|
case "&&":
|
|
10240
10260
|
error(Diagnostics.Expected_a_class_set_operand);
|
|
@@ -10340,6 +10360,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10340
10360
|
}
|
|
10341
10361
|
start2 = pos;
|
|
10342
10362
|
switch (text.slice(pos, pos + 2)) {
|
|
10363
|
+
// TODO: don't use slice
|
|
10343
10364
|
case "--":
|
|
10344
10365
|
case "&&":
|
|
10345
10366
|
error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
@@ -10437,6 +10458,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10437
10458
|
}
|
|
10438
10459
|
}
|
|
10439
10460
|
pos--;
|
|
10461
|
+
// falls through
|
|
10440
10462
|
default:
|
|
10441
10463
|
return scanClassSetCharacter();
|
|
10442
10464
|
}
|
|
@@ -10583,6 +10605,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10583
10605
|
return true;
|
|
10584
10606
|
case 80 /* P */:
|
|
10585
10607
|
isCharacterComplement = true;
|
|
10608
|
+
// falls through
|
|
10586
10609
|
case 112 /* p */:
|
|
10587
10610
|
pos++;
|
|
10588
10611
|
if (charCodeChecked(pos) === 123 /* openBrace */) {
|
|
@@ -10890,6 +10913,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10890
10913
|
if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
10891
10914
|
pos++;
|
|
10892
10915
|
}
|
|
10916
|
+
// falls through
|
|
10893
10917
|
case 10 /* lineFeed */:
|
|
10894
10918
|
tokenFlags |= 1 /* PrecedingLineBreak */;
|
|
10895
10919
|
return token = 4 /* NewLineTrivia */;
|
|
@@ -11116,6 +11140,7 @@ function getDefaultLibFileName(options) {
|
|
|
11116
11140
|
return "lib.es2016.full.d.ts";
|
|
11117
11141
|
case 2 /* ES2015 */:
|
|
11118
11142
|
return "lib.es6.d.ts";
|
|
11143
|
+
// We don't use lib.es2015.full.d.ts due to breaking change.
|
|
11119
11144
|
default:
|
|
11120
11145
|
return "lib.d.ts";
|
|
11121
11146
|
}
|
|
@@ -11915,7 +11940,7 @@ function isModifierLike(node) {
|
|
|
11915
11940
|
}
|
|
11916
11941
|
function isTypeElement(node) {
|
|
11917
11942
|
const kind = node.kind;
|
|
11918
|
-
return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */;
|
|
11943
|
+
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 */;
|
|
11919
11944
|
}
|
|
11920
11945
|
function isObjectLiteralElementLike(node) {
|
|
11921
11946
|
const kind = node.kind;
|
|
@@ -11974,7 +11999,9 @@ function isObjectBindingOrAssignmentElement(node) {
|
|
|
11974
11999
|
switch (node.kind) {
|
|
11975
12000
|
case 208 /* BindingElement */:
|
|
11976
12001
|
case 303 /* PropertyAssignment */:
|
|
12002
|
+
// AssignmentProperty
|
|
11977
12003
|
case 304 /* ShorthandPropertyAssignment */:
|
|
12004
|
+
// AssignmentProperty
|
|
11978
12005
|
case 305 /* SpreadAssignment */:
|
|
11979
12006
|
return true;
|
|
11980
12007
|
}
|
|
@@ -11992,11 +12019,17 @@ function isArrayBindingOrAssignmentElement(node) {
|
|
|
11992
12019
|
switch (node.kind) {
|
|
11993
12020
|
case 208 /* BindingElement */:
|
|
11994
12021
|
case 232 /* OmittedExpression */:
|
|
12022
|
+
// Elision
|
|
11995
12023
|
case 230 /* SpreadElement */:
|
|
12024
|
+
// AssignmentRestElement
|
|
11996
12025
|
case 209 /* ArrayLiteralExpression */:
|
|
12026
|
+
// ArrayAssignmentPattern
|
|
11997
12027
|
case 210 /* ObjectLiteralExpression */:
|
|
12028
|
+
// ObjectAssignmentPattern
|
|
11998
12029
|
case 80 /* Identifier */:
|
|
12030
|
+
// DestructuringAssignmentTarget
|
|
11999
12031
|
case 211 /* PropertyAccessExpression */:
|
|
12032
|
+
// DestructuringAssignmentTarget
|
|
12000
12033
|
case 212 /* ElementAccessExpression */:
|
|
12001
12034
|
return true;
|
|
12002
12035
|
}
|
|
@@ -12057,6 +12090,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
12057
12090
|
case 218 /* FunctionExpression */:
|
|
12058
12091
|
case 80 /* Identifier */:
|
|
12059
12092
|
case 81 /* PrivateIdentifier */:
|
|
12093
|
+
// technically this is only an Expression if it's in a `#field in expr` BinaryExpression
|
|
12060
12094
|
case 14 /* RegularExpressionLiteral */:
|
|
12061
12095
|
case 9 /* NumericLiteral */:
|
|
12062
12096
|
case 10 /* BigIntLiteral */:
|
|
@@ -12072,6 +12106,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
12072
12106
|
case 233 /* ExpressionWithTypeArguments */:
|
|
12073
12107
|
case 236 /* MetaProperty */:
|
|
12074
12108
|
case 102 /* ImportKeyword */:
|
|
12109
|
+
// technically this is only an Expression if it's in a CallExpression
|
|
12075
12110
|
case 282 /* MissingDeclaration */:
|
|
12076
12111
|
return true;
|
|
12077
12112
|
default:
|
|
@@ -12118,8 +12153,8 @@ function isExpressionKind(kind) {
|
|
|
12118
12153
|
case 230 /* SpreadElement */:
|
|
12119
12154
|
case 234 /* AsExpression */:
|
|
12120
12155
|
case 232 /* OmittedExpression */:
|
|
12121
|
-
case
|
|
12122
|
-
case
|
|
12156
|
+
case 356 /* CommaListExpression */:
|
|
12157
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
12123
12158
|
case 238 /* SatisfiesExpression */:
|
|
12124
12159
|
return true;
|
|
12125
12160
|
default:
|
|
@@ -13738,6 +13773,8 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
13738
13773
|
}
|
|
13739
13774
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
13740
13775
|
}
|
|
13776
|
+
// This list is a work in progress. Add missing node kinds to improve their error
|
|
13777
|
+
// spans.
|
|
13741
13778
|
case 260 /* VariableDeclaration */:
|
|
13742
13779
|
case 208 /* BindingElement */:
|
|
13743
13780
|
case 263 /* ClassDeclaration */:
|
|
@@ -13909,6 +13946,8 @@ function isPartOfTypeNode(node) {
|
|
|
13909
13946
|
return isPartOfTypeExpressionWithTypeArguments(node);
|
|
13910
13947
|
case 168 /* TypeParameter */:
|
|
13911
13948
|
return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
|
|
13949
|
+
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
13950
|
+
// above them to find the lowest container
|
|
13912
13951
|
case 80 /* Identifier */:
|
|
13913
13952
|
if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
|
|
13914
13953
|
node = node.parent;
|
|
@@ -13916,6 +13955,7 @@ function isPartOfTypeNode(node) {
|
|
|
13916
13955
|
node = node.parent;
|
|
13917
13956
|
}
|
|
13918
13957
|
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'.");
|
|
13958
|
+
// falls through
|
|
13919
13959
|
case 166 /* QualifiedName */:
|
|
13920
13960
|
case 211 /* PropertyAccessExpression */:
|
|
13921
13961
|
case 110 /* ThisKeyword */: {
|
|
@@ -14181,6 +14221,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
14181
14221
|
if (!includeArrowFunctions) {
|
|
14182
14222
|
continue;
|
|
14183
14223
|
}
|
|
14224
|
+
// falls through
|
|
14184
14225
|
case 262 /* FunctionDeclaration */:
|
|
14185
14226
|
case 218 /* FunctionExpression */:
|
|
14186
14227
|
case 267 /* ModuleDeclaration */:
|
|
@@ -14203,6 +14244,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
14203
14244
|
}
|
|
14204
14245
|
function isThisContainerOrFunctionBlock(node) {
|
|
14205
14246
|
switch (node.kind) {
|
|
14247
|
+
// Arrow functions use the same scope, but may do so in a "delayed" manner
|
|
14248
|
+
// For example, `const getThis = () => this` may be before a super() call in a derived constructor
|
|
14206
14249
|
case 219 /* ArrowFunction */:
|
|
14207
14250
|
case 262 /* FunctionDeclaration */:
|
|
14208
14251
|
case 218 /* FunctionExpression */:
|
|
@@ -14269,6 +14312,7 @@ function getSuperContainer(node, stopOnFunctions) {
|
|
|
14269
14312
|
if (!stopOnFunctions) {
|
|
14270
14313
|
continue;
|
|
14271
14314
|
}
|
|
14315
|
+
// falls through
|
|
14272
14316
|
case 172 /* PropertyDeclaration */:
|
|
14273
14317
|
case 171 /* PropertySignature */:
|
|
14274
14318
|
case 174 /* MethodDeclaration */:
|
|
@@ -14322,6 +14366,7 @@ function getEntityNameFromTypeNode(node) {
|
|
|
14322
14366
|
return node.typeName;
|
|
14323
14367
|
case 233 /* ExpressionWithTypeArguments */:
|
|
14324
14368
|
return isEntityNameExpression(node.expression) ? node.expression : void 0;
|
|
14369
|
+
// 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.
|
|
14325
14370
|
case 80 /* Identifier */:
|
|
14326
14371
|
case 166 /* QualifiedName */:
|
|
14327
14372
|
return node;
|
|
@@ -14486,6 +14531,7 @@ function isExpressionNode(node) {
|
|
|
14486
14531
|
if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
|
|
14487
14532
|
return true;
|
|
14488
14533
|
}
|
|
14534
|
+
// falls through
|
|
14489
14535
|
case 9 /* NumericLiteral */:
|
|
14490
14536
|
case 10 /* BigIntLiteral */:
|
|
14491
14537
|
case 11 /* StringLiteral */:
|
|
@@ -15490,6 +15536,7 @@ function getFunctionFlags(node) {
|
|
|
15490
15536
|
if (node.asteriskToken) {
|
|
15491
15537
|
flags |= 1 /* Generator */;
|
|
15492
15538
|
}
|
|
15539
|
+
// falls through
|
|
15493
15540
|
case 219 /* ArrowFunction */:
|
|
15494
15541
|
if (hasSyntacticModifier(node, 1024 /* Async */)) {
|
|
15495
15542
|
flags |= 2 /* Async */;
|
|
@@ -15724,7 +15771,7 @@ function getOperator(expression) {
|
|
|
15724
15771
|
}
|
|
15725
15772
|
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
15726
15773
|
switch (nodeKind) {
|
|
15727
|
-
case
|
|
15774
|
+
case 356 /* CommaListExpression */:
|
|
15728
15775
|
return 0 /* Comma */;
|
|
15729
15776
|
case 230 /* SpreadElement */:
|
|
15730
15777
|
return 1 /* Spread */;
|
|
@@ -15756,6 +15803,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
|
15756
15803
|
default:
|
|
15757
15804
|
return getBinaryOperatorPrecedence(operatorKind);
|
|
15758
15805
|
}
|
|
15806
|
+
// TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
|
|
15759
15807
|
case 216 /* TypeAssertionExpression */:
|
|
15760
15808
|
case 235 /* NonNullExpression */:
|
|
15761
15809
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -17254,11 +17302,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
|
17254
17302
|
if (stopAtCallExpressions) {
|
|
17255
17303
|
return node;
|
|
17256
17304
|
}
|
|
17305
|
+
// falls through
|
|
17257
17306
|
case 234 /* AsExpression */:
|
|
17258
17307
|
case 212 /* ElementAccessExpression */:
|
|
17259
17308
|
case 211 /* PropertyAccessExpression */:
|
|
17260
17309
|
case 235 /* NonNullExpression */:
|
|
17261
|
-
case
|
|
17310
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
17262
17311
|
case 238 /* SatisfiesExpression */:
|
|
17263
17312
|
node = node.expression;
|
|
17264
17313
|
continue;
|
|
@@ -18532,6 +18581,7 @@ function isJsonEqual(a, b) {
|
|
|
18532
18581
|
function parsePseudoBigInt(stringValue) {
|
|
18533
18582
|
let log2Base;
|
|
18534
18583
|
switch (stringValue.charCodeAt(1)) {
|
|
18584
|
+
// "x" in "0x123"
|
|
18535
18585
|
case 98 /* b */:
|
|
18536
18586
|
case 66 /* B */:
|
|
18537
18587
|
log2Base = 1;
|
|
@@ -18769,7 +18819,7 @@ function getContainingNodeArray(node) {
|
|
|
18769
18819
|
return parent.types;
|
|
18770
18820
|
case 189 /* TupleType */:
|
|
18771
18821
|
case 209 /* ArrayLiteralExpression */:
|
|
18772
|
-
case
|
|
18822
|
+
case 356 /* CommaListExpression */:
|
|
18773
18823
|
case 275 /* NamedImports */:
|
|
18774
18824
|
case 279 /* NamedExports */:
|
|
18775
18825
|
return parent.elements;
|
|
@@ -19202,6 +19252,7 @@ function createNameResolver({
|
|
|
19202
19252
|
switch (location.kind) {
|
|
19203
19253
|
case 307 /* SourceFile */:
|
|
19204
19254
|
if (!isExternalOrCommonJsModule(location)) break;
|
|
19255
|
+
// falls through
|
|
19205
19256
|
case 267 /* ModuleDeclaration */:
|
|
19206
19257
|
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
19207
19258
|
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
@@ -19285,6 +19336,14 @@ function createNameResolver({
|
|
|
19285
19336
|
}
|
|
19286
19337
|
}
|
|
19287
19338
|
break;
|
|
19339
|
+
// It is not legal to reference a class's own type parameters from a computed property name that
|
|
19340
|
+
// belongs to the class. For example:
|
|
19341
|
+
//
|
|
19342
|
+
// function foo<T>() { return '' }
|
|
19343
|
+
// class C<T> { // <-- Class's own type parameter T
|
|
19344
|
+
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
|
|
19345
|
+
// }
|
|
19346
|
+
//
|
|
19288
19347
|
case 167 /* ComputedPropertyName */:
|
|
19289
19348
|
grandparent = location.parent.parent;
|
|
19290
19349
|
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
@@ -19300,6 +19359,7 @@ function createNameResolver({
|
|
|
19300
19359
|
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
19301
19360
|
break;
|
|
19302
19361
|
}
|
|
19362
|
+
// falls through
|
|
19303
19363
|
case 174 /* MethodDeclaration */:
|
|
19304
19364
|
case 176 /* Constructor */:
|
|
19305
19365
|
case 177 /* GetAccessor */:
|
|
@@ -19944,6 +20004,7 @@ function createParenthesizerRules(factory2) {
|
|
|
19944
20004
|
function parenthesizeConstituentTypeOfUnionType(type) {
|
|
19945
20005
|
switch (type.kind) {
|
|
19946
20006
|
case 192 /* UnionType */:
|
|
20007
|
+
// Not strictly necessary, but a union containing a union should have been flattened
|
|
19947
20008
|
case 193 /* IntersectionType */:
|
|
19948
20009
|
return factory2.createParenthesizedType(type);
|
|
19949
20010
|
}
|
|
@@ -20714,6 +20775,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20714
20775
|
createSyntheticExpression,
|
|
20715
20776
|
createSyntaxList,
|
|
20716
20777
|
createNotEmittedStatement,
|
|
20778
|
+
createNotEmittedTypeElement,
|
|
20717
20779
|
createPartiallyEmittedExpression,
|
|
20718
20780
|
updatePartiallyEmittedExpression,
|
|
20719
20781
|
createCommaListExpression,
|
|
@@ -23740,7 +23802,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23740
23802
|
return node;
|
|
23741
23803
|
}
|
|
23742
23804
|
function createPartiallyEmittedExpression(expression, original) {
|
|
23743
|
-
const node = createBaseNode(
|
|
23805
|
+
const node = createBaseNode(355 /* PartiallyEmittedExpression */);
|
|
23744
23806
|
node.expression = expression;
|
|
23745
23807
|
node.original = original;
|
|
23746
23808
|
node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
|
|
@@ -23750,6 +23812,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23750
23812
|
function updatePartiallyEmittedExpression(node, expression) {
|
|
23751
23813
|
return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
|
|
23752
23814
|
}
|
|
23815
|
+
function createNotEmittedTypeElement() {
|
|
23816
|
+
return createBaseNode(354 /* NotEmittedTypeElement */);
|
|
23817
|
+
}
|
|
23753
23818
|
function flattenCommaElements(node) {
|
|
23754
23819
|
if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
|
|
23755
23820
|
if (isCommaListExpression(node)) {
|
|
@@ -23762,7 +23827,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23762
23827
|
return node;
|
|
23763
23828
|
}
|
|
23764
23829
|
function createCommaListExpression(elements) {
|
|
23765
|
-
const node = createBaseNode(
|
|
23830
|
+
const node = createBaseNode(356 /* CommaListExpression */);
|
|
23766
23831
|
node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
|
|
23767
23832
|
node.transformFlags |= propagateChildrenFlags(node.elements);
|
|
23768
23833
|
return node;
|
|
@@ -23771,7 +23836,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23771
23836
|
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
|
|
23772
23837
|
}
|
|
23773
23838
|
function createSyntheticReferenceExpression(expression, thisArg) {
|
|
23774
|
-
const node = createBaseNode(
|
|
23839
|
+
const node = createBaseNode(357 /* SyntheticReferenceExpression */);
|
|
23775
23840
|
node.expression = expression;
|
|
23776
23841
|
node.thisArg = thisArg;
|
|
23777
23842
|
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
|
|
@@ -24018,7 +24083,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
24018
24083
|
return updateNonNullExpression(outerExpression, expression);
|
|
24019
24084
|
case 233 /* ExpressionWithTypeArguments */:
|
|
24020
24085
|
return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
|
|
24021
|
-
case
|
|
24086
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
24022
24087
|
return updatePartiallyEmittedExpression(outerExpression, expression);
|
|
24023
24088
|
}
|
|
24024
24089
|
}
|
|
@@ -24563,7 +24628,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
|
|
|
24563
24628
|
case 216 /* TypeAssertionExpression */:
|
|
24564
24629
|
case 238 /* SatisfiesExpression */:
|
|
24565
24630
|
case 234 /* AsExpression */:
|
|
24566
|
-
case
|
|
24631
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
24567
24632
|
case 217 /* ParenthesizedExpression */:
|
|
24568
24633
|
case 108 /* SuperKeyword */:
|
|
24569
24634
|
return -2147483648 /* OuterExpressionExcludes */;
|
|
@@ -26204,10 +26269,10 @@ function isMetaProperty(node) {
|
|
|
26204
26269
|
return node.kind === 236 /* MetaProperty */;
|
|
26205
26270
|
}
|
|
26206
26271
|
function isPartiallyEmittedExpression(node) {
|
|
26207
|
-
return node.kind ===
|
|
26272
|
+
return node.kind === 355 /* PartiallyEmittedExpression */;
|
|
26208
26273
|
}
|
|
26209
26274
|
function isCommaListExpression(node) {
|
|
26210
|
-
return node.kind ===
|
|
26275
|
+
return node.kind === 356 /* CommaListExpression */;
|
|
26211
26276
|
}
|
|
26212
26277
|
function isTemplateSpan(node) {
|
|
26213
26278
|
return node.kind === 239 /* TemplateSpan */;
|
|
@@ -26336,7 +26401,7 @@ function isNotEmittedStatement(node) {
|
|
|
26336
26401
|
return node.kind === 353 /* NotEmittedStatement */;
|
|
26337
26402
|
}
|
|
26338
26403
|
function isSyntheticReference(node) {
|
|
26339
|
-
return node.kind ===
|
|
26404
|
+
return node.kind === 357 /* SyntheticReferenceExpression */;
|
|
26340
26405
|
}
|
|
26341
26406
|
function isExternalModuleReference(node) {
|
|
26342
26407
|
return node.kind === 283 /* ExternalModuleReference */;
|
|
@@ -26917,7 +26982,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
|
26917
26982
|
return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
|
|
26918
26983
|
case 235 /* NonNullExpression */:
|
|
26919
26984
|
return (kinds & 4 /* NonNullAssertions */) !== 0;
|
|
26920
|
-
case
|
|
26985
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
26921
26986
|
return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
|
|
26922
26987
|
}
|
|
26923
26988
|
return false;
|
|
@@ -27357,10 +27422,13 @@ var BinaryExpressionState;
|
|
|
27357
27422
|
switch (currentState) {
|
|
27358
27423
|
case enter:
|
|
27359
27424
|
if (machine.onLeft) return left;
|
|
27425
|
+
// falls through
|
|
27360
27426
|
case left:
|
|
27361
27427
|
if (machine.onOperator) return operator;
|
|
27428
|
+
// falls through
|
|
27362
27429
|
case operator:
|
|
27363
27430
|
if (machine.onRight) return right;
|
|
27431
|
+
// falls through
|
|
27364
27432
|
case right:
|
|
27365
27433
|
return exit;
|
|
27366
27434
|
case exit:
|
|
@@ -27988,7 +28056,7 @@ var forEachChildTable = {
|
|
|
27988
28056
|
[282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
|
|
27989
28057
|
return visitNodes(cbNode, cbNodes, node.modifiers);
|
|
27990
28058
|
},
|
|
27991
|
-
[
|
|
28059
|
+
[356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
|
|
27992
28060
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
27993
28061
|
},
|
|
27994
28062
|
[284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
|
|
@@ -28084,7 +28152,7 @@ var forEachChildTable = {
|
|
|
28084
28152
|
[331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
|
|
28085
28153
|
[337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
|
|
28086
28154
|
[351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
|
|
28087
|
-
[
|
|
28155
|
+
[355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
|
|
28088
28156
|
};
|
|
28089
28157
|
function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
|
|
28090
28158
|
return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
|
|
@@ -28439,6 +28507,7 @@ var Parser;
|
|
|
28439
28507
|
expression2 = parseLiteralNode();
|
|
28440
28508
|
break;
|
|
28441
28509
|
}
|
|
28510
|
+
// falls through
|
|
28442
28511
|
default:
|
|
28443
28512
|
expression2 = parseObjectLiteralExpression();
|
|
28444
28513
|
break;
|
|
@@ -29360,6 +29429,7 @@ var Parser;
|
|
|
29360
29429
|
case 25 /* DotToken */:
|
|
29361
29430
|
return true;
|
|
29362
29431
|
}
|
|
29432
|
+
// falls through
|
|
29363
29433
|
case 11 /* ArgumentExpressions */:
|
|
29364
29434
|
return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
|
|
29365
29435
|
case 16 /* Parameters */:
|
|
@@ -29393,6 +29463,7 @@ var Parser;
|
|
|
29393
29463
|
return true;
|
|
29394
29464
|
case 26 /* Count */:
|
|
29395
29465
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
29466
|
+
// Not a real context, only a marker.
|
|
29396
29467
|
default:
|
|
29397
29468
|
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
|
|
29398
29469
|
}
|
|
@@ -29709,6 +29780,7 @@ var Parser;
|
|
|
29709
29780
|
case 3 /* SwitchClauseStatements */:
|
|
29710
29781
|
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
|
|
29711
29782
|
case 18 /* RestProperties */:
|
|
29783
|
+
// fallthrough
|
|
29712
29784
|
case 4 /* TypeMembers */:
|
|
29713
29785
|
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
|
|
29714
29786
|
case 5 /* ClassMembers */:
|
|
@@ -29756,6 +29828,7 @@ var Parser;
|
|
|
29756
29828
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
29757
29829
|
case 26 /* Count */:
|
|
29758
29830
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
29831
|
+
// Not a real context, only a marker.
|
|
29759
29832
|
default:
|
|
29760
29833
|
Debug.assertNever(context);
|
|
29761
29834
|
}
|
|
@@ -30680,10 +30753,12 @@ var Parser;
|
|
|
30680
30753
|
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
|
|
30681
30754
|
case 67 /* AsteriskEqualsToken */:
|
|
30682
30755
|
scanner.reScanAsteriskEqualsToken();
|
|
30756
|
+
// falls through
|
|
30683
30757
|
case 42 /* AsteriskToken */:
|
|
30684
30758
|
return parseJSDocAllType();
|
|
30685
30759
|
case 61 /* QuestionQuestionToken */:
|
|
30686
30760
|
scanner.reScanQuestionToken();
|
|
30761
|
+
// falls through
|
|
30687
30762
|
case 58 /* QuestionToken */:
|
|
30688
30763
|
return parseJSDocUnknownOrNullableType();
|
|
30689
30764
|
case 100 /* FunctionKeyword */:
|
|
@@ -31561,6 +31636,7 @@ var Parser;
|
|
|
31561
31636
|
if (isAwaitExpression2()) {
|
|
31562
31637
|
return parseAwaitExpression();
|
|
31563
31638
|
}
|
|
31639
|
+
// falls through
|
|
31564
31640
|
default:
|
|
31565
31641
|
return parseUpdateExpression();
|
|
31566
31642
|
}
|
|
@@ -31580,6 +31656,8 @@ var Parser;
|
|
|
31580
31656
|
if (languageVariant !== 1 /* JSX */) {
|
|
31581
31657
|
return false;
|
|
31582
31658
|
}
|
|
31659
|
+
// We are in JSX context and the token is part of JSXElement.
|
|
31660
|
+
// falls through
|
|
31583
31661
|
default:
|
|
31584
31662
|
return true;
|
|
31585
31663
|
}
|
|
@@ -32153,10 +32231,16 @@ var Parser;
|
|
|
32153
32231
|
}
|
|
32154
32232
|
function canFollowTypeArgumentsInExpression() {
|
|
32155
32233
|
switch (token()) {
|
|
32234
|
+
// These tokens can follow a type argument list in a call expression.
|
|
32156
32235
|
case 21 /* OpenParenToken */:
|
|
32236
|
+
// foo<x>(
|
|
32157
32237
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
32238
|
+
// foo<T> `...`
|
|
32158
32239
|
case 16 /* TemplateHead */:
|
|
32159
32240
|
return true;
|
|
32241
|
+
// A type argument list followed by `<` never makes sense, and a type argument list followed
|
|
32242
|
+
// by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
|
|
32243
|
+
// this context, `+` and `-` are unary operators, not binary operators.
|
|
32160
32244
|
case 30 /* LessThanToken */:
|
|
32161
32245
|
case 32 /* GreaterThanToken */:
|
|
32162
32246
|
case 40 /* PlusToken */:
|
|
@@ -32174,6 +32258,7 @@ var Parser;
|
|
|
32174
32258
|
false
|
|
32175
32259
|
);
|
|
32176
32260
|
}
|
|
32261
|
+
// falls through
|
|
32177
32262
|
case 9 /* NumericLiteral */:
|
|
32178
32263
|
case 10 /* BigIntLiteral */:
|
|
32179
32264
|
case 11 /* StringLiteral */:
|
|
@@ -32677,6 +32762,27 @@ var Parser;
|
|
|
32677
32762
|
return isUsingDeclaration();
|
|
32678
32763
|
case 135 /* AwaitKeyword */:
|
|
32679
32764
|
return isAwaitUsingDeclaration();
|
|
32765
|
+
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
|
|
32766
|
+
// however, an identifier cannot be followed by another identifier on the same line. This is what we
|
|
32767
|
+
// count on to parse out the respective declarations. For instance, we exploit this to say that
|
|
32768
|
+
//
|
|
32769
|
+
// namespace n
|
|
32770
|
+
//
|
|
32771
|
+
// can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
|
|
32772
|
+
//
|
|
32773
|
+
// namespace
|
|
32774
|
+
// n
|
|
32775
|
+
//
|
|
32776
|
+
// as the identifier 'namespace' on one line followed by the identifier 'n' on another.
|
|
32777
|
+
// We need to look one token ahead to see if it permissible to try parsing a declaration.
|
|
32778
|
+
//
|
|
32779
|
+
// *Note*: 'interface' is actually a strict mode reserved word. So while
|
|
32780
|
+
//
|
|
32781
|
+
// "use strict"
|
|
32782
|
+
// interface
|
|
32783
|
+
// I {}
|
|
32784
|
+
//
|
|
32785
|
+
// could be legal, it would add complexity for very little gain.
|
|
32680
32786
|
case 120 /* InterfaceKeyword */:
|
|
32681
32787
|
case 156 /* TypeKeyword */:
|
|
32682
32788
|
return nextTokenIsIdentifierOnSameLine();
|
|
@@ -32749,6 +32855,9 @@ var Parser;
|
|
|
32749
32855
|
case 111 /* ThrowKeyword */:
|
|
32750
32856
|
case 113 /* TryKeyword */:
|
|
32751
32857
|
case 89 /* DebuggerKeyword */:
|
|
32858
|
+
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
|
|
32859
|
+
// however, we say they are here so that we may gracefully parse them and error later.
|
|
32860
|
+
// falls through
|
|
32752
32861
|
case 85 /* CatchKeyword */:
|
|
32753
32862
|
case 98 /* FinallyKeyword */:
|
|
32754
32863
|
return true;
|
|
@@ -32887,6 +32996,8 @@ var Parser;
|
|
|
32887
32996
|
case 111 /* ThrowKeyword */:
|
|
32888
32997
|
return parseThrowStatement();
|
|
32889
32998
|
case 113 /* TryKeyword */:
|
|
32999
|
+
// Include 'catch' and 'finally' for error recovery.
|
|
33000
|
+
// falls through
|
|
32890
33001
|
case 85 /* CatchKeyword */:
|
|
32891
33002
|
case 98 /* FinallyKeyword */:
|
|
32892
33003
|
return parseTryStatement();
|
|
@@ -33305,10 +33416,15 @@ var Parser;
|
|
|
33305
33416
|
}
|
|
33306
33417
|
switch (token()) {
|
|
33307
33418
|
case 21 /* OpenParenToken */:
|
|
33419
|
+
// Method declaration
|
|
33308
33420
|
case 30 /* LessThanToken */:
|
|
33421
|
+
// Generic Method declaration
|
|
33309
33422
|
case 54 /* ExclamationToken */:
|
|
33423
|
+
// Non-null assertion on property name
|
|
33310
33424
|
case 59 /* ColonToken */:
|
|
33425
|
+
// Type Annotation for declaration
|
|
33311
33426
|
case 64 /* EqualsToken */:
|
|
33427
|
+
// Initializer for declaration
|
|
33312
33428
|
case 58 /* QuestionToken */:
|
|
33313
33429
|
return true;
|
|
33314
33430
|
default:
|
|
@@ -34215,6 +34331,7 @@ var Parser;
|
|
|
34215
34331
|
linkEnd = scanner.getTokenEnd();
|
|
34216
34332
|
break;
|
|
34217
34333
|
}
|
|
34334
|
+
// fallthrough if it's not a {@link sequence
|
|
34218
34335
|
default:
|
|
34219
34336
|
state = 2 /* SavingComments */;
|
|
34220
34337
|
pushComment(scanner.getTokenText());
|
|
@@ -34473,6 +34590,8 @@ var Parser;
|
|
|
34473
34590
|
indent2 += 1;
|
|
34474
34591
|
break;
|
|
34475
34592
|
}
|
|
34593
|
+
// record the * as a comment
|
|
34594
|
+
// falls through
|
|
34476
34595
|
default:
|
|
34477
34596
|
if (state !== 3 /* SavingBackticks */) {
|
|
34478
34597
|
state = 2 /* SavingComments */;
|
|
@@ -35553,6 +35672,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
|
|
|
35553
35672
|
case "jsximportsource":
|
|
35554
35673
|
case "jsxruntime":
|
|
35555
35674
|
return;
|
|
35675
|
+
// Accessed directly
|
|
35556
35676
|
default:
|
|
35557
35677
|
Debug.fail("Unhandled pragma kind");
|
|
35558
35678
|
}
|
|
@@ -37406,6 +37526,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
|
|
|
37406
37526
|
case "listOrElement":
|
|
37407
37527
|
Debug.fail("listOrElement not supported here");
|
|
37408
37528
|
break;
|
|
37529
|
+
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
|
37409
37530
|
default:
|
|
37410
37531
|
options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
|
|
37411
37532
|
i++;
|
|
@@ -37739,6 +37860,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
|
|
|
37739
37860
|
return false;
|
|
37740
37861
|
case 106 /* NullKeyword */:
|
|
37741
37862
|
return null;
|
|
37863
|
+
// eslint-disable-line no-restricted-syntax
|
|
37742
37864
|
case 11 /* StringLiteral */:
|
|
37743
37865
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
37744
37866
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
@@ -41370,20 +41492,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
|
|
|
41370
41492
|
}
|
|
41371
41493
|
function getModuleInstanceStateWorker(node, visited) {
|
|
41372
41494
|
switch (node.kind) {
|
|
41495
|
+
// 1. interface declarations, type alias declarations
|
|
41373
41496
|
case 264 /* InterfaceDeclaration */:
|
|
41374
41497
|
case 265 /* TypeAliasDeclaration */:
|
|
41375
41498
|
return 0 /* NonInstantiated */;
|
|
41499
|
+
// 2. const enum declarations
|
|
41376
41500
|
case 266 /* EnumDeclaration */:
|
|
41377
41501
|
if (isEnumConst(node)) {
|
|
41378
41502
|
return 2 /* ConstEnumOnly */;
|
|
41379
41503
|
}
|
|
41380
41504
|
break;
|
|
41505
|
+
// 3. non-exported import declarations
|
|
41381
41506
|
case 272 /* ImportDeclaration */:
|
|
41382
41507
|
case 271 /* ImportEqualsDeclaration */:
|
|
41383
41508
|
if (!hasSyntacticModifier(node, 32 /* Export */)) {
|
|
41384
41509
|
return 0 /* NonInstantiated */;
|
|
41385
41510
|
}
|
|
41386
41511
|
break;
|
|
41512
|
+
// 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
|
|
41387
41513
|
case 278 /* ExportDeclaration */:
|
|
41388
41514
|
const exportDeclaration = node;
|
|
41389
41515
|
if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
|
|
@@ -41400,6 +41526,7 @@ function getModuleInstanceStateWorker(node, visited) {
|
|
|
41400
41526
|
return state;
|
|
41401
41527
|
}
|
|
41402
41528
|
break;
|
|
41529
|
+
// 5. other uninstantiated module declarations.
|
|
41403
41530
|
case 268 /* ModuleBlock */: {
|
|
41404
41531
|
let state = 0 /* NonInstantiated */;
|
|
41405
41532
|
forEachChild(node, (n) => {
|
|
@@ -41998,6 +42125,7 @@ function createBinder() {
|
|
|
41998
42125
|
case 351 /* JSDocImportTag */:
|
|
41999
42126
|
bindJSDocImportTag(node);
|
|
42000
42127
|
break;
|
|
42128
|
+
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
|
|
42001
42129
|
case 307 /* SourceFile */: {
|
|
42002
42130
|
bindEachFunctionsFirst(node.statements);
|
|
42003
42131
|
bind(node.endOfFileToken);
|
|
@@ -42018,6 +42146,7 @@ function createBinder() {
|
|
|
42018
42146
|
case 303 /* PropertyAssignment */:
|
|
42019
42147
|
case 230 /* SpreadElement */:
|
|
42020
42148
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
42149
|
+
// falls through
|
|
42021
42150
|
default:
|
|
42022
42151
|
bindEachChild(node);
|
|
42023
42152
|
break;
|
|
@@ -42039,6 +42168,7 @@ function createBinder() {
|
|
|
42039
42168
|
if (isJSDocTypeAssertion(expr)) {
|
|
42040
42169
|
return false;
|
|
42041
42170
|
}
|
|
42171
|
+
// fallthrough
|
|
42042
42172
|
case 235 /* NonNullExpression */:
|
|
42043
42173
|
return isNarrowingExpression(expr.expression);
|
|
42044
42174
|
case 226 /* BinaryExpression */:
|
|
@@ -42870,6 +43000,10 @@ function createBinder() {
|
|
|
42870
43000
|
}
|
|
42871
43001
|
function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
|
|
42872
43002
|
switch (container.kind) {
|
|
43003
|
+
// Modules, source files, and classes need specialized handling for how their
|
|
43004
|
+
// members are declared (for example, a member of a class will go into a specific
|
|
43005
|
+
// symbol table depending on if it is static or not). We defer to specialized
|
|
43006
|
+
// handlers to take care of declaring these child members.
|
|
42873
43007
|
case 267 /* ModuleDeclaration */:
|
|
42874
43008
|
return declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
42875
43009
|
case 307 /* SourceFile */:
|
|
@@ -43011,6 +43145,7 @@ function createBinder() {
|
|
|
43011
43145
|
declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
43012
43146
|
break;
|
|
43013
43147
|
}
|
|
43148
|
+
// falls through
|
|
43014
43149
|
default:
|
|
43015
43150
|
Debug.assertNode(blockScopeContainer, canHaveLocals);
|
|
43016
43151
|
if (!blockScopeContainer.locals) {
|
|
@@ -43331,6 +43466,7 @@ function createBinder() {
|
|
|
43331
43466
|
}
|
|
43332
43467
|
function bindWorker(node) {
|
|
43333
43468
|
switch (node.kind) {
|
|
43469
|
+
/* Strict mode checks */
|
|
43334
43470
|
case 80 /* Identifier */:
|
|
43335
43471
|
if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
|
|
43336
43472
|
let parentNode = node.parent;
|
|
@@ -43340,6 +43476,7 @@ function createBinder() {
|
|
|
43340
43476
|
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
|
43341
43477
|
break;
|
|
43342
43478
|
}
|
|
43479
|
+
// falls through
|
|
43343
43480
|
case 110 /* ThisKeyword */:
|
|
43344
43481
|
if (currentFlow && (isExpression(node) || parent.kind === 304 /* ShorthandPropertyAssignment */)) {
|
|
43345
43482
|
node.flowNode = currentFlow;
|
|
@@ -43428,6 +43565,7 @@ function createBinder() {
|
|
|
43428
43565
|
return;
|
|
43429
43566
|
case 182 /* TypePredicate */:
|
|
43430
43567
|
break;
|
|
43568
|
+
// Binding the children will handle everything
|
|
43431
43569
|
case 168 /* TypeParameter */:
|
|
43432
43570
|
return bindTypeParameter(node);
|
|
43433
43571
|
case 169 /* Parameter */:
|
|
@@ -43492,6 +43630,7 @@ function createBinder() {
|
|
|
43492
43630
|
return bindObjectDefinePrototypeProperty(node);
|
|
43493
43631
|
case 0 /* None */:
|
|
43494
43632
|
break;
|
|
43633
|
+
// Nothing to do
|
|
43495
43634
|
default:
|
|
43496
43635
|
return Debug.fail("Unknown call expression assignment declaration kind");
|
|
43497
43636
|
}
|
|
@@ -43499,6 +43638,7 @@ function createBinder() {
|
|
|
43499
43638
|
bindCallExpression(node);
|
|
43500
43639
|
}
|
|
43501
43640
|
break;
|
|
43641
|
+
// Members of classes, interfaces, and modules
|
|
43502
43642
|
case 231 /* ClassExpression */:
|
|
43503
43643
|
case 263 /* ClassDeclaration */:
|
|
43504
43644
|
inStrictMode = true;
|
|
@@ -43511,10 +43651,12 @@ function createBinder() {
|
|
|
43511
43651
|
return bindEnumDeclaration(node);
|
|
43512
43652
|
case 267 /* ModuleDeclaration */:
|
|
43513
43653
|
return bindModuleDeclaration(node);
|
|
43654
|
+
// Jsx-attributes
|
|
43514
43655
|
case 292 /* JsxAttributes */:
|
|
43515
43656
|
return bindJsxAttributes(node);
|
|
43516
43657
|
case 291 /* JsxAttribute */:
|
|
43517
43658
|
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
|
43659
|
+
// Imports and exports
|
|
43518
43660
|
case 271 /* ImportEqualsDeclaration */:
|
|
43519
43661
|
case 274 /* NamespaceImport */:
|
|
43520
43662
|
case 276 /* ImportSpecifier */:
|
|
@@ -43535,6 +43677,7 @@ function createBinder() {
|
|
|
43535
43677
|
if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
|
|
43536
43678
|
return;
|
|
43537
43679
|
}
|
|
43680
|
+
// falls through
|
|
43538
43681
|
case 268 /* ModuleBlock */:
|
|
43539
43682
|
return updateStrictModeStatementList(node.statements);
|
|
43540
43683
|
case 341 /* JSDocParameterTag */:
|
|
@@ -43544,6 +43687,7 @@ function createBinder() {
|
|
|
43544
43687
|
if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
|
|
43545
43688
|
break;
|
|
43546
43689
|
}
|
|
43690
|
+
// falls through
|
|
43547
43691
|
case 348 /* JSDocPropertyTag */:
|
|
43548
43692
|
const propTag = node;
|
|
43549
43693
|
const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
|
|
@@ -43756,6 +43900,7 @@ function createBinder() {
|
|
|
43756
43900
|
declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
|
|
43757
43901
|
}
|
|
43758
43902
|
break;
|
|
43903
|
+
// Namespaces are not allowed in javascript files, so do nothing here
|
|
43759
43904
|
case 267 /* ModuleDeclaration */:
|
|
43760
43905
|
break;
|
|
43761
43906
|
default:
|
|
@@ -44252,6 +44397,7 @@ function getContainerFlags(node) {
|
|
|
44252
44397
|
if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
|
|
44253
44398
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
|
|
44254
44399
|
}
|
|
44400
|
+
// falls through
|
|
44255
44401
|
case 176 /* Constructor */:
|
|
44256
44402
|
case 262 /* FunctionDeclaration */:
|
|
44257
44403
|
case 173 /* MethodSignature */:
|
|
@@ -47305,6 +47451,7 @@ function createTypeChecker(host) {
|
|
|
47305
47451
|
if (isEntityNameExpression(node.expression)) {
|
|
47306
47452
|
return node.expression;
|
|
47307
47453
|
}
|
|
47454
|
+
// falls through
|
|
47308
47455
|
default:
|
|
47309
47456
|
return void 0;
|
|
47310
47457
|
}
|
|
@@ -49160,6 +49307,7 @@ function createTypeChecker(host) {
|
|
|
49160
49307
|
if (!isExternalOrCommonJsModule(location)) {
|
|
49161
49308
|
break;
|
|
49162
49309
|
}
|
|
49310
|
+
// falls through
|
|
49163
49311
|
case 267 /* ModuleDeclaration */:
|
|
49164
49312
|
const sym = getSymbolOfDeclaration(location);
|
|
49165
49313
|
if (result = callback(
|
|
@@ -50582,6 +50730,9 @@ function createTypeChecker(host) {
|
|
|
50582
50730
|
}
|
|
50583
50731
|
function createTypeNodesFromResolvedType(resolvedType) {
|
|
50584
50732
|
if (checkTruncationLength(context)) {
|
|
50733
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
50734
|
+
return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
|
|
50735
|
+
}
|
|
50585
50736
|
return [factory.createPropertySignature(
|
|
50586
50737
|
/*modifiers*/
|
|
50587
50738
|
void 0,
|
|
@@ -50619,15 +50770,20 @@ function createTypeChecker(host) {
|
|
|
50619
50770
|
}
|
|
50620
50771
|
}
|
|
50621
50772
|
if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
|
|
50622
|
-
|
|
50623
|
-
|
|
50624
|
-
|
|
50625
|
-
|
|
50626
|
-
|
|
50627
|
-
|
|
50628
|
-
|
|
50629
|
-
|
|
50630
|
-
|
|
50773
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
50774
|
+
const typeElement = typeElements.pop();
|
|
50775
|
+
typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
|
|
50776
|
+
} else {
|
|
50777
|
+
typeElements.push(factory.createPropertySignature(
|
|
50778
|
+
/*modifiers*/
|
|
50779
|
+
void 0,
|
|
50780
|
+
`... ${properties.length - i} more ...`,
|
|
50781
|
+
/*questionToken*/
|
|
50782
|
+
void 0,
|
|
50783
|
+
/*type*/
|
|
50784
|
+
void 0
|
|
50785
|
+
));
|
|
50786
|
+
}
|
|
50631
50787
|
addPropertyToElementList(properties[properties.length - 1], context, typeElements);
|
|
50632
50788
|
break;
|
|
50633
50789
|
}
|
|
@@ -50645,7 +50801,7 @@ function createTypeChecker(host) {
|
|
|
50645
50801
|
void 0
|
|
50646
50802
|
);
|
|
50647
50803
|
}
|
|
50648
|
-
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50804
|
+
return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
|
|
50649
50805
|
}
|
|
50650
50806
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
50651
50807
|
var _a;
|
|
@@ -50781,15 +50937,17 @@ function createTypeChecker(host) {
|
|
|
50781
50937
|
if (some(types)) {
|
|
50782
50938
|
if (checkTruncationLength(context)) {
|
|
50783
50939
|
if (!isBareList) {
|
|
50784
|
-
return [
|
|
50785
|
-
"
|
|
50786
|
-
|
|
50787
|
-
|
|
50788
|
-
|
|
50940
|
+
return [
|
|
50941
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
|
|
50942
|
+
"...",
|
|
50943
|
+
/*typeArguments*/
|
|
50944
|
+
void 0
|
|
50945
|
+
)
|
|
50946
|
+
];
|
|
50789
50947
|
} else if (types.length > 2) {
|
|
50790
50948
|
return [
|
|
50791
50949
|
typeToTypeNodeHelper(types[0], context),
|
|
50792
|
-
factory.createTypeReferenceNode(
|
|
50950
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
|
|
50793
50951
|
`... ${types.length - 2} more ...`,
|
|
50794
50952
|
/*typeArguments*/
|
|
50795
50953
|
void 0
|
|
@@ -50805,11 +50963,13 @@ function createTypeChecker(host) {
|
|
|
50805
50963
|
for (const type of types) {
|
|
50806
50964
|
i++;
|
|
50807
50965
|
if (checkTruncationLength(context) && i + 2 < types.length - 1) {
|
|
50808
|
-
result.push(
|
|
50809
|
-
`... ${types.length - i} more
|
|
50810
|
-
|
|
50811
|
-
|
|
50812
|
-
|
|
50966
|
+
result.push(
|
|
50967
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
|
|
50968
|
+
`... ${types.length - i} more ...`,
|
|
50969
|
+
/*typeArguments*/
|
|
50970
|
+
void 0
|
|
50971
|
+
)
|
|
50972
|
+
);
|
|
50813
50973
|
const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
|
|
50814
50974
|
if (typeNode2) {
|
|
50815
50975
|
result.push(typeNode2);
|
|
@@ -53404,6 +53564,7 @@ function createTypeChecker(host) {
|
|
|
53404
53564
|
);
|
|
53405
53565
|
break;
|
|
53406
53566
|
}
|
|
53567
|
+
// else fall through and treat commonjs require just like import=
|
|
53407
53568
|
case 271 /* ImportEqualsDeclaration */:
|
|
53408
53569
|
if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
|
|
53409
53570
|
serializeMaybeAliasAssignment(symbol);
|
|
@@ -54176,6 +54337,7 @@ function createTypeChecker(host) {
|
|
|
54176
54337
|
if (isBindingPattern(node.name) && !node.name.elements.length) {
|
|
54177
54338
|
return false;
|
|
54178
54339
|
}
|
|
54340
|
+
// falls through
|
|
54179
54341
|
case 267 /* ModuleDeclaration */:
|
|
54180
54342
|
case 263 /* ClassDeclaration */:
|
|
54181
54343
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -54200,6 +54362,8 @@ function createTypeChecker(host) {
|
|
|
54200
54362
|
if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
|
|
54201
54363
|
return false;
|
|
54202
54364
|
}
|
|
54365
|
+
// Public properties/methods are visible if its parents are visible, so:
|
|
54366
|
+
// falls through
|
|
54203
54367
|
case 176 /* Constructor */:
|
|
54204
54368
|
case 180 /* ConstructSignature */:
|
|
54205
54369
|
case 179 /* CallSignature */:
|
|
@@ -54217,14 +54381,20 @@ function createTypeChecker(host) {
|
|
|
54217
54381
|
case 196 /* ParenthesizedType */:
|
|
54218
54382
|
case 202 /* NamedTupleMember */:
|
|
54219
54383
|
return isDeclarationVisible(node.parent);
|
|
54384
|
+
// Default binding, import specifier and namespace import is visible
|
|
54385
|
+
// only on demand so by default it is not visible
|
|
54220
54386
|
case 273 /* ImportClause */:
|
|
54221
54387
|
case 274 /* NamespaceImport */:
|
|
54222
54388
|
case 276 /* ImportSpecifier */:
|
|
54223
54389
|
return false;
|
|
54390
|
+
// Type parameters are always visible
|
|
54224
54391
|
case 168 /* TypeParameter */:
|
|
54392
|
+
// Source file and namespace export are always visible
|
|
54393
|
+
// falls through
|
|
54225
54394
|
case 307 /* SourceFile */:
|
|
54226
54395
|
case 270 /* NamespaceExportDeclaration */:
|
|
54227
54396
|
return true;
|
|
54397
|
+
// Export assignments do not create name bindings outside the module
|
|
54228
54398
|
case 277 /* ExportAssignment */:
|
|
54229
54399
|
return false;
|
|
54230
54400
|
default:
|
|
@@ -61774,6 +61944,9 @@ function createTypeChecker(host) {
|
|
|
61774
61944
|
return getTypeFromTemplateTypeNode(node);
|
|
61775
61945
|
case 205 /* ImportType */:
|
|
61776
61946
|
return getTypeFromImportTypeNode(node);
|
|
61947
|
+
// This function assumes that an identifier, qualified name, or property access expression is a type expression
|
|
61948
|
+
// Callers should first ensure this by calling `isPartOfTypeNode`
|
|
61949
|
+
// 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.
|
|
61777
61950
|
case 80 /* Identifier */:
|
|
61778
61951
|
case 166 /* QualifiedName */:
|
|
61779
61952
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -62021,6 +62194,7 @@ function createTypeChecker(host) {
|
|
|
62021
62194
|
return !!tp.isThisType;
|
|
62022
62195
|
case 80 /* Identifier */:
|
|
62023
62196
|
return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
|
|
62197
|
+
// use worker because we're looking for === equality
|
|
62024
62198
|
case 186 /* TypeQuery */:
|
|
62025
62199
|
const entityName = node2.exprName;
|
|
62026
62200
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
@@ -62440,6 +62614,7 @@ function createTypeChecker(host) {
|
|
|
62440
62614
|
if (!isConstAssertion(node)) {
|
|
62441
62615
|
break;
|
|
62442
62616
|
}
|
|
62617
|
+
// fallthrough
|
|
62443
62618
|
case 294 /* JsxExpression */:
|
|
62444
62619
|
case 217 /* ParenthesizedExpression */:
|
|
62445
62620
|
return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
|
|
@@ -67759,6 +67934,7 @@ function createTypeChecker(host) {
|
|
|
67759
67934
|
if (isCallExpression(node.parent)) {
|
|
67760
67935
|
return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
|
|
67761
67936
|
}
|
|
67937
|
+
// falls through
|
|
67762
67938
|
default:
|
|
67763
67939
|
if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
67764
67940
|
return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
|
|
@@ -67792,6 +67968,7 @@ function createTypeChecker(host) {
|
|
|
67792
67968
|
const symbol = getResolvedSymbol(node);
|
|
67793
67969
|
return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
|
|
67794
67970
|
}
|
|
67971
|
+
// falls through
|
|
67795
67972
|
case 110 /* ThisKeyword */:
|
|
67796
67973
|
return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
|
|
67797
67974
|
case 235 /* NonNullExpression */:
|
|
@@ -69345,6 +69522,9 @@ function createTypeChecker(host) {
|
|
|
69345
69522
|
break;
|
|
69346
69523
|
case 28 /* CommaToken */:
|
|
69347
69524
|
return narrowType(type, expr.right, assumeTrue);
|
|
69525
|
+
// Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
|
|
69526
|
+
// expressions down to individual conditional control flows. However, we may encounter them when analyzing
|
|
69527
|
+
// aliased conditional expressions.
|
|
69348
69528
|
case 56 /* AmpersandAmpersandToken */:
|
|
69349
69529
|
return assumeTrue ? narrowType(
|
|
69350
69530
|
narrowType(
|
|
@@ -69788,6 +69968,7 @@ function createTypeChecker(host) {
|
|
|
69788
69968
|
}
|
|
69789
69969
|
}
|
|
69790
69970
|
}
|
|
69971
|
+
// falls through
|
|
69791
69972
|
case 110 /* ThisKeyword */:
|
|
69792
69973
|
case 108 /* SuperKeyword */:
|
|
69793
69974
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -77606,6 +77787,7 @@ function createTypeChecker(host) {
|
|
|
77606
77787
|
hasError = true;
|
|
77607
77788
|
break;
|
|
77608
77789
|
}
|
|
77790
|
+
// fallthrough
|
|
77609
77791
|
case 7 /* ES2022 */:
|
|
77610
77792
|
case 99 /* ESNext */:
|
|
77611
77793
|
case 200 /* Preserve */:
|
|
@@ -77613,6 +77795,7 @@ function createTypeChecker(host) {
|
|
|
77613
77795
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
77614
77796
|
break;
|
|
77615
77797
|
}
|
|
77798
|
+
// fallthrough
|
|
77616
77799
|
default:
|
|
77617
77800
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
77618
77801
|
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;
|
|
@@ -78030,9 +78213,13 @@ function createTypeChecker(host) {
|
|
|
78030
78213
|
return true;
|
|
78031
78214
|
}
|
|
78032
78215
|
return false;
|
|
78216
|
+
// Some forms listed here for clarity
|
|
78033
78217
|
case 222 /* VoidExpression */:
|
|
78218
|
+
// Explicit opt-out
|
|
78034
78219
|
case 216 /* TypeAssertionExpression */:
|
|
78220
|
+
// Not SEF, but can produce useful type warnings
|
|
78035
78221
|
case 234 /* AsExpression */:
|
|
78222
|
+
// Not SEF, but can produce useful type warnings
|
|
78036
78223
|
default:
|
|
78037
78224
|
return false;
|
|
78038
78225
|
}
|
|
@@ -79278,6 +79465,7 @@ function createTypeChecker(host) {
|
|
|
79278
79465
|
if (node.expression.kind === 102 /* ImportKeyword */) {
|
|
79279
79466
|
return checkImportCallExpression(node);
|
|
79280
79467
|
}
|
|
79468
|
+
// falls through
|
|
79281
79469
|
case 214 /* NewExpression */:
|
|
79282
79470
|
return checkCallExpression(node, checkMode);
|
|
79283
79471
|
case 215 /* TaggedTemplateExpression */:
|
|
@@ -79647,6 +79835,7 @@ function createTypeChecker(host) {
|
|
|
79647
79835
|
if (useDefineForClassFields) {
|
|
79648
79836
|
break;
|
|
79649
79837
|
}
|
|
79838
|
+
// fall through
|
|
79650
79839
|
case "prototype":
|
|
79651
79840
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
79652
79841
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
@@ -80390,6 +80579,8 @@ function createTypeChecker(host) {
|
|
|
80390
80579
|
switch (d.kind) {
|
|
80391
80580
|
case 264 /* InterfaceDeclaration */:
|
|
80392
80581
|
case 265 /* TypeAliasDeclaration */:
|
|
80582
|
+
// A jsdoc typedef and callback are, by definition, type aliases.
|
|
80583
|
+
// falls through
|
|
80393
80584
|
case 346 /* JSDocTypedefTag */:
|
|
80394
80585
|
case 338 /* JSDocCallbackTag */:
|
|
80395
80586
|
case 340 /* JSDocEnumTag */:
|
|
@@ -80410,6 +80601,8 @@ function createTypeChecker(host) {
|
|
|
80410
80601
|
return 1 /* ExportValue */;
|
|
80411
80602
|
}
|
|
80412
80603
|
d = expression;
|
|
80604
|
+
// The below options all declare an Alias, which is allowed to merge with other values within the importing module.
|
|
80605
|
+
// falls through
|
|
80413
80606
|
case 271 /* ImportEqualsDeclaration */:
|
|
80414
80607
|
case 274 /* NamespaceImport */:
|
|
80415
80608
|
case 273 /* ImportClause */:
|
|
@@ -80423,6 +80616,7 @@ function createTypeChecker(host) {
|
|
|
80423
80616
|
case 208 /* BindingElement */:
|
|
80424
80617
|
case 262 /* FunctionDeclaration */:
|
|
80425
80618
|
case 276 /* ImportSpecifier */:
|
|
80619
|
+
// https://github.com/Microsoft/TypeScript/pull/7591
|
|
80426
80620
|
case 80 /* Identifier */:
|
|
80427
80621
|
return 1 /* ExportValue */;
|
|
80428
80622
|
case 173 /* MethodSignature */:
|
|
@@ -80771,6 +80965,7 @@ function createTypeChecker(host) {
|
|
|
80771
80965
|
headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
80772
80966
|
break;
|
|
80773
80967
|
}
|
|
80968
|
+
// falls through
|
|
80774
80969
|
case 169 /* Parameter */:
|
|
80775
80970
|
headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
80776
80971
|
break;
|
|
@@ -83992,6 +84187,7 @@ function createTypeChecker(host) {
|
|
|
83992
84187
|
break;
|
|
83993
84188
|
case 271 /* ImportEqualsDeclaration */:
|
|
83994
84189
|
if (isInternalModuleImportEqualsDeclaration(node)) break;
|
|
84190
|
+
// falls through
|
|
83995
84191
|
case 272 /* ImportDeclaration */:
|
|
83996
84192
|
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
|
|
83997
84193
|
break;
|
|
@@ -84004,6 +84200,7 @@ function createTypeChecker(host) {
|
|
|
84004
84200
|
}
|
|
84005
84201
|
break;
|
|
84006
84202
|
}
|
|
84203
|
+
// falls through
|
|
84007
84204
|
case 263 /* ClassDeclaration */:
|
|
84008
84205
|
case 266 /* EnumDeclaration */:
|
|
84009
84206
|
case 262 /* FunctionDeclaration */:
|
|
@@ -84680,6 +84877,7 @@ function createTypeChecker(host) {
|
|
|
84680
84877
|
return checkJSDocPropertyTag(node);
|
|
84681
84878
|
case 317 /* JSDocFunctionType */:
|
|
84682
84879
|
checkJSDocFunctionType(node);
|
|
84880
|
+
// falls through
|
|
84683
84881
|
case 315 /* JSDocNonNullableType */:
|
|
84684
84882
|
case 314 /* JSDocNullableType */:
|
|
84685
84883
|
case 312 /* JSDocAllType */:
|
|
@@ -85103,6 +85301,7 @@ function createTypeChecker(host) {
|
|
|
85103
85301
|
switch (location.kind) {
|
|
85104
85302
|
case 307 /* SourceFile */:
|
|
85105
85303
|
if (!isExternalModule(location)) break;
|
|
85304
|
+
// falls through
|
|
85106
85305
|
case 267 /* ModuleDeclaration */:
|
|
85107
85306
|
copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
|
|
85108
85307
|
break;
|
|
@@ -85114,6 +85313,9 @@ function createTypeChecker(host) {
|
|
|
85114
85313
|
if (className) {
|
|
85115
85314
|
copySymbol(location.symbol, meaning);
|
|
85116
85315
|
}
|
|
85316
|
+
// this fall-through is necessary because we would like to handle
|
|
85317
|
+
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
|
|
85318
|
+
// falls through
|
|
85117
85319
|
case 263 /* ClassDeclaration */:
|
|
85118
85320
|
case 264 /* InterfaceDeclaration */:
|
|
85119
85321
|
if (!isStaticSymbol) {
|
|
@@ -85222,6 +85424,7 @@ function createTypeChecker(host) {
|
|
|
85222
85424
|
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
85223
85425
|
return void 0;
|
|
85224
85426
|
}
|
|
85427
|
+
// falls through
|
|
85225
85428
|
case 4 /* ThisProperty */:
|
|
85226
85429
|
case 2 /* ModuleExports */:
|
|
85227
85430
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
@@ -85515,6 +85718,7 @@ function createTypeChecker(host) {
|
|
|
85515
85718
|
if (!isThisInTypeQuery(node)) {
|
|
85516
85719
|
return getSymbolOfNameOrPropertyAccessExpression(node);
|
|
85517
85720
|
}
|
|
85721
|
+
// falls through
|
|
85518
85722
|
case 110 /* ThisKeyword */:
|
|
85519
85723
|
const container = getThisContainer(
|
|
85520
85724
|
node,
|
|
@@ -85532,6 +85736,7 @@ function createTypeChecker(host) {
|
|
|
85532
85736
|
if (isInExpressionContext(node)) {
|
|
85533
85737
|
return checkExpression(node).symbol;
|
|
85534
85738
|
}
|
|
85739
|
+
// falls through
|
|
85535
85740
|
case 197 /* ThisType */:
|
|
85536
85741
|
return getTypeFromThisTypeNode(node).symbol;
|
|
85537
85742
|
case 108 /* SuperKeyword */:
|
|
@@ -85554,6 +85759,7 @@ function createTypeChecker(host) {
|
|
|
85554
85759
|
if (isCallExpression(parent) && isBindableObjectDefinePropertyCall(parent) && parent.arguments[1] === node) {
|
|
85555
85760
|
return getSymbolOfDeclaration(parent);
|
|
85556
85761
|
}
|
|
85762
|
+
// falls through
|
|
85557
85763
|
case 9 /* NumericLiteral */:
|
|
85558
85764
|
const objectType = isElementAccessExpression(parent) ? parent.argumentExpression === node ? getTypeOfExpression(parent.expression) : void 0 : isLiteralTypeNode(parent) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
|
|
85559
85765
|
return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
|
|
@@ -85583,6 +85789,7 @@ function createTypeChecker(host) {
|
|
|
85583
85789
|
const symbol = getIntrinsicTagSymbol(node.parent);
|
|
85584
85790
|
return symbol === unknownSymbol ? void 0 : symbol;
|
|
85585
85791
|
}
|
|
85792
|
+
// falls through
|
|
85586
85793
|
default:
|
|
85587
85794
|
return void 0;
|
|
85588
85795
|
}
|
|
@@ -87677,6 +87884,7 @@ function createTypeChecker(host) {
|
|
|
87677
87884
|
);
|
|
87678
87885
|
break;
|
|
87679
87886
|
}
|
|
87887
|
+
// fallthrough
|
|
87680
87888
|
case 7 /* ES2022 */:
|
|
87681
87889
|
case 99 /* ESNext */:
|
|
87682
87890
|
case 200 /* Preserve */:
|
|
@@ -87684,6 +87892,7 @@ function createTypeChecker(host) {
|
|
|
87684
87892
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
87685
87893
|
break;
|
|
87686
87894
|
}
|
|
87895
|
+
// fallthrough
|
|
87687
87896
|
default:
|
|
87688
87897
|
diagnostics.add(
|
|
87689
87898
|
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)
|
|
@@ -89860,13 +90069,13 @@ var visitEachChildTable = {
|
|
|
89860
90069
|
);
|
|
89861
90070
|
},
|
|
89862
90071
|
// Transformation nodes
|
|
89863
|
-
[
|
|
90072
|
+
[355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
89864
90073
|
return context.factory.updatePartiallyEmittedExpression(
|
|
89865
90074
|
node,
|
|
89866
90075
|
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
|
|
89867
90076
|
);
|
|
89868
90077
|
},
|
|
89869
|
-
[
|
|
90078
|
+
[356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
89870
90079
|
return context.factory.updateCommaListExpression(
|
|
89871
90080
|
node,
|
|
89872
90081
|
nodesVisitor(node.elements, visitor, isExpression)
|
|
@@ -91790,6 +91999,8 @@ function transformTypeScript(context) {
|
|
|
91790
91999
|
case 148 /* ReadonlyKeyword */:
|
|
91791
92000
|
case 103 /* InKeyword */:
|
|
91792
92001
|
case 147 /* OutKeyword */:
|
|
92002
|
+
// TypeScript accessibility and readonly modifiers are elided
|
|
92003
|
+
// falls through
|
|
91793
92004
|
case 188 /* ArrayType */:
|
|
91794
92005
|
case 189 /* TupleType */:
|
|
91795
92006
|
case 190 /* OptionalType */:
|
|
@@ -91818,6 +92029,8 @@ function transformTypeScript(context) {
|
|
|
91818
92029
|
case 199 /* IndexedAccessType */:
|
|
91819
92030
|
case 200 /* MappedType */:
|
|
91820
92031
|
case 201 /* LiteralType */:
|
|
92032
|
+
// TypeScript type nodes are elided.
|
|
92033
|
+
// falls through
|
|
91821
92034
|
case 181 /* IndexSignature */:
|
|
91822
92035
|
return void 0;
|
|
91823
92036
|
case 265 /* TypeAliasDeclaration */:
|
|
@@ -93500,7 +93713,7 @@ function transformClassFields(context) {
|
|
|
93500
93713
|
/*discarded*/
|
|
93501
93714
|
true
|
|
93502
93715
|
);
|
|
93503
|
-
case
|
|
93716
|
+
case 356 /* CommaListExpression */:
|
|
93504
93717
|
return visitCommaListExpression(
|
|
93505
93718
|
node,
|
|
93506
93719
|
/*discarded*/
|
|
@@ -95440,6 +95653,7 @@ function transformClassFields(context) {
|
|
|
95440
95653
|
if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
|
|
95441
95654
|
break;
|
|
95442
95655
|
}
|
|
95656
|
+
// falls through
|
|
95443
95657
|
case 262 /* FunctionDeclaration */:
|
|
95444
95658
|
case 176 /* Constructor */:
|
|
95445
95659
|
case 177 /* GetAccessor */:
|
|
@@ -95715,6 +95929,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
95715
95929
|
case 197 /* ThisType */:
|
|
95716
95930
|
case 205 /* ImportType */:
|
|
95717
95931
|
break;
|
|
95932
|
+
// handle JSDoc types from an invalid parse
|
|
95718
95933
|
case 312 /* JSDocAllType */:
|
|
95719
95934
|
case 313 /* JSDocUnknownType */:
|
|
95720
95935
|
case 317 /* JSDocFunctionType */:
|
|
@@ -96560,6 +96775,7 @@ function transformESDecorators(context) {
|
|
|
96560
96775
|
return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
|
|
96561
96776
|
case 169 /* Parameter */:
|
|
96562
96777
|
return visitParameterDeclaration(node);
|
|
96778
|
+
// Support NamedEvaluation to ensure the correct class name for class expressions.
|
|
96563
96779
|
case 226 /* BinaryExpression */:
|
|
96564
96780
|
return visitBinaryExpression(
|
|
96565
96781
|
node,
|
|
@@ -96580,7 +96796,7 @@ function transformESDecorators(context) {
|
|
|
96580
96796
|
return visitForStatement(node);
|
|
96581
96797
|
case 244 /* ExpressionStatement */:
|
|
96582
96798
|
return visitExpressionStatement(node);
|
|
96583
|
-
case
|
|
96799
|
+
case 356 /* CommaListExpression */:
|
|
96584
96800
|
return visitCommaListExpression(
|
|
96585
96801
|
node,
|
|
96586
96802
|
/*discarded*/
|
|
@@ -96592,7 +96808,7 @@ function transformESDecorators(context) {
|
|
|
96592
96808
|
/*discarded*/
|
|
96593
96809
|
false
|
|
96594
96810
|
);
|
|
96595
|
-
case
|
|
96811
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
96596
96812
|
return visitPartiallyEmittedExpression(
|
|
96597
96813
|
node,
|
|
96598
96814
|
/*discarded*/
|
|
@@ -96616,6 +96832,7 @@ function transformESDecorators(context) {
|
|
|
96616
96832
|
case 167 /* ComputedPropertyName */:
|
|
96617
96833
|
return visitComputedPropertyName(node);
|
|
96618
96834
|
case 174 /* MethodDeclaration */:
|
|
96835
|
+
// object literal methods and accessors
|
|
96619
96836
|
case 178 /* SetAccessor */:
|
|
96620
96837
|
case 177 /* GetAccessor */:
|
|
96621
96838
|
case 218 /* FunctionExpression */:
|
|
@@ -96678,7 +96895,7 @@ function transformESDecorators(context) {
|
|
|
96678
96895
|
/*discarded*/
|
|
96679
96896
|
true
|
|
96680
96897
|
);
|
|
96681
|
-
case
|
|
96898
|
+
case 356 /* CommaListExpression */:
|
|
96682
96899
|
return visitCommaListExpression(
|
|
96683
96900
|
node,
|
|
96684
96901
|
/*discarded*/
|
|
@@ -99260,7 +99477,7 @@ function transformES2018(context) {
|
|
|
99260
99477
|
return visitObjectLiteralExpression(node);
|
|
99261
99478
|
case 226 /* BinaryExpression */:
|
|
99262
99479
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
99263
|
-
case
|
|
99480
|
+
case 356 /* CommaListExpression */:
|
|
99264
99481
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
99265
99482
|
case 299 /* CatchClause */:
|
|
99266
99483
|
return visitCatchClause(node);
|
|
@@ -102400,6 +102617,7 @@ function transformES2015(context) {
|
|
|
102400
102617
|
switch (node.kind) {
|
|
102401
102618
|
case 126 /* StaticKeyword */:
|
|
102402
102619
|
return void 0;
|
|
102620
|
+
// elide static keyword
|
|
102403
102621
|
case 263 /* ClassDeclaration */:
|
|
102404
102622
|
return visitClassDeclaration(node);
|
|
102405
102623
|
case 231 /* ClassExpression */:
|
|
@@ -102478,7 +102696,7 @@ function transformES2015(context) {
|
|
|
102478
102696
|
return visitParenthesizedExpression(node, expressionResultIsUnused2);
|
|
102479
102697
|
case 226 /* BinaryExpression */:
|
|
102480
102698
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
102481
|
-
case
|
|
102699
|
+
case 356 /* CommaListExpression */:
|
|
102482
102700
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
102483
102701
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
102484
102702
|
case 16 /* TemplateHead */:
|
|
@@ -102862,12 +103080,14 @@ function transformES2015(context) {
|
|
|
102862
103080
|
return false;
|
|
102863
103081
|
}
|
|
102864
103082
|
switch (node.kind) {
|
|
103083
|
+
// stop at function boundaries
|
|
102865
103084
|
case 219 /* ArrowFunction */:
|
|
102866
103085
|
case 218 /* FunctionExpression */:
|
|
102867
103086
|
case 262 /* FunctionDeclaration */:
|
|
102868
103087
|
case 176 /* Constructor */:
|
|
102869
103088
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
102870
103089
|
return false;
|
|
103090
|
+
// only step into computed property names for class and object literal elements
|
|
102871
103091
|
case 177 /* GetAccessor */:
|
|
102872
103092
|
case 178 /* SetAccessor */:
|
|
102873
103093
|
case 174 /* MethodDeclaration */:
|
|
@@ -103076,12 +103296,14 @@ function transformES2015(context) {
|
|
|
103076
103296
|
return factory2.createPartiallyEmittedExpression(node.right, node);
|
|
103077
103297
|
}
|
|
103078
103298
|
switch (node.kind) {
|
|
103299
|
+
// stop at function boundaries
|
|
103079
103300
|
case 219 /* ArrowFunction */:
|
|
103080
103301
|
case 218 /* FunctionExpression */:
|
|
103081
103302
|
case 262 /* FunctionDeclaration */:
|
|
103082
103303
|
case 176 /* Constructor */:
|
|
103083
103304
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
103084
103305
|
return node;
|
|
103306
|
+
// only step into computed property names for class and object literal elements
|
|
103085
103307
|
case 177 /* GetAccessor */:
|
|
103086
103308
|
case 178 /* SetAccessor */:
|
|
103087
103309
|
case 174 /* MethodDeclaration */:
|
|
@@ -103127,12 +103349,14 @@ function transformES2015(context) {
|
|
|
103127
103349
|
);
|
|
103128
103350
|
}
|
|
103129
103351
|
switch (node.kind) {
|
|
103352
|
+
// stop at function boundaries
|
|
103130
103353
|
case 219 /* ArrowFunction */:
|
|
103131
103354
|
case 218 /* FunctionExpression */:
|
|
103132
103355
|
case 262 /* FunctionDeclaration */:
|
|
103133
103356
|
case 176 /* Constructor */:
|
|
103134
103357
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
103135
103358
|
return node;
|
|
103359
|
+
// only step into computed property names for class and object literal elements
|
|
103136
103360
|
case 177 /* GetAccessor */:
|
|
103137
103361
|
case 178 /* SetAccessor */:
|
|
103138
103362
|
case 174 /* MethodDeclaration */:
|
|
@@ -105764,7 +105988,7 @@ function transformGenerators(context) {
|
|
|
105764
105988
|
switch (node.kind) {
|
|
105765
105989
|
case 226 /* BinaryExpression */:
|
|
105766
105990
|
return visitBinaryExpression(node);
|
|
105767
|
-
case
|
|
105991
|
+
case 356 /* CommaListExpression */:
|
|
105768
105992
|
return visitCommaListExpression(node);
|
|
105769
105993
|
case 227 /* ConditionalExpression */:
|
|
105770
105994
|
return visitConditionalExpression(node);
|
|
@@ -108155,7 +108379,7 @@ function transformModule(context) {
|
|
|
108155
108379
|
return visitExpressionStatement(node);
|
|
108156
108380
|
case 217 /* ParenthesizedExpression */:
|
|
108157
108381
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
108158
|
-
case
|
|
108382
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
108159
108383
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
108160
108384
|
case 213 /* CallExpression */:
|
|
108161
108385
|
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
@@ -109915,6 +110139,7 @@ function transformSystemModule(context) {
|
|
|
109915
110139
|
if (!entry.importClause) {
|
|
109916
110140
|
break;
|
|
109917
110141
|
}
|
|
110142
|
+
// falls through
|
|
109918
110143
|
case 271 /* ImportEqualsDeclaration */:
|
|
109919
110144
|
Debug.assert(importVariableName !== void 0);
|
|
109920
110145
|
statements.push(
|
|
@@ -110549,7 +110774,7 @@ function transformSystemModule(context) {
|
|
|
110549
110774
|
return visitExpressionStatement(node);
|
|
110550
110775
|
case 217 /* ParenthesizedExpression */:
|
|
110551
110776
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
110552
|
-
case
|
|
110777
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
110553
110778
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
110554
110779
|
case 226 /* BinaryExpression */:
|
|
110555
110780
|
if (isDestructuringAssignment(node)) {
|
|
@@ -112148,6 +112373,7 @@ function transformDeclarations(context) {
|
|
|
112148
112373
|
case 265 /* TypeAliasDeclaration */:
|
|
112149
112374
|
case 266 /* EnumDeclaration */:
|
|
112150
112375
|
return !resolver.isDeclarationVisible(node);
|
|
112376
|
+
// The following should be doing their own visibility checks based on filtering their members
|
|
112151
112377
|
case 260 /* VariableDeclaration */:
|
|
112152
112378
|
return !getBindingNameVisible(node);
|
|
112153
112379
|
case 271 /* ImportEqualsDeclaration */:
|
|
@@ -113429,7 +113655,7 @@ function noEmitNotification(hint, node, callback) {
|
|
|
113429
113655
|
}
|
|
113430
113656
|
function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
|
|
113431
113657
|
var _a, _b;
|
|
113432
|
-
const enabledSyntaxKindFeatures = new Array(
|
|
113658
|
+
const enabledSyntaxKindFeatures = new Array(358 /* Count */);
|
|
113433
113659
|
let lexicalEnvironmentVariableDeclarations;
|
|
113434
113660
|
let lexicalEnvironmentFunctionDeclarations;
|
|
113435
113661
|
let lexicalEnvironmentStatements;
|
|
@@ -114632,6 +114858,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114632
114858
|
if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
|
|
114633
114859
|
return pipelineEmitWithNotification;
|
|
114634
114860
|
}
|
|
114861
|
+
// falls through
|
|
114635
114862
|
case 1 /* Substitution */:
|
|
114636
114863
|
if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
|
|
114637
114864
|
if (currentParenthesizerRule) {
|
|
@@ -114639,14 +114866,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114639
114866
|
}
|
|
114640
114867
|
return pipelineEmitWithSubstitution;
|
|
114641
114868
|
}
|
|
114869
|
+
// falls through
|
|
114642
114870
|
case 2 /* Comments */:
|
|
114643
114871
|
if (shouldEmitComments(node)) {
|
|
114644
114872
|
return pipelineEmitWithComments;
|
|
114645
114873
|
}
|
|
114874
|
+
// falls through
|
|
114646
114875
|
case 3 /* SourceMaps */:
|
|
114647
114876
|
if (shouldEmitSourceMaps(node)) {
|
|
114648
114877
|
return pipelineEmitWithSourceMaps;
|
|
114649
114878
|
}
|
|
114879
|
+
// falls through
|
|
114650
114880
|
case 4 /* Emit */:
|
|
114651
114881
|
return pipelineEmitWithHint;
|
|
114652
114882
|
default:
|
|
@@ -114698,6 +114928,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114698
114928
|
}
|
|
114699
114929
|
if (hint === 4 /* Unspecified */) {
|
|
114700
114930
|
switch (node.kind) {
|
|
114931
|
+
// Pseudo-literals
|
|
114701
114932
|
case 16 /* TemplateHead */:
|
|
114702
114933
|
case 17 /* TemplateMiddle */:
|
|
114703
114934
|
case 18 /* TemplateTail */:
|
|
@@ -114706,20 +114937,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114706
114937
|
/*jsxAttributeEscape*/
|
|
114707
114938
|
false
|
|
114708
114939
|
);
|
|
114940
|
+
// Identifiers
|
|
114709
114941
|
case 80 /* Identifier */:
|
|
114710
114942
|
return emitIdentifier(node);
|
|
114943
|
+
// PrivateIdentifiers
|
|
114711
114944
|
case 81 /* PrivateIdentifier */:
|
|
114712
114945
|
return emitPrivateIdentifier(node);
|
|
114946
|
+
// Parse tree nodes
|
|
114947
|
+
// Names
|
|
114713
114948
|
case 166 /* QualifiedName */:
|
|
114714
114949
|
return emitQualifiedName(node);
|
|
114715
114950
|
case 167 /* ComputedPropertyName */:
|
|
114716
114951
|
return emitComputedPropertyName(node);
|
|
114952
|
+
// Signature elements
|
|
114717
114953
|
case 168 /* TypeParameter */:
|
|
114718
114954
|
return emitTypeParameter(node);
|
|
114719
114955
|
case 169 /* Parameter */:
|
|
114720
114956
|
return emitParameter(node);
|
|
114721
114957
|
case 170 /* Decorator */:
|
|
114722
114958
|
return emitDecorator(node);
|
|
114959
|
+
// Type members
|
|
114723
114960
|
case 171 /* PropertySignature */:
|
|
114724
114961
|
return emitPropertySignature(node);
|
|
114725
114962
|
case 172 /* PropertyDeclaration */:
|
|
@@ -114741,6 +114978,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114741
114978
|
return emitConstructSignature(node);
|
|
114742
114979
|
case 181 /* IndexSignature */:
|
|
114743
114980
|
return emitIndexSignature(node);
|
|
114981
|
+
// Types
|
|
114744
114982
|
case 182 /* TypePredicate */:
|
|
114745
114983
|
return emitTypePredicate(node);
|
|
114746
114984
|
case 183 /* TypeReference */:
|
|
@@ -114759,6 +114997,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114759
114997
|
return emitTupleType(node);
|
|
114760
114998
|
case 190 /* OptionalType */:
|
|
114761
114999
|
return emitOptionalType(node);
|
|
115000
|
+
// SyntaxKind.RestType is handled below
|
|
114762
115001
|
case 192 /* UnionType */:
|
|
114763
115002
|
return emitUnionType(node);
|
|
114764
115003
|
case 193 /* IntersectionType */:
|
|
@@ -114789,16 +115028,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114789
115028
|
return emitTemplateTypeSpan(node);
|
|
114790
115029
|
case 205 /* ImportType */:
|
|
114791
115030
|
return emitImportTypeNode(node);
|
|
115031
|
+
// Binding patterns
|
|
114792
115032
|
case 206 /* ObjectBindingPattern */:
|
|
114793
115033
|
return emitObjectBindingPattern(node);
|
|
114794
115034
|
case 207 /* ArrayBindingPattern */:
|
|
114795
115035
|
return emitArrayBindingPattern(node);
|
|
114796
115036
|
case 208 /* BindingElement */:
|
|
114797
115037
|
return emitBindingElement(node);
|
|
115038
|
+
// Misc
|
|
114798
115039
|
case 239 /* TemplateSpan */:
|
|
114799
115040
|
return emitTemplateSpan(node);
|
|
114800
115041
|
case 240 /* SemicolonClassElement */:
|
|
114801
115042
|
return emitSemicolonClassElement();
|
|
115043
|
+
// Statements
|
|
114802
115044
|
case 241 /* Block */:
|
|
114803
115045
|
return emitBlock(node);
|
|
114804
115046
|
case 243 /* VariableStatement */:
|
|
@@ -114840,6 +115082,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114840
115082
|
return emitTryStatement(node);
|
|
114841
115083
|
case 259 /* DebuggerStatement */:
|
|
114842
115084
|
return emitDebuggerStatement(node);
|
|
115085
|
+
// Declarations
|
|
114843
115086
|
case 260 /* VariableDeclaration */:
|
|
114844
115087
|
return emitVariableDeclaration(node);
|
|
114845
115088
|
case 261 /* VariableDeclarationList */:
|
|
@@ -114890,8 +115133,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114890
115133
|
return emitImportAttribute(node);
|
|
114891
115134
|
case 282 /* MissingDeclaration */:
|
|
114892
115135
|
return;
|
|
115136
|
+
// Module references
|
|
114893
115137
|
case 283 /* ExternalModuleReference */:
|
|
114894
115138
|
return emitExternalModuleReference(node);
|
|
115139
|
+
// JSX (non-expression)
|
|
114895
115140
|
case 12 /* JsxText */:
|
|
114896
115141
|
return emitJsxText(node);
|
|
114897
115142
|
case 286 /* JsxOpeningElement */:
|
|
@@ -114910,6 +115155,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114910
115155
|
return emitJsxExpression(node);
|
|
114911
115156
|
case 295 /* JsxNamespacedName */:
|
|
114912
115157
|
return emitJsxNamespacedName(node);
|
|
115158
|
+
// Clauses
|
|
114913
115159
|
case 296 /* CaseClause */:
|
|
114914
115160
|
return emitCaseClause(node);
|
|
114915
115161
|
case 297 /* DefaultClause */:
|
|
@@ -114918,18 +115164,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114918
115164
|
return emitHeritageClause(node);
|
|
114919
115165
|
case 299 /* CatchClause */:
|
|
114920
115166
|
return emitCatchClause(node);
|
|
115167
|
+
// Property assignments
|
|
114921
115168
|
case 303 /* PropertyAssignment */:
|
|
114922
115169
|
return emitPropertyAssignment(node);
|
|
114923
115170
|
case 304 /* ShorthandPropertyAssignment */:
|
|
114924
115171
|
return emitShorthandPropertyAssignment(node);
|
|
114925
115172
|
case 305 /* SpreadAssignment */:
|
|
114926
115173
|
return emitSpreadAssignment(node);
|
|
115174
|
+
// Enum
|
|
114927
115175
|
case 306 /* EnumMember */:
|
|
114928
115176
|
return emitEnumMember(node);
|
|
115177
|
+
// Top-level nodes
|
|
114929
115178
|
case 307 /* SourceFile */:
|
|
114930
115179
|
return emitSourceFile(node);
|
|
114931
115180
|
case 308 /* Bundle */:
|
|
114932
115181
|
return Debug.fail("Bundles should be printed using printBundle");
|
|
115182
|
+
// JSDoc nodes (only used in codefixes currently)
|
|
114933
115183
|
case 309 /* JSDocTypeExpression */:
|
|
114934
115184
|
return emitJSDocTypeExpression(node);
|
|
114935
115185
|
case 310 /* JSDocNameReference */:
|
|
@@ -114967,6 +115217,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114967
115217
|
case 330 /* JSDocAuthorTag */:
|
|
114968
115218
|
case 331 /* JSDocDeprecatedTag */:
|
|
114969
115219
|
return;
|
|
115220
|
+
// SyntaxKind.JSDocClassTag (see JSDocTag, above)
|
|
114970
115221
|
case 333 /* JSDocPublicTag */:
|
|
114971
115222
|
case 334 /* JSDocPrivateTag */:
|
|
114972
115223
|
case 335 /* JSDocProtectedTag */:
|
|
@@ -114976,6 +115227,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114976
115227
|
return emitJSDocCallbackTag(node);
|
|
114977
115228
|
case 339 /* JSDocOverloadTag */:
|
|
114978
115229
|
return emitJSDocOverloadTag(node);
|
|
115230
|
+
// SyntaxKind.JSDocEnumTag (see below)
|
|
114979
115231
|
case 341 /* JSDocParameterTag */:
|
|
114980
115232
|
case 348 /* JSDocPropertyTag */:
|
|
114981
115233
|
return emitJSDocPropertyLikeTag(node);
|
|
@@ -114994,7 +115246,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114994
115246
|
return emitJSDocSeeTag(node);
|
|
114995
115247
|
case 351 /* JSDocImportTag */:
|
|
114996
115248
|
return emitJSDocImportTag(node);
|
|
115249
|
+
// SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
|
|
115250
|
+
// Transformation nodes
|
|
114997
115251
|
case 353 /* NotEmittedStatement */:
|
|
115252
|
+
case 354 /* NotEmittedTypeElement */:
|
|
114998
115253
|
return;
|
|
114999
115254
|
}
|
|
115000
115255
|
if (isExpression(node)) {
|
|
@@ -115012,6 +115267,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115012
115267
|
}
|
|
115013
115268
|
if (hint === 1 /* Expression */) {
|
|
115014
115269
|
switch (node.kind) {
|
|
115270
|
+
// Literals
|
|
115015
115271
|
case 9 /* NumericLiteral */:
|
|
115016
115272
|
case 10 /* BigIntLiteral */:
|
|
115017
115273
|
return emitNumericOrBigIntLiteral(node);
|
|
@@ -115023,10 +115279,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115023
115279
|
/*jsxAttributeEscape*/
|
|
115024
115280
|
false
|
|
115025
115281
|
);
|
|
115282
|
+
// Identifiers
|
|
115026
115283
|
case 80 /* Identifier */:
|
|
115027
115284
|
return emitIdentifier(node);
|
|
115028
115285
|
case 81 /* PrivateIdentifier */:
|
|
115029
115286
|
return emitPrivateIdentifier(node);
|
|
115287
|
+
// Expressions
|
|
115030
115288
|
case 209 /* ArrayLiteralExpression */:
|
|
115031
115289
|
return emitArrayLiteralExpression(node);
|
|
115032
115290
|
case 210 /* ObjectLiteralExpression */:
|
|
@@ -115089,21 +115347,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115089
115347
|
return Debug.fail("SyntheticExpression should never be printed.");
|
|
115090
115348
|
case 282 /* MissingDeclaration */:
|
|
115091
115349
|
return;
|
|
115350
|
+
// JSX
|
|
115092
115351
|
case 284 /* JsxElement */:
|
|
115093
115352
|
return emitJsxElement(node);
|
|
115094
115353
|
case 285 /* JsxSelfClosingElement */:
|
|
115095
115354
|
return emitJsxSelfClosingElement(node);
|
|
115096
115355
|
case 288 /* JsxFragment */:
|
|
115097
115356
|
return emitJsxFragment(node);
|
|
115357
|
+
// Synthesized list
|
|
115098
115358
|
case 352 /* SyntaxList */:
|
|
115099
115359
|
return Debug.fail("SyntaxList should not be printed");
|
|
115360
|
+
// Transformation nodes
|
|
115100
115361
|
case 353 /* NotEmittedStatement */:
|
|
115101
115362
|
return;
|
|
115102
|
-
case
|
|
115363
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
115103
115364
|
return emitPartiallyEmittedExpression(node);
|
|
115104
|
-
case
|
|
115365
|
+
case 356 /* CommaListExpression */:
|
|
115105
115366
|
return emitCommaList(node);
|
|
115106
|
-
case
|
|
115367
|
+
case 357 /* SyntheticReferenceExpression */:
|
|
115107
115368
|
return Debug.fail("SyntheticReferenceExpression should not be printed");
|
|
115108
115369
|
}
|
|
115109
115370
|
}
|
|
@@ -121240,6 +121501,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121240
121501
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
|
121241
121502
|
return "skip";
|
|
121242
121503
|
}
|
|
121504
|
+
// falls through
|
|
121243
121505
|
case 173 /* MethodSignature */:
|
|
121244
121506
|
case 176 /* Constructor */:
|
|
121245
121507
|
case 177 /* GetAccessor */:
|
|
@@ -121371,6 +121633,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121371
121633
|
diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
|
|
121372
121634
|
return "skip";
|
|
121373
121635
|
}
|
|
121636
|
+
// falls through
|
|
121374
121637
|
case 243 /* VariableStatement */:
|
|
121375
121638
|
if (nodes === parent.modifiers) {
|
|
121376
121639
|
checkModifiers(parent.modifiers, parent.kind === 243 /* VariableStatement */);
|
|
@@ -121413,6 +121676,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121413
121676
|
if (isConstValid) {
|
|
121414
121677
|
continue;
|
|
121415
121678
|
}
|
|
121679
|
+
// to report error,
|
|
121680
|
+
// falls through
|
|
121416
121681
|
case 125 /* PublicKeyword */:
|
|
121417
121682
|
case 123 /* PrivateKeyword */:
|
|
121418
121683
|
case 124 /* ProtectedKeyword */:
|
|
@@ -121424,6 +121689,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121424
121689
|
case 147 /* OutKeyword */:
|
|
121425
121690
|
diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
|
121426
121691
|
break;
|
|
121692
|
+
// These are all legal modifiers.
|
|
121427
121693
|
case 126 /* StaticKeyword */:
|
|
121428
121694
|
case 95 /* ExportKeyword */:
|
|
121429
121695
|
case 90 /* DefaultKeyword */:
|
|
@@ -126829,6 +127095,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
|
|
|
126829
127095
|
if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
|
|
126830
127096
|
pos--;
|
|
126831
127097
|
}
|
|
127098
|
+
// falls through
|
|
126832
127099
|
case 13 /* carriageReturn */:
|
|
126833
127100
|
break;
|
|
126834
127101
|
default:
|
|
@@ -128315,6 +128582,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
128315
128582
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
128316
128583
|
step++;
|
|
128317
128584
|
break;
|
|
128585
|
+
// Should never be done
|
|
128318
128586
|
case 3 /* Done */:
|
|
128319
128587
|
default:
|
|
128320
128588
|
assertType(step);
|
|
@@ -128855,6 +129123,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
128855
129123
|
status.type = 2 /* UpToDateWithUpstreamTypes */;
|
|
128856
129124
|
break;
|
|
128857
129125
|
}
|
|
129126
|
+
// falls through
|
|
128858
129127
|
case 15 /* UpToDateWithInputFileText */:
|
|
128859
129128
|
case 2 /* UpToDateWithUpstreamTypes */:
|
|
128860
129129
|
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
|
|
@@ -129372,6 +129641,8 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
129372
129641
|
relName(state, configFileName)
|
|
129373
129642
|
);
|
|
129374
129643
|
case 16 /* ContainerOnly */:
|
|
129644
|
+
// Don't report status on "solution" projects
|
|
129645
|
+
// falls through
|
|
129375
129646
|
case 13 /* ComputingUpstream */:
|
|
129376
129647
|
break;
|
|
129377
129648
|
default:
|