typescript 5.7.0-dev.20240830 → 5.7.0-dev.20240901
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/typescript.js
CHANGED
|
@@ -2265,7 +2265,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2265
2265
|
|
|
2266
2266
|
// src/compiler/corePublic.ts
|
|
2267
2267
|
var versionMajorMinor = "5.7";
|
|
2268
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2268
|
+
var version = `${versionMajorMinor}.0-dev.20240901`;
|
|
2269
2269
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2270
2270
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2271
2271
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -2733,7 +2733,10 @@ function deduplicateSorted(array, comparer) {
|
|
|
2733
2733
|
for (let i = 1; i < array.length; i++) {
|
|
2734
2734
|
const next = array[i];
|
|
2735
2735
|
switch (comparer(next, last2)) {
|
|
2736
|
+
// equality comparison
|
|
2736
2737
|
case true:
|
|
2738
|
+
// relational comparison
|
|
2739
|
+
// falls through
|
|
2737
2740
|
case 0 /* EqualTo */:
|
|
2738
2741
|
continue;
|
|
2739
2742
|
case -1 /* LessThan */:
|
|
@@ -5854,10 +5857,11 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
|
|
|
5854
5857
|
SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
|
|
5855
5858
|
SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
|
|
5856
5859
|
SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
|
|
5857
|
-
SyntaxKind5[SyntaxKind5["
|
|
5858
|
-
SyntaxKind5[SyntaxKind5["
|
|
5859
|
-
SyntaxKind5[SyntaxKind5["
|
|
5860
|
-
SyntaxKind5[SyntaxKind5["
|
|
5860
|
+
SyntaxKind5[SyntaxKind5["NotEmittedTypeElement"] = 354] = "NotEmittedTypeElement";
|
|
5861
|
+
SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 355] = "PartiallyEmittedExpression";
|
|
5862
|
+
SyntaxKind5[SyntaxKind5["CommaListExpression"] = 356] = "CommaListExpression";
|
|
5863
|
+
SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression";
|
|
5864
|
+
SyntaxKind5[SyntaxKind5["Count"] = 358] = "Count";
|
|
5861
5865
|
SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
|
|
5862
5866
|
SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
|
|
5863
5867
|
SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
|
|
@@ -7997,6 +8001,7 @@ function createSystemWatchFunctions({
|
|
|
7997
8001
|
return generateWatchFileOptions(4 /* UseFsEvents */, 2 /* DynamicPriority */, options);
|
|
7998
8002
|
case "UseFsEventsOnParentDirectory":
|
|
7999
8003
|
useNonPollingWatchers2 = true;
|
|
8004
|
+
// fall through
|
|
8000
8005
|
default:
|
|
8001
8006
|
return useNonPollingWatchers2 ? (
|
|
8002
8007
|
// Use notifications from FS to watch with falling back to fs.watchFile
|
|
@@ -11538,6 +11543,7 @@ function computeLineStarts(text) {
|
|
|
11538
11543
|
if (text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
11539
11544
|
pos++;
|
|
11540
11545
|
}
|
|
11546
|
+
// falls through
|
|
11541
11547
|
case 10 /* lineFeed */:
|
|
11542
11548
|
result.push(lineStart);
|
|
11543
11549
|
lineStart = pos;
|
|
@@ -11640,6 +11646,8 @@ function couldStartTrivia(text, pos) {
|
|
|
11640
11646
|
case 12 /* formFeed */:
|
|
11641
11647
|
case 32 /* space */:
|
|
11642
11648
|
case 47 /* slash */:
|
|
11649
|
+
// starts of normal trivia
|
|
11650
|
+
// falls through
|
|
11643
11651
|
case 60 /* lessThan */:
|
|
11644
11652
|
case 124 /* bar */:
|
|
11645
11653
|
case 61 /* equals */:
|
|
@@ -11663,6 +11671,7 @@ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
|
|
|
11663
11671
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
11664
11672
|
pos++;
|
|
11665
11673
|
}
|
|
11674
|
+
// falls through
|
|
11666
11675
|
case 10 /* lineFeed */:
|
|
11667
11676
|
pos++;
|
|
11668
11677
|
if (stopAfterLineBreak) {
|
|
@@ -11809,6 +11818,7 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
|
|
|
11809
11818
|
if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
|
|
11810
11819
|
pos++;
|
|
11811
11820
|
}
|
|
11821
|
+
// falls through
|
|
11812
11822
|
case 10 /* lineFeed */:
|
|
11813
11823
|
pos++;
|
|
11814
11824
|
if (trailing) {
|
|
@@ -12374,12 +12384,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12374
12384
|
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
12375
12385
|
return "\0";
|
|
12376
12386
|
}
|
|
12387
|
+
// '\01', '\011'
|
|
12388
|
+
// falls through
|
|
12377
12389
|
case 49 /* _1 */:
|
|
12378
12390
|
case 50 /* _2 */:
|
|
12379
12391
|
case 51 /* _3 */:
|
|
12380
12392
|
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
12381
12393
|
pos++;
|
|
12382
12394
|
}
|
|
12395
|
+
// '\17', '\177'
|
|
12396
|
+
// falls through
|
|
12383
12397
|
case 52 /* _4 */:
|
|
12384
12398
|
case 53 /* _5 */:
|
|
12385
12399
|
case 54 /* _6 */:
|
|
@@ -12477,10 +12491,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12477
12491
|
}
|
|
12478
12492
|
tokenFlags |= 4096 /* HexEscape */;
|
|
12479
12493
|
return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
|
|
12494
|
+
// when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
|
|
12495
|
+
// the line terminator is interpreted to be "the empty code unit sequence".
|
|
12480
12496
|
case 13 /* carriageReturn */:
|
|
12481
12497
|
if (pos < end && charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
12482
12498
|
pos++;
|
|
12483
12499
|
}
|
|
12500
|
+
// falls through
|
|
12484
12501
|
case 10 /* lineFeed */:
|
|
12485
12502
|
case 8232 /* lineSeparator */:
|
|
12486
12503
|
case 8233 /* paragraphSeparator */:
|
|
@@ -12911,6 +12928,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12911
12928
|
tokenFlags |= 256 /* OctalSpecifier */;
|
|
12912
12929
|
return token = checkBigIntSuffix();
|
|
12913
12930
|
}
|
|
12931
|
+
// falls through
|
|
12914
12932
|
case 49 /* _1 */:
|
|
12915
12933
|
case 50 /* _2 */:
|
|
12916
12934
|
case 51 /* _3 */:
|
|
@@ -13430,6 +13448,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13430
13448
|
break;
|
|
13431
13449
|
}
|
|
13432
13450
|
}
|
|
13451
|
+
// falls through
|
|
13433
13452
|
case 42 /* asterisk */:
|
|
13434
13453
|
case 43 /* plus */:
|
|
13435
13454
|
case 63 /* question */:
|
|
@@ -13460,6 +13479,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13460
13479
|
if (isInGroup) {
|
|
13461
13480
|
return;
|
|
13462
13481
|
}
|
|
13482
|
+
// falls through
|
|
13463
13483
|
case 93 /* closeBracket */:
|
|
13464
13484
|
case 125 /* closeBrace */:
|
|
13465
13485
|
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
@@ -13522,6 +13542,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13522
13542
|
error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
13523
13543
|
break;
|
|
13524
13544
|
}
|
|
13545
|
+
// falls through
|
|
13525
13546
|
default:
|
|
13526
13547
|
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape(
|
|
13527
13548
|
/*atomEscape*/
|
|
@@ -13659,6 +13680,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13659
13680
|
let start2 = pos;
|
|
13660
13681
|
let operand;
|
|
13661
13682
|
switch (text.slice(pos, pos + 2)) {
|
|
13683
|
+
// TODO: don't use slice
|
|
13662
13684
|
case "--":
|
|
13663
13685
|
case "&&":
|
|
13664
13686
|
error2(Diagnostics.Expected_a_class_set_operand);
|
|
@@ -13764,6 +13786,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13764
13786
|
}
|
|
13765
13787
|
start2 = pos;
|
|
13766
13788
|
switch (text.slice(pos, pos + 2)) {
|
|
13789
|
+
// TODO: don't use slice
|
|
13767
13790
|
case "--":
|
|
13768
13791
|
case "&&":
|
|
13769
13792
|
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
@@ -13861,6 +13884,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13861
13884
|
}
|
|
13862
13885
|
}
|
|
13863
13886
|
pos--;
|
|
13887
|
+
// falls through
|
|
13864
13888
|
default:
|
|
13865
13889
|
return scanClassSetCharacter();
|
|
13866
13890
|
}
|
|
@@ -14007,6 +14031,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14007
14031
|
return true;
|
|
14008
14032
|
case 80 /* P */:
|
|
14009
14033
|
isCharacterComplement = true;
|
|
14034
|
+
// falls through
|
|
14010
14035
|
case 112 /* p */:
|
|
14011
14036
|
pos++;
|
|
14012
14037
|
if (charCodeChecked(pos) === 123 /* openBrace */) {
|
|
@@ -14314,6 +14339,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14314
14339
|
if (charCodeUnchecked(pos) === 10 /* lineFeed */) {
|
|
14315
14340
|
pos++;
|
|
14316
14341
|
}
|
|
14342
|
+
// falls through
|
|
14317
14343
|
case 10 /* lineFeed */:
|
|
14318
14344
|
tokenFlags |= 1 /* PrecedingLineBreak */;
|
|
14319
14345
|
return token = 4 /* NewLineTrivia */;
|
|
@@ -14540,6 +14566,7 @@ function getDefaultLibFileName(options) {
|
|
|
14540
14566
|
return "lib.es2016.full.d.ts";
|
|
14541
14567
|
case 2 /* ES2015 */:
|
|
14542
14568
|
return "lib.es6.d.ts";
|
|
14569
|
+
// We don't use lib.es2015.full.d.ts due to breaking change.
|
|
14543
14570
|
default:
|
|
14544
14571
|
return "lib.d.ts";
|
|
14545
14572
|
}
|
|
@@ -15480,7 +15507,7 @@ function isModifierLike(node) {
|
|
|
15480
15507
|
}
|
|
15481
15508
|
function isTypeElement(node) {
|
|
15482
15509
|
const kind = node.kind;
|
|
15483
|
-
return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */;
|
|
15510
|
+
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 */;
|
|
15484
15511
|
}
|
|
15485
15512
|
function isClassOrTypeElement(node) {
|
|
15486
15513
|
return isTypeElement(node) || isClassElement(node);
|
|
@@ -15542,7 +15569,9 @@ function isObjectBindingOrAssignmentElement(node) {
|
|
|
15542
15569
|
switch (node.kind) {
|
|
15543
15570
|
case 208 /* BindingElement */:
|
|
15544
15571
|
case 303 /* PropertyAssignment */:
|
|
15572
|
+
// AssignmentProperty
|
|
15545
15573
|
case 304 /* ShorthandPropertyAssignment */:
|
|
15574
|
+
// AssignmentProperty
|
|
15546
15575
|
case 305 /* SpreadAssignment */:
|
|
15547
15576
|
return true;
|
|
15548
15577
|
}
|
|
@@ -15560,11 +15589,17 @@ function isArrayBindingOrAssignmentElement(node) {
|
|
|
15560
15589
|
switch (node.kind) {
|
|
15561
15590
|
case 208 /* BindingElement */:
|
|
15562
15591
|
case 232 /* OmittedExpression */:
|
|
15592
|
+
// Elision
|
|
15563
15593
|
case 230 /* SpreadElement */:
|
|
15594
|
+
// AssignmentRestElement
|
|
15564
15595
|
case 209 /* ArrayLiteralExpression */:
|
|
15596
|
+
// ArrayAssignmentPattern
|
|
15565
15597
|
case 210 /* ObjectLiteralExpression */:
|
|
15598
|
+
// ObjectAssignmentPattern
|
|
15566
15599
|
case 80 /* Identifier */:
|
|
15600
|
+
// DestructuringAssignmentTarget
|
|
15567
15601
|
case 211 /* PropertyAccessExpression */:
|
|
15602
|
+
// DestructuringAssignmentTarget
|
|
15568
15603
|
case 212 /* ElementAccessExpression */:
|
|
15569
15604
|
return true;
|
|
15570
15605
|
}
|
|
@@ -15625,6 +15660,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
15625
15660
|
case 218 /* FunctionExpression */:
|
|
15626
15661
|
case 80 /* Identifier */:
|
|
15627
15662
|
case 81 /* PrivateIdentifier */:
|
|
15663
|
+
// technically this is only an Expression if it's in a `#field in expr` BinaryExpression
|
|
15628
15664
|
case 14 /* RegularExpressionLiteral */:
|
|
15629
15665
|
case 9 /* NumericLiteral */:
|
|
15630
15666
|
case 10 /* BigIntLiteral */:
|
|
@@ -15640,6 +15676,7 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
15640
15676
|
case 233 /* ExpressionWithTypeArguments */:
|
|
15641
15677
|
case 236 /* MetaProperty */:
|
|
15642
15678
|
case 102 /* ImportKeyword */:
|
|
15679
|
+
// technically this is only an Expression if it's in a CallExpression
|
|
15643
15680
|
case 282 /* MissingDeclaration */:
|
|
15644
15681
|
return true;
|
|
15645
15682
|
default:
|
|
@@ -15696,8 +15733,8 @@ function isExpressionKind(kind) {
|
|
|
15696
15733
|
case 230 /* SpreadElement */:
|
|
15697
15734
|
case 234 /* AsExpression */:
|
|
15698
15735
|
case 232 /* OmittedExpression */:
|
|
15699
|
-
case
|
|
15700
|
-
case
|
|
15736
|
+
case 356 /* CommaListExpression */:
|
|
15737
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
15701
15738
|
case 238 /* SatisfiesExpression */:
|
|
15702
15739
|
return true;
|
|
15703
15740
|
default:
|
|
@@ -17436,6 +17473,8 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
17436
17473
|
}
|
|
17437
17474
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
17438
17475
|
}
|
|
17476
|
+
// This list is a work in progress. Add missing node kinds to improve their error
|
|
17477
|
+
// spans.
|
|
17439
17478
|
case 260 /* VariableDeclaration */:
|
|
17440
17479
|
case 208 /* BindingElement */:
|
|
17441
17480
|
case 263 /* ClassDeclaration */:
|
|
@@ -17607,6 +17646,8 @@ function isPartOfTypeNode(node) {
|
|
|
17607
17646
|
return isPartOfTypeExpressionWithTypeArguments(node);
|
|
17608
17647
|
case 168 /* TypeParameter */:
|
|
17609
17648
|
return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */;
|
|
17649
|
+
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
17650
|
+
// above them to find the lowest container
|
|
17610
17651
|
case 80 /* Identifier */:
|
|
17611
17652
|
if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) {
|
|
17612
17653
|
node = node.parent;
|
|
@@ -17614,6 +17655,7 @@ function isPartOfTypeNode(node) {
|
|
|
17614
17655
|
node = node.parent;
|
|
17615
17656
|
}
|
|
17616
17657
|
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'.");
|
|
17658
|
+
// falls through
|
|
17617
17659
|
case 166 /* QualifiedName */:
|
|
17618
17660
|
case 211 /* PropertyAccessExpression */:
|
|
17619
17661
|
case 110 /* ThisKeyword */: {
|
|
@@ -17882,6 +17924,7 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
17882
17924
|
if (!includeArrowFunctions) {
|
|
17883
17925
|
continue;
|
|
17884
17926
|
}
|
|
17927
|
+
// falls through
|
|
17885
17928
|
case 262 /* FunctionDeclaration */:
|
|
17886
17929
|
case 218 /* FunctionExpression */:
|
|
17887
17930
|
case 267 /* ModuleDeclaration */:
|
|
@@ -17904,6 +17947,8 @@ function getThisContainer(node, includeArrowFunctions, includeClassComputedPrope
|
|
|
17904
17947
|
}
|
|
17905
17948
|
function isThisContainerOrFunctionBlock(node) {
|
|
17906
17949
|
switch (node.kind) {
|
|
17950
|
+
// Arrow functions use the same scope, but may do so in a "delayed" manner
|
|
17951
|
+
// For example, `const getThis = () => this` may be before a super() call in a derived constructor
|
|
17907
17952
|
case 219 /* ArrowFunction */:
|
|
17908
17953
|
case 262 /* FunctionDeclaration */:
|
|
17909
17954
|
case 218 /* FunctionExpression */:
|
|
@@ -17970,6 +18015,7 @@ function getSuperContainer(node, stopOnFunctions) {
|
|
|
17970
18015
|
if (!stopOnFunctions) {
|
|
17971
18016
|
continue;
|
|
17972
18017
|
}
|
|
18018
|
+
// falls through
|
|
17973
18019
|
case 172 /* PropertyDeclaration */:
|
|
17974
18020
|
case 171 /* PropertySignature */:
|
|
17975
18021
|
case 174 /* MethodDeclaration */:
|
|
@@ -18023,6 +18069,7 @@ function getEntityNameFromTypeNode(node) {
|
|
|
18023
18069
|
return node.typeName;
|
|
18024
18070
|
case 233 /* ExpressionWithTypeArguments */:
|
|
18025
18071
|
return isEntityNameExpression(node.expression) ? node.expression : void 0;
|
|
18072
|
+
// 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.
|
|
18026
18073
|
case 80 /* Identifier */:
|
|
18027
18074
|
case 166 /* QualifiedName */:
|
|
18028
18075
|
return node;
|
|
@@ -18187,6 +18234,7 @@ function isExpressionNode(node) {
|
|
|
18187
18234
|
if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) {
|
|
18188
18235
|
return true;
|
|
18189
18236
|
}
|
|
18237
|
+
// falls through
|
|
18190
18238
|
case 9 /* NumericLiteral */:
|
|
18191
18239
|
case 10 /* BigIntLiteral */:
|
|
18192
18240
|
case 11 /* StringLiteral */:
|
|
@@ -19101,6 +19149,7 @@ function getDeclarationFromName(name) {
|
|
|
19101
19149
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
19102
19150
|
case 9 /* NumericLiteral */:
|
|
19103
19151
|
if (isComputedPropertyName(parent2)) return parent2.parent;
|
|
19152
|
+
// falls through
|
|
19104
19153
|
case 80 /* Identifier */:
|
|
19105
19154
|
if (isDeclaration(parent2)) {
|
|
19106
19155
|
return parent2.name === name ? parent2 : void 0;
|
|
@@ -19271,6 +19320,7 @@ function getFunctionFlags(node) {
|
|
|
19271
19320
|
if (node.asteriskToken) {
|
|
19272
19321
|
flags |= 1 /* Generator */;
|
|
19273
19322
|
}
|
|
19323
|
+
// falls through
|
|
19274
19324
|
case 219 /* ArrowFunction */:
|
|
19275
19325
|
if (hasSyntacticModifier(node, 1024 /* Async */)) {
|
|
19276
19326
|
flags |= 2 /* Async */;
|
|
@@ -19541,7 +19591,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
|
|
|
19541
19591
|
})(OperatorPrecedence || {});
|
|
19542
19592
|
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
19543
19593
|
switch (nodeKind) {
|
|
19544
|
-
case
|
|
19594
|
+
case 356 /* CommaListExpression */:
|
|
19545
19595
|
return 0 /* Comma */;
|
|
19546
19596
|
case 230 /* SpreadElement */:
|
|
19547
19597
|
return 1 /* Spread */;
|
|
@@ -19573,6 +19623,7 @@ function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
|
19573
19623
|
default:
|
|
19574
19624
|
return getBinaryOperatorPrecedence(operatorKind);
|
|
19575
19625
|
}
|
|
19626
|
+
// TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
|
|
19576
19627
|
case 216 /* TypeAssertionExpression */:
|
|
19577
19628
|
case 235 /* NonNullExpression */:
|
|
19578
19629
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -21207,11 +21258,12 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
|
21207
21258
|
if (stopAtCallExpressions) {
|
|
21208
21259
|
return node;
|
|
21209
21260
|
}
|
|
21261
|
+
// falls through
|
|
21210
21262
|
case 234 /* AsExpression */:
|
|
21211
21263
|
case 212 /* ElementAccessExpression */:
|
|
21212
21264
|
case 211 /* PropertyAccessExpression */:
|
|
21213
21265
|
case 235 /* NonNullExpression */:
|
|
21214
|
-
case
|
|
21266
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
21215
21267
|
case 238 /* SatisfiesExpression */:
|
|
21216
21268
|
node = node.expression;
|
|
21217
21269
|
continue;
|
|
@@ -22522,6 +22574,7 @@ function isJsonEqual(a, b) {
|
|
|
22522
22574
|
function parsePseudoBigInt(stringValue) {
|
|
22523
22575
|
let log2Base;
|
|
22524
22576
|
switch (stringValue.charCodeAt(1)) {
|
|
22577
|
+
// "x" in "0x123"
|
|
22525
22578
|
case 98 /* b */:
|
|
22526
22579
|
case 66 /* B */:
|
|
22527
22580
|
log2Base = 1;
|
|
@@ -22769,7 +22822,7 @@ function getContainingNodeArray(node) {
|
|
|
22769
22822
|
return parent2.types;
|
|
22770
22823
|
case 189 /* TupleType */:
|
|
22771
22824
|
case 209 /* ArrayLiteralExpression */:
|
|
22772
|
-
case
|
|
22825
|
+
case 356 /* CommaListExpression */:
|
|
22773
22826
|
case 275 /* NamedImports */:
|
|
22774
22827
|
case 279 /* NamedExports */:
|
|
22775
22828
|
return parent2.elements;
|
|
@@ -23308,6 +23361,7 @@ function createNameResolver({
|
|
|
23308
23361
|
switch (location.kind) {
|
|
23309
23362
|
case 307 /* SourceFile */:
|
|
23310
23363
|
if (!isExternalOrCommonJsModule(location)) break;
|
|
23364
|
+
// falls through
|
|
23311
23365
|
case 267 /* ModuleDeclaration */:
|
|
23312
23366
|
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
23313
23367
|
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
@@ -23391,6 +23445,14 @@ function createNameResolver({
|
|
|
23391
23445
|
}
|
|
23392
23446
|
}
|
|
23393
23447
|
break;
|
|
23448
|
+
// It is not legal to reference a class's own type parameters from a computed property name that
|
|
23449
|
+
// belongs to the class. For example:
|
|
23450
|
+
//
|
|
23451
|
+
// function foo<T>() { return '' }
|
|
23452
|
+
// class C<T> { // <-- Class's own type parameter T
|
|
23453
|
+
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
|
|
23454
|
+
// }
|
|
23455
|
+
//
|
|
23394
23456
|
case 167 /* ComputedPropertyName */:
|
|
23395
23457
|
grandparent = location.parent.parent;
|
|
23396
23458
|
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
@@ -23406,6 +23468,7 @@ function createNameResolver({
|
|
|
23406
23468
|
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
23407
23469
|
break;
|
|
23408
23470
|
}
|
|
23471
|
+
// falls through
|
|
23409
23472
|
case 174 /* MethodDeclaration */:
|
|
23410
23473
|
case 176 /* Constructor */:
|
|
23411
23474
|
case 177 /* GetAccessor */:
|
|
@@ -24050,6 +24113,7 @@ function createParenthesizerRules(factory2) {
|
|
|
24050
24113
|
function parenthesizeConstituentTypeOfUnionType(type) {
|
|
24051
24114
|
switch (type.kind) {
|
|
24052
24115
|
case 192 /* UnionType */:
|
|
24116
|
+
// Not strictly necessary, but a union containing a union should have been flattened
|
|
24053
24117
|
case 193 /* IntersectionType */:
|
|
24054
24118
|
return factory2.createParenthesizedType(type);
|
|
24055
24119
|
}
|
|
@@ -24831,6 +24895,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
24831
24895
|
createSyntheticExpression,
|
|
24832
24896
|
createSyntaxList: createSyntaxList3,
|
|
24833
24897
|
createNotEmittedStatement,
|
|
24898
|
+
createNotEmittedTypeElement,
|
|
24834
24899
|
createPartiallyEmittedExpression,
|
|
24835
24900
|
updatePartiallyEmittedExpression,
|
|
24836
24901
|
createCommaListExpression,
|
|
@@ -27857,7 +27922,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
27857
27922
|
return node;
|
|
27858
27923
|
}
|
|
27859
27924
|
function createPartiallyEmittedExpression(expression, original) {
|
|
27860
|
-
const node = createBaseNode(
|
|
27925
|
+
const node = createBaseNode(355 /* PartiallyEmittedExpression */);
|
|
27861
27926
|
node.expression = expression;
|
|
27862
27927
|
node.original = original;
|
|
27863
27928
|
node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
|
|
@@ -27867,6 +27932,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
27867
27932
|
function updatePartiallyEmittedExpression(node, expression) {
|
|
27868
27933
|
return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node;
|
|
27869
27934
|
}
|
|
27935
|
+
function createNotEmittedTypeElement() {
|
|
27936
|
+
return createBaseNode(354 /* NotEmittedTypeElement */);
|
|
27937
|
+
}
|
|
27870
27938
|
function flattenCommaElements(node) {
|
|
27871
27939
|
if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
|
|
27872
27940
|
if (isCommaListExpression(node)) {
|
|
@@ -27879,7 +27947,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
27879
27947
|
return node;
|
|
27880
27948
|
}
|
|
27881
27949
|
function createCommaListExpression(elements) {
|
|
27882
|
-
const node = createBaseNode(
|
|
27950
|
+
const node = createBaseNode(356 /* CommaListExpression */);
|
|
27883
27951
|
node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
|
|
27884
27952
|
node.transformFlags |= propagateChildrenFlags(node.elements);
|
|
27885
27953
|
return node;
|
|
@@ -27888,7 +27956,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
27888
27956
|
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
|
|
27889
27957
|
}
|
|
27890
27958
|
function createSyntheticReferenceExpression(expression, thisArg) {
|
|
27891
|
-
const node = createBaseNode(
|
|
27959
|
+
const node = createBaseNode(357 /* SyntheticReferenceExpression */);
|
|
27892
27960
|
node.expression = expression;
|
|
27893
27961
|
node.thisArg = thisArg;
|
|
27894
27962
|
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
|
|
@@ -28135,7 +28203,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
28135
28203
|
return updateNonNullExpression(outerExpression, expression);
|
|
28136
28204
|
case 233 /* ExpressionWithTypeArguments */:
|
|
28137
28205
|
return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
|
|
28138
|
-
case
|
|
28206
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
28139
28207
|
return updatePartiallyEmittedExpression(outerExpression, expression);
|
|
28140
28208
|
}
|
|
28141
28209
|
}
|
|
@@ -28680,7 +28748,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
|
|
|
28680
28748
|
case 216 /* TypeAssertionExpression */:
|
|
28681
28749
|
case 238 /* SatisfiesExpression */:
|
|
28682
28750
|
case 234 /* AsExpression */:
|
|
28683
|
-
case
|
|
28751
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
28684
28752
|
case 217 /* ParenthesizedExpression */:
|
|
28685
28753
|
case 108 /* SuperKeyword */:
|
|
28686
28754
|
return -2147483648 /* OuterExpressionExcludes */;
|
|
@@ -30389,10 +30457,10 @@ function isSyntheticExpression(node) {
|
|
|
30389
30457
|
return node.kind === 237 /* SyntheticExpression */;
|
|
30390
30458
|
}
|
|
30391
30459
|
function isPartiallyEmittedExpression(node) {
|
|
30392
|
-
return node.kind ===
|
|
30460
|
+
return node.kind === 355 /* PartiallyEmittedExpression */;
|
|
30393
30461
|
}
|
|
30394
30462
|
function isCommaListExpression(node) {
|
|
30395
|
-
return node.kind ===
|
|
30463
|
+
return node.kind === 356 /* CommaListExpression */;
|
|
30396
30464
|
}
|
|
30397
30465
|
function isTemplateSpan(node) {
|
|
30398
30466
|
return node.kind === 239 /* TemplateSpan */;
|
|
@@ -30548,7 +30616,7 @@ function isNotEmittedStatement(node) {
|
|
|
30548
30616
|
return node.kind === 353 /* NotEmittedStatement */;
|
|
30549
30617
|
}
|
|
30550
30618
|
function isSyntheticReference(node) {
|
|
30551
|
-
return node.kind ===
|
|
30619
|
+
return node.kind === 357 /* SyntheticReferenceExpression */;
|
|
30552
30620
|
}
|
|
30553
30621
|
function isExternalModuleReference(node) {
|
|
30554
30622
|
return node.kind === 283 /* ExternalModuleReference */;
|
|
@@ -31171,7 +31239,7 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
|
31171
31239
|
return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
|
|
31172
31240
|
case 235 /* NonNullExpression */:
|
|
31173
31241
|
return (kinds & 4 /* NonNullAssertions */) !== 0;
|
|
31174
|
-
case
|
|
31242
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
31175
31243
|
return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
|
|
31176
31244
|
}
|
|
31177
31245
|
return false;
|
|
@@ -31615,10 +31683,13 @@ var BinaryExpressionState;
|
|
|
31615
31683
|
switch (currentState) {
|
|
31616
31684
|
case enter:
|
|
31617
31685
|
if (machine.onLeft) return left;
|
|
31686
|
+
// falls through
|
|
31618
31687
|
case left:
|
|
31619
31688
|
if (machine.onOperator) return operator;
|
|
31689
|
+
// falls through
|
|
31620
31690
|
case operator:
|
|
31621
31691
|
if (machine.onRight) return right;
|
|
31692
|
+
// falls through
|
|
31622
31693
|
case right:
|
|
31623
31694
|
return exit;
|
|
31624
31695
|
case exit:
|
|
@@ -32246,7 +32317,7 @@ var forEachChildTable = {
|
|
|
32246
32317
|
[282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
|
|
32247
32318
|
return visitNodes(cbNode, cbNodes, node.modifiers);
|
|
32248
32319
|
},
|
|
32249
|
-
[
|
|
32320
|
+
[356 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
|
|
32250
32321
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
32251
32322
|
},
|
|
32252
32323
|
[284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
|
|
@@ -32342,7 +32413,7 @@ var forEachChildTable = {
|
|
|
32342
32413
|
[331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
|
|
32343
32414
|
[337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
|
|
32344
32415
|
[351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
|
|
32345
|
-
[
|
|
32416
|
+
[355 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
|
|
32346
32417
|
};
|
|
32347
32418
|
function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
|
|
32348
32419
|
return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
|
|
@@ -32712,6 +32783,7 @@ var Parser;
|
|
|
32712
32783
|
expression2 = parseLiteralNode();
|
|
32713
32784
|
break;
|
|
32714
32785
|
}
|
|
32786
|
+
// falls through
|
|
32715
32787
|
default:
|
|
32716
32788
|
expression2 = parseObjectLiteralExpression();
|
|
32717
32789
|
break;
|
|
@@ -33633,6 +33705,7 @@ var Parser;
|
|
|
33633
33705
|
case 25 /* DotToken */:
|
|
33634
33706
|
return true;
|
|
33635
33707
|
}
|
|
33708
|
+
// falls through
|
|
33636
33709
|
case 11 /* ArgumentExpressions */:
|
|
33637
33710
|
return token() === 26 /* DotDotDotToken */ || isStartOfExpression();
|
|
33638
33711
|
case 16 /* Parameters */:
|
|
@@ -33666,6 +33739,7 @@ var Parser;
|
|
|
33666
33739
|
return true;
|
|
33667
33740
|
case 26 /* Count */:
|
|
33668
33741
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
33742
|
+
// Not a real context, only a marker.
|
|
33669
33743
|
default:
|
|
33670
33744
|
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
|
|
33671
33745
|
}
|
|
@@ -33982,6 +34056,7 @@ var Parser;
|
|
|
33982
34056
|
case 3 /* SwitchClauseStatements */:
|
|
33983
34057
|
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
|
|
33984
34058
|
case 18 /* RestProperties */:
|
|
34059
|
+
// fallthrough
|
|
33985
34060
|
case 4 /* TypeMembers */:
|
|
33986
34061
|
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
|
|
33987
34062
|
case 5 /* ClassMembers */:
|
|
@@ -34029,6 +34104,7 @@ var Parser;
|
|
|
34029
34104
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
34030
34105
|
case 26 /* Count */:
|
|
34031
34106
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
34107
|
+
// Not a real context, only a marker.
|
|
34032
34108
|
default:
|
|
34033
34109
|
Debug.assertNever(context);
|
|
34034
34110
|
}
|
|
@@ -34953,10 +35029,12 @@ var Parser;
|
|
|
34953
35029
|
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
|
|
34954
35030
|
case 67 /* AsteriskEqualsToken */:
|
|
34955
35031
|
scanner2.reScanAsteriskEqualsToken();
|
|
35032
|
+
// falls through
|
|
34956
35033
|
case 42 /* AsteriskToken */:
|
|
34957
35034
|
return parseJSDocAllType();
|
|
34958
35035
|
case 61 /* QuestionQuestionToken */:
|
|
34959
35036
|
scanner2.reScanQuestionToken();
|
|
35037
|
+
// falls through
|
|
34960
35038
|
case 58 /* QuestionToken */:
|
|
34961
35039
|
return parseJSDocUnknownOrNullableType();
|
|
34962
35040
|
case 100 /* FunctionKeyword */:
|
|
@@ -35834,6 +35912,7 @@ var Parser;
|
|
|
35834
35912
|
if (isAwaitExpression2()) {
|
|
35835
35913
|
return parseAwaitExpression();
|
|
35836
35914
|
}
|
|
35915
|
+
// falls through
|
|
35837
35916
|
default:
|
|
35838
35917
|
return parseUpdateExpression();
|
|
35839
35918
|
}
|
|
@@ -35853,6 +35932,8 @@ var Parser;
|
|
|
35853
35932
|
if (languageVariant !== 1 /* JSX */) {
|
|
35854
35933
|
return false;
|
|
35855
35934
|
}
|
|
35935
|
+
// We are in JSX context and the token is part of JSXElement.
|
|
35936
|
+
// falls through
|
|
35856
35937
|
default:
|
|
35857
35938
|
return true;
|
|
35858
35939
|
}
|
|
@@ -36426,10 +36507,16 @@ var Parser;
|
|
|
36426
36507
|
}
|
|
36427
36508
|
function canFollowTypeArgumentsInExpression() {
|
|
36428
36509
|
switch (token()) {
|
|
36510
|
+
// These tokens can follow a type argument list in a call expression.
|
|
36429
36511
|
case 21 /* OpenParenToken */:
|
|
36512
|
+
// foo<x>(
|
|
36430
36513
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
36514
|
+
// foo<T> `...`
|
|
36431
36515
|
case 16 /* TemplateHead */:
|
|
36432
36516
|
return true;
|
|
36517
|
+
// A type argument list followed by `<` never makes sense, and a type argument list followed
|
|
36518
|
+
// by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
|
|
36519
|
+
// this context, `+` and `-` are unary operators, not binary operators.
|
|
36433
36520
|
case 30 /* LessThanToken */:
|
|
36434
36521
|
case 32 /* GreaterThanToken */:
|
|
36435
36522
|
case 40 /* PlusToken */:
|
|
@@ -36447,6 +36534,7 @@ var Parser;
|
|
|
36447
36534
|
false
|
|
36448
36535
|
);
|
|
36449
36536
|
}
|
|
36537
|
+
// falls through
|
|
36450
36538
|
case 9 /* NumericLiteral */:
|
|
36451
36539
|
case 10 /* BigIntLiteral */:
|
|
36452
36540
|
case 11 /* StringLiteral */:
|
|
@@ -36950,6 +37038,27 @@ var Parser;
|
|
|
36950
37038
|
return isUsingDeclaration();
|
|
36951
37039
|
case 135 /* AwaitKeyword */:
|
|
36952
37040
|
return isAwaitUsingDeclaration();
|
|
37041
|
+
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
|
|
37042
|
+
// however, an identifier cannot be followed by another identifier on the same line. This is what we
|
|
37043
|
+
// count on to parse out the respective declarations. For instance, we exploit this to say that
|
|
37044
|
+
//
|
|
37045
|
+
// namespace n
|
|
37046
|
+
//
|
|
37047
|
+
// can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees
|
|
37048
|
+
//
|
|
37049
|
+
// namespace
|
|
37050
|
+
// n
|
|
37051
|
+
//
|
|
37052
|
+
// as the identifier 'namespace' on one line followed by the identifier 'n' on another.
|
|
37053
|
+
// We need to look one token ahead to see if it permissible to try parsing a declaration.
|
|
37054
|
+
//
|
|
37055
|
+
// *Note*: 'interface' is actually a strict mode reserved word. So while
|
|
37056
|
+
//
|
|
37057
|
+
// "use strict"
|
|
37058
|
+
// interface
|
|
37059
|
+
// I {}
|
|
37060
|
+
//
|
|
37061
|
+
// could be legal, it would add complexity for very little gain.
|
|
36953
37062
|
case 120 /* InterfaceKeyword */:
|
|
36954
37063
|
case 156 /* TypeKeyword */:
|
|
36955
37064
|
return nextTokenIsIdentifierOnSameLine();
|
|
@@ -37022,6 +37131,9 @@ var Parser;
|
|
|
37022
37131
|
case 111 /* ThrowKeyword */:
|
|
37023
37132
|
case 113 /* TryKeyword */:
|
|
37024
37133
|
case 89 /* DebuggerKeyword */:
|
|
37134
|
+
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
|
|
37135
|
+
// however, we say they are here so that we may gracefully parse them and error later.
|
|
37136
|
+
// falls through
|
|
37025
37137
|
case 85 /* CatchKeyword */:
|
|
37026
37138
|
case 98 /* FinallyKeyword */:
|
|
37027
37139
|
return true;
|
|
@@ -37160,6 +37272,8 @@ var Parser;
|
|
|
37160
37272
|
case 111 /* ThrowKeyword */:
|
|
37161
37273
|
return parseThrowStatement();
|
|
37162
37274
|
case 113 /* TryKeyword */:
|
|
37275
|
+
// Include 'catch' and 'finally' for error recovery.
|
|
37276
|
+
// falls through
|
|
37163
37277
|
case 85 /* CatchKeyword */:
|
|
37164
37278
|
case 98 /* FinallyKeyword */:
|
|
37165
37279
|
return parseTryStatement();
|
|
@@ -37578,10 +37692,15 @@ var Parser;
|
|
|
37578
37692
|
}
|
|
37579
37693
|
switch (token()) {
|
|
37580
37694
|
case 21 /* OpenParenToken */:
|
|
37695
|
+
// Method declaration
|
|
37581
37696
|
case 30 /* LessThanToken */:
|
|
37697
|
+
// Generic Method declaration
|
|
37582
37698
|
case 54 /* ExclamationToken */:
|
|
37699
|
+
// Non-null assertion on property name
|
|
37583
37700
|
case 59 /* ColonToken */:
|
|
37701
|
+
// Type Annotation for declaration
|
|
37584
37702
|
case 64 /* EqualsToken */:
|
|
37703
|
+
// Initializer for declaration
|
|
37585
37704
|
case 58 /* QuestionToken */:
|
|
37586
37705
|
return true;
|
|
37587
37706
|
default:
|
|
@@ -38488,6 +38607,7 @@ var Parser;
|
|
|
38488
38607
|
linkEnd = scanner2.getTokenEnd();
|
|
38489
38608
|
break;
|
|
38490
38609
|
}
|
|
38610
|
+
// fallthrough if it's not a {@link sequence
|
|
38491
38611
|
default:
|
|
38492
38612
|
state = 2 /* SavingComments */;
|
|
38493
38613
|
pushComment(scanner2.getTokenText());
|
|
@@ -38746,6 +38866,8 @@ var Parser;
|
|
|
38746
38866
|
indent3 += 1;
|
|
38747
38867
|
break;
|
|
38748
38868
|
}
|
|
38869
|
+
// record the * as a comment
|
|
38870
|
+
// falls through
|
|
38749
38871
|
default:
|
|
38750
38872
|
if (state !== 3 /* SavingBackticks */) {
|
|
38751
38873
|
state = 2 /* SavingComments */;
|
|
@@ -39826,6 +39948,7 @@ function processPragmasIntoFields(context, reportDiagnostic) {
|
|
|
39826
39948
|
case "jsximportsource":
|
|
39827
39949
|
case "jsxruntime":
|
|
39828
39950
|
return;
|
|
39951
|
+
// Accessed directly
|
|
39829
39952
|
default:
|
|
39830
39953
|
Debug.fail("Unhandled pragma kind");
|
|
39831
39954
|
}
|
|
@@ -41682,6 +41805,7 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
|
|
|
41682
41805
|
case "listOrElement":
|
|
41683
41806
|
Debug.fail("listOrElement not supported here");
|
|
41684
41807
|
break;
|
|
41808
|
+
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
|
41685
41809
|
default:
|
|
41686
41810
|
options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
|
|
41687
41811
|
i++;
|
|
@@ -42022,6 +42146,7 @@ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConv
|
|
|
42022
42146
|
return false;
|
|
42023
42147
|
case 106 /* NullKeyword */:
|
|
42024
42148
|
return null;
|
|
42149
|
+
// eslint-disable-line no-restricted-syntax
|
|
42025
42150
|
case 11 /* StringLiteral */:
|
|
42026
42151
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
42027
42152
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
@@ -43228,6 +43353,7 @@ function getOptionValueWithEmptyStrings(value, option) {
|
|
|
43228
43353
|
return typeof value === "boolean" ? value : "";
|
|
43229
43354
|
case "listOrElement":
|
|
43230
43355
|
if (!isArray(value)) return getOptionValueWithEmptyStrings(value, option.element);
|
|
43356
|
+
// fall through to list
|
|
43231
43357
|
case "list":
|
|
43232
43358
|
const elementType = option.element;
|
|
43233
43359
|
return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
|
|
@@ -45880,20 +46006,24 @@ function getModuleInstanceStateCached(node, visited = /* @__PURE__ */ new Map())
|
|
|
45880
46006
|
}
|
|
45881
46007
|
function getModuleInstanceStateWorker(node, visited) {
|
|
45882
46008
|
switch (node.kind) {
|
|
46009
|
+
// 1. interface declarations, type alias declarations
|
|
45883
46010
|
case 264 /* InterfaceDeclaration */:
|
|
45884
46011
|
case 265 /* TypeAliasDeclaration */:
|
|
45885
46012
|
return 0 /* NonInstantiated */;
|
|
46013
|
+
// 2. const enum declarations
|
|
45886
46014
|
case 266 /* EnumDeclaration */:
|
|
45887
46015
|
if (isEnumConst(node)) {
|
|
45888
46016
|
return 2 /* ConstEnumOnly */;
|
|
45889
46017
|
}
|
|
45890
46018
|
break;
|
|
46019
|
+
// 3. non-exported import declarations
|
|
45891
46020
|
case 272 /* ImportDeclaration */:
|
|
45892
46021
|
case 271 /* ImportEqualsDeclaration */:
|
|
45893
46022
|
if (!hasSyntacticModifier(node, 32 /* Export */)) {
|
|
45894
46023
|
return 0 /* NonInstantiated */;
|
|
45895
46024
|
}
|
|
45896
46025
|
break;
|
|
46026
|
+
// 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain
|
|
45897
46027
|
case 278 /* ExportDeclaration */:
|
|
45898
46028
|
const exportDeclaration = node;
|
|
45899
46029
|
if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) {
|
|
@@ -45910,6 +46040,7 @@ function getModuleInstanceStateWorker(node, visited) {
|
|
|
45910
46040
|
return state;
|
|
45911
46041
|
}
|
|
45912
46042
|
break;
|
|
46043
|
+
// 5. other uninstantiated module declarations.
|
|
45913
46044
|
case 268 /* ModuleBlock */: {
|
|
45914
46045
|
let state = 0 /* NonInstantiated */;
|
|
45915
46046
|
forEachChild(node, (n) => {
|
|
@@ -46520,6 +46651,7 @@ function createBinder() {
|
|
|
46520
46651
|
case 351 /* JSDocImportTag */:
|
|
46521
46652
|
bindJSDocImportTag(node);
|
|
46522
46653
|
break;
|
|
46654
|
+
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
|
|
46523
46655
|
case 307 /* SourceFile */: {
|
|
46524
46656
|
bindEachFunctionsFirst(node.statements);
|
|
46525
46657
|
bind(node.endOfFileToken);
|
|
@@ -46540,6 +46672,7 @@ function createBinder() {
|
|
|
46540
46672
|
case 303 /* PropertyAssignment */:
|
|
46541
46673
|
case 230 /* SpreadElement */:
|
|
46542
46674
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
46675
|
+
// falls through
|
|
46543
46676
|
default:
|
|
46544
46677
|
bindEachChild(node);
|
|
46545
46678
|
break;
|
|
@@ -46561,6 +46694,7 @@ function createBinder() {
|
|
|
46561
46694
|
if (isJSDocTypeAssertion(expr)) {
|
|
46562
46695
|
return false;
|
|
46563
46696
|
}
|
|
46697
|
+
// fallthrough
|
|
46564
46698
|
case 235 /* NonNullExpression */:
|
|
46565
46699
|
return isNarrowingExpression(expr.expression);
|
|
46566
46700
|
case 226 /* BinaryExpression */:
|
|
@@ -47392,6 +47526,10 @@ function createBinder() {
|
|
|
47392
47526
|
}
|
|
47393
47527
|
function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
|
|
47394
47528
|
switch (container.kind) {
|
|
47529
|
+
// Modules, source files, and classes need specialized handling for how their
|
|
47530
|
+
// members are declared (for example, a member of a class will go into a specific
|
|
47531
|
+
// symbol table depending on if it is static or not). We defer to specialized
|
|
47532
|
+
// handlers to take care of declaring these child members.
|
|
47395
47533
|
case 267 /* ModuleDeclaration */:
|
|
47396
47534
|
return declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
47397
47535
|
case 307 /* SourceFile */:
|
|
@@ -47533,6 +47671,7 @@ function createBinder() {
|
|
|
47533
47671
|
declareModuleMember(node, symbolFlags, symbolExcludes);
|
|
47534
47672
|
break;
|
|
47535
47673
|
}
|
|
47674
|
+
// falls through
|
|
47536
47675
|
default:
|
|
47537
47676
|
Debug.assertNode(blockScopeContainer, canHaveLocals);
|
|
47538
47677
|
if (!blockScopeContainer.locals) {
|
|
@@ -47853,6 +47992,7 @@ function createBinder() {
|
|
|
47853
47992
|
}
|
|
47854
47993
|
function bindWorker(node) {
|
|
47855
47994
|
switch (node.kind) {
|
|
47995
|
+
/* Strict mode checks */
|
|
47856
47996
|
case 80 /* Identifier */:
|
|
47857
47997
|
if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
|
|
47858
47998
|
let parentNode = node.parent;
|
|
@@ -47862,6 +48002,7 @@ function createBinder() {
|
|
|
47862
48002
|
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
|
47863
48003
|
break;
|
|
47864
48004
|
}
|
|
48005
|
+
// falls through
|
|
47865
48006
|
case 110 /* ThisKeyword */:
|
|
47866
48007
|
if (currentFlow && (isExpression(node) || parent2.kind === 304 /* ShorthandPropertyAssignment */)) {
|
|
47867
48008
|
node.flowNode = currentFlow;
|
|
@@ -47950,6 +48091,7 @@ function createBinder() {
|
|
|
47950
48091
|
return;
|
|
47951
48092
|
case 182 /* TypePredicate */:
|
|
47952
48093
|
break;
|
|
48094
|
+
// Binding the children will handle everything
|
|
47953
48095
|
case 168 /* TypeParameter */:
|
|
47954
48096
|
return bindTypeParameter(node);
|
|
47955
48097
|
case 169 /* Parameter */:
|
|
@@ -48014,6 +48156,7 @@ function createBinder() {
|
|
|
48014
48156
|
return bindObjectDefinePrototypeProperty(node);
|
|
48015
48157
|
case 0 /* None */:
|
|
48016
48158
|
break;
|
|
48159
|
+
// Nothing to do
|
|
48017
48160
|
default:
|
|
48018
48161
|
return Debug.fail("Unknown call expression assignment declaration kind");
|
|
48019
48162
|
}
|
|
@@ -48021,6 +48164,7 @@ function createBinder() {
|
|
|
48021
48164
|
bindCallExpression(node);
|
|
48022
48165
|
}
|
|
48023
48166
|
break;
|
|
48167
|
+
// Members of classes, interfaces, and modules
|
|
48024
48168
|
case 231 /* ClassExpression */:
|
|
48025
48169
|
case 263 /* ClassDeclaration */:
|
|
48026
48170
|
inStrictMode = true;
|
|
@@ -48033,10 +48177,12 @@ function createBinder() {
|
|
|
48033
48177
|
return bindEnumDeclaration(node);
|
|
48034
48178
|
case 267 /* ModuleDeclaration */:
|
|
48035
48179
|
return bindModuleDeclaration(node);
|
|
48180
|
+
// Jsx-attributes
|
|
48036
48181
|
case 292 /* JsxAttributes */:
|
|
48037
48182
|
return bindJsxAttributes(node);
|
|
48038
48183
|
case 291 /* JsxAttribute */:
|
|
48039
48184
|
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
|
48185
|
+
// Imports and exports
|
|
48040
48186
|
case 271 /* ImportEqualsDeclaration */:
|
|
48041
48187
|
case 274 /* NamespaceImport */:
|
|
48042
48188
|
case 276 /* ImportSpecifier */:
|
|
@@ -48057,6 +48203,7 @@ function createBinder() {
|
|
|
48057
48203
|
if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
|
|
48058
48204
|
return;
|
|
48059
48205
|
}
|
|
48206
|
+
// falls through
|
|
48060
48207
|
case 268 /* ModuleBlock */:
|
|
48061
48208
|
return updateStrictModeStatementList(node.statements);
|
|
48062
48209
|
case 341 /* JSDocParameterTag */:
|
|
@@ -48066,6 +48213,7 @@ function createBinder() {
|
|
|
48066
48213
|
if (node.parent.kind !== 322 /* JSDocTypeLiteral */) {
|
|
48067
48214
|
break;
|
|
48068
48215
|
}
|
|
48216
|
+
// falls through
|
|
48069
48217
|
case 348 /* JSDocPropertyTag */:
|
|
48070
48218
|
const propTag = node;
|
|
48071
48219
|
const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */;
|
|
@@ -48278,6 +48426,7 @@ function createBinder() {
|
|
|
48278
48426
|
declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
|
|
48279
48427
|
}
|
|
48280
48428
|
break;
|
|
48429
|
+
// Namespaces are not allowed in javascript files, so do nothing here
|
|
48281
48430
|
case 267 /* ModuleDeclaration */:
|
|
48282
48431
|
break;
|
|
48283
48432
|
default:
|
|
@@ -48774,6 +48923,7 @@ function getContainerFlags(node) {
|
|
|
48774
48923
|
if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
|
|
48775
48924
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */;
|
|
48776
48925
|
}
|
|
48926
|
+
// falls through
|
|
48777
48927
|
case 176 /* Constructor */:
|
|
48778
48928
|
case 262 /* FunctionDeclaration */:
|
|
48779
48929
|
case 173 /* MethodSignature */:
|
|
@@ -51927,6 +52077,7 @@ function createTypeChecker(host) {
|
|
|
51927
52077
|
if (isEntityNameExpression(node.expression)) {
|
|
51928
52078
|
return node.expression;
|
|
51929
52079
|
}
|
|
52080
|
+
// falls through
|
|
51930
52081
|
default:
|
|
51931
52082
|
return void 0;
|
|
51932
52083
|
}
|
|
@@ -53782,6 +53933,7 @@ function createTypeChecker(host) {
|
|
|
53782
53933
|
if (!isExternalOrCommonJsModule(location)) {
|
|
53783
53934
|
break;
|
|
53784
53935
|
}
|
|
53936
|
+
// falls through
|
|
53785
53937
|
case 267 /* ModuleDeclaration */:
|
|
53786
53938
|
const sym = getSymbolOfDeclaration(location);
|
|
53787
53939
|
if (result = callback(
|
|
@@ -55204,6 +55356,9 @@ function createTypeChecker(host) {
|
|
|
55204
55356
|
}
|
|
55205
55357
|
function createTypeNodesFromResolvedType(resolvedType) {
|
|
55206
55358
|
if (checkTruncationLength(context)) {
|
|
55359
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
55360
|
+
return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
|
|
55361
|
+
}
|
|
55207
55362
|
return [factory.createPropertySignature(
|
|
55208
55363
|
/*modifiers*/
|
|
55209
55364
|
void 0,
|
|
@@ -55241,15 +55396,20 @@ function createTypeChecker(host) {
|
|
|
55241
55396
|
}
|
|
55242
55397
|
}
|
|
55243
55398
|
if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
|
|
55244
|
-
|
|
55245
|
-
|
|
55246
|
-
|
|
55247
|
-
|
|
55248
|
-
|
|
55249
|
-
|
|
55250
|
-
|
|
55251
|
-
|
|
55252
|
-
|
|
55399
|
+
if (context.flags & 1 /* NoTruncation */) {
|
|
55400
|
+
const typeElement = typeElements.pop();
|
|
55401
|
+
typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
|
|
55402
|
+
} else {
|
|
55403
|
+
typeElements.push(factory.createPropertySignature(
|
|
55404
|
+
/*modifiers*/
|
|
55405
|
+
void 0,
|
|
55406
|
+
`... ${properties.length - i} more ...`,
|
|
55407
|
+
/*questionToken*/
|
|
55408
|
+
void 0,
|
|
55409
|
+
/*type*/
|
|
55410
|
+
void 0
|
|
55411
|
+
));
|
|
55412
|
+
}
|
|
55253
55413
|
addPropertyToElementList(properties[properties.length - 1], context, typeElements);
|
|
55254
55414
|
break;
|
|
55255
55415
|
}
|
|
@@ -55267,7 +55427,7 @@ function createTypeChecker(host) {
|
|
|
55267
55427
|
void 0
|
|
55268
55428
|
);
|
|
55269
55429
|
}
|
|
55270
|
-
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
55430
|
+
return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided");
|
|
55271
55431
|
}
|
|
55272
55432
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
55273
55433
|
var _a;
|
|
@@ -55403,15 +55563,17 @@ function createTypeChecker(host) {
|
|
|
55403
55563
|
if (some(types)) {
|
|
55404
55564
|
if (checkTruncationLength(context)) {
|
|
55405
55565
|
if (!isBareList) {
|
|
55406
|
-
return [
|
|
55407
|
-
"
|
|
55408
|
-
|
|
55409
|
-
|
|
55410
|
-
|
|
55566
|
+
return [
|
|
55567
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
|
|
55568
|
+
"...",
|
|
55569
|
+
/*typeArguments*/
|
|
55570
|
+
void 0
|
|
55571
|
+
)
|
|
55572
|
+
];
|
|
55411
55573
|
} else if (types.length > 2) {
|
|
55412
55574
|
return [
|
|
55413
55575
|
typeToTypeNodeHelper(types[0], context),
|
|
55414
|
-
factory.createTypeReferenceNode(
|
|
55576
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode(
|
|
55415
55577
|
`... ${types.length - 2} more ...`,
|
|
55416
55578
|
/*typeArguments*/
|
|
55417
55579
|
void 0
|
|
@@ -55427,11 +55589,13 @@ function createTypeChecker(host) {
|
|
|
55427
55589
|
for (const type of types) {
|
|
55428
55590
|
i++;
|
|
55429
55591
|
if (checkTruncationLength(context) && i + 2 < types.length - 1) {
|
|
55430
|
-
result.push(
|
|
55431
|
-
`... ${types.length - i} more
|
|
55432
|
-
|
|
55433
|
-
|
|
55434
|
-
|
|
55592
|
+
result.push(
|
|
55593
|
+
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
|
|
55594
|
+
`... ${types.length - i} more ...`,
|
|
55595
|
+
/*typeArguments*/
|
|
55596
|
+
void 0
|
|
55597
|
+
)
|
|
55598
|
+
);
|
|
55435
55599
|
const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context);
|
|
55436
55600
|
if (typeNode2) {
|
|
55437
55601
|
result.push(typeNode2);
|
|
@@ -58026,6 +58190,7 @@ function createTypeChecker(host) {
|
|
|
58026
58190
|
);
|
|
58027
58191
|
break;
|
|
58028
58192
|
}
|
|
58193
|
+
// else fall through and treat commonjs require just like import=
|
|
58029
58194
|
case 271 /* ImportEqualsDeclaration */:
|
|
58030
58195
|
if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
|
|
58031
58196
|
serializeMaybeAliasAssignment(symbol);
|
|
@@ -58798,6 +58963,7 @@ function createTypeChecker(host) {
|
|
|
58798
58963
|
if (isBindingPattern(node.name) && !node.name.elements.length) {
|
|
58799
58964
|
return false;
|
|
58800
58965
|
}
|
|
58966
|
+
// falls through
|
|
58801
58967
|
case 267 /* ModuleDeclaration */:
|
|
58802
58968
|
case 263 /* ClassDeclaration */:
|
|
58803
58969
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -58822,6 +58988,8 @@ function createTypeChecker(host) {
|
|
|
58822
58988
|
if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
|
|
58823
58989
|
return false;
|
|
58824
58990
|
}
|
|
58991
|
+
// Public properties/methods are visible if its parents are visible, so:
|
|
58992
|
+
// falls through
|
|
58825
58993
|
case 176 /* Constructor */:
|
|
58826
58994
|
case 180 /* ConstructSignature */:
|
|
58827
58995
|
case 179 /* CallSignature */:
|
|
@@ -58839,14 +59007,20 @@ function createTypeChecker(host) {
|
|
|
58839
59007
|
case 196 /* ParenthesizedType */:
|
|
58840
59008
|
case 202 /* NamedTupleMember */:
|
|
58841
59009
|
return isDeclarationVisible(node.parent);
|
|
59010
|
+
// Default binding, import specifier and namespace import is visible
|
|
59011
|
+
// only on demand so by default it is not visible
|
|
58842
59012
|
case 273 /* ImportClause */:
|
|
58843
59013
|
case 274 /* NamespaceImport */:
|
|
58844
59014
|
case 276 /* ImportSpecifier */:
|
|
58845
59015
|
return false;
|
|
59016
|
+
// Type parameters are always visible
|
|
58846
59017
|
case 168 /* TypeParameter */:
|
|
59018
|
+
// Source file and namespace export are always visible
|
|
59019
|
+
// falls through
|
|
58847
59020
|
case 307 /* SourceFile */:
|
|
58848
59021
|
case 270 /* NamespaceExportDeclaration */:
|
|
58849
59022
|
return true;
|
|
59023
|
+
// Export assignments do not create name bindings outside the module
|
|
58850
59024
|
case 277 /* ExportAssignment */:
|
|
58851
59025
|
return false;
|
|
58852
59026
|
default:
|
|
@@ -66396,6 +66570,9 @@ function createTypeChecker(host) {
|
|
|
66396
66570
|
return getTypeFromTemplateTypeNode(node);
|
|
66397
66571
|
case 205 /* ImportType */:
|
|
66398
66572
|
return getTypeFromImportTypeNode(node);
|
|
66573
|
+
// This function assumes that an identifier, qualified name, or property access expression is a type expression
|
|
66574
|
+
// Callers should first ensure this by calling `isPartOfTypeNode`
|
|
66575
|
+
// 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.
|
|
66399
66576
|
case 80 /* Identifier */:
|
|
66400
66577
|
case 166 /* QualifiedName */:
|
|
66401
66578
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -66643,6 +66820,7 @@ function createTypeChecker(host) {
|
|
|
66643
66820
|
return !!tp.isThisType;
|
|
66644
66821
|
case 80 /* Identifier */:
|
|
66645
66822
|
return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp;
|
|
66823
|
+
// use worker because we're looking for === equality
|
|
66646
66824
|
case 186 /* TypeQuery */:
|
|
66647
66825
|
const entityName = node2.exprName;
|
|
66648
66826
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
@@ -67062,6 +67240,7 @@ function createTypeChecker(host) {
|
|
|
67062
67240
|
if (!isConstAssertion(node)) {
|
|
67063
67241
|
break;
|
|
67064
67242
|
}
|
|
67243
|
+
// fallthrough
|
|
67065
67244
|
case 294 /* JsxExpression */:
|
|
67066
67245
|
case 217 /* ParenthesizedExpression */:
|
|
67067
67246
|
return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
|
|
@@ -72381,6 +72560,7 @@ function createTypeChecker(host) {
|
|
|
72381
72560
|
if (isCallExpression(node.parent)) {
|
|
72382
72561
|
return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
|
|
72383
72562
|
}
|
|
72563
|
+
// falls through
|
|
72384
72564
|
default:
|
|
72385
72565
|
if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
72386
72566
|
return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
|
|
@@ -72414,6 +72594,7 @@ function createTypeChecker(host) {
|
|
|
72414
72594
|
const symbol = getResolvedSymbol(node);
|
|
72415
72595
|
return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0;
|
|
72416
72596
|
}
|
|
72597
|
+
// falls through
|
|
72417
72598
|
case 110 /* ThisKeyword */:
|
|
72418
72599
|
return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`;
|
|
72419
72600
|
case 235 /* NonNullExpression */:
|
|
@@ -73967,6 +74148,9 @@ function createTypeChecker(host) {
|
|
|
73967
74148
|
break;
|
|
73968
74149
|
case 28 /* CommaToken */:
|
|
73969
74150
|
return narrowType(type, expr.right, assumeTrue);
|
|
74151
|
+
// Ordinarily we won't see && and || expressions in control flow analysis because the Binder breaks those
|
|
74152
|
+
// expressions down to individual conditional control flows. However, we may encounter them when analyzing
|
|
74153
|
+
// aliased conditional expressions.
|
|
73970
74154
|
case 56 /* AmpersandAmpersandToken */:
|
|
73971
74155
|
return assumeTrue ? narrowType(
|
|
73972
74156
|
narrowType(
|
|
@@ -74410,6 +74594,7 @@ function createTypeChecker(host) {
|
|
|
74410
74594
|
}
|
|
74411
74595
|
}
|
|
74412
74596
|
}
|
|
74597
|
+
// falls through
|
|
74413
74598
|
case 110 /* ThisKeyword */:
|
|
74414
74599
|
case 108 /* SuperKeyword */:
|
|
74415
74600
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -82228,6 +82413,7 @@ function createTypeChecker(host) {
|
|
|
82228
82413
|
hasError = true;
|
|
82229
82414
|
break;
|
|
82230
82415
|
}
|
|
82416
|
+
// fallthrough
|
|
82231
82417
|
case 7 /* ES2022 */:
|
|
82232
82418
|
case 99 /* ESNext */:
|
|
82233
82419
|
case 200 /* Preserve */:
|
|
@@ -82235,6 +82421,7 @@ function createTypeChecker(host) {
|
|
|
82235
82421
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
82236
82422
|
break;
|
|
82237
82423
|
}
|
|
82424
|
+
// fallthrough
|
|
82238
82425
|
default:
|
|
82239
82426
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
82240
82427
|
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;
|
|
@@ -82652,9 +82839,13 @@ function createTypeChecker(host) {
|
|
|
82652
82839
|
return true;
|
|
82653
82840
|
}
|
|
82654
82841
|
return false;
|
|
82842
|
+
// Some forms listed here for clarity
|
|
82655
82843
|
case 222 /* VoidExpression */:
|
|
82844
|
+
// Explicit opt-out
|
|
82656
82845
|
case 216 /* TypeAssertionExpression */:
|
|
82846
|
+
// Not SEF, but can produce useful type warnings
|
|
82657
82847
|
case 234 /* AsExpression */:
|
|
82848
|
+
// Not SEF, but can produce useful type warnings
|
|
82658
82849
|
default:
|
|
82659
82850
|
return false;
|
|
82660
82851
|
}
|
|
@@ -83900,6 +84091,7 @@ function createTypeChecker(host) {
|
|
|
83900
84091
|
if (node.expression.kind === 102 /* ImportKeyword */) {
|
|
83901
84092
|
return checkImportCallExpression(node);
|
|
83902
84093
|
}
|
|
84094
|
+
// falls through
|
|
83903
84095
|
case 214 /* NewExpression */:
|
|
83904
84096
|
return checkCallExpression(node, checkMode);
|
|
83905
84097
|
case 215 /* TaggedTemplateExpression */:
|
|
@@ -84269,6 +84461,7 @@ function createTypeChecker(host) {
|
|
|
84269
84461
|
if (useDefineForClassFields) {
|
|
84270
84462
|
break;
|
|
84271
84463
|
}
|
|
84464
|
+
// fall through
|
|
84272
84465
|
case "prototype":
|
|
84273
84466
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
84274
84467
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
@@ -85012,6 +85205,8 @@ function createTypeChecker(host) {
|
|
|
85012
85205
|
switch (d.kind) {
|
|
85013
85206
|
case 264 /* InterfaceDeclaration */:
|
|
85014
85207
|
case 265 /* TypeAliasDeclaration */:
|
|
85208
|
+
// A jsdoc typedef and callback are, by definition, type aliases.
|
|
85209
|
+
// falls through
|
|
85015
85210
|
case 346 /* JSDocTypedefTag */:
|
|
85016
85211
|
case 338 /* JSDocCallbackTag */:
|
|
85017
85212
|
case 340 /* JSDocEnumTag */:
|
|
@@ -85032,6 +85227,8 @@ function createTypeChecker(host) {
|
|
|
85032
85227
|
return 1 /* ExportValue */;
|
|
85033
85228
|
}
|
|
85034
85229
|
d = expression;
|
|
85230
|
+
// The below options all declare an Alias, which is allowed to merge with other values within the importing module.
|
|
85231
|
+
// falls through
|
|
85035
85232
|
case 271 /* ImportEqualsDeclaration */:
|
|
85036
85233
|
case 274 /* NamespaceImport */:
|
|
85037
85234
|
case 273 /* ImportClause */:
|
|
@@ -85045,6 +85242,7 @@ function createTypeChecker(host) {
|
|
|
85045
85242
|
case 208 /* BindingElement */:
|
|
85046
85243
|
case 262 /* FunctionDeclaration */:
|
|
85047
85244
|
case 276 /* ImportSpecifier */:
|
|
85245
|
+
// https://github.com/Microsoft/TypeScript/pull/7591
|
|
85048
85246
|
case 80 /* Identifier */:
|
|
85049
85247
|
return 1 /* ExportValue */;
|
|
85050
85248
|
case 173 /* MethodSignature */:
|
|
@@ -85393,6 +85591,7 @@ function createTypeChecker(host) {
|
|
|
85393
85591
|
headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
85394
85592
|
break;
|
|
85395
85593
|
}
|
|
85594
|
+
// falls through
|
|
85396
85595
|
case 169 /* Parameter */:
|
|
85397
85596
|
headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
85398
85597
|
break;
|
|
@@ -88614,6 +88813,7 @@ function createTypeChecker(host) {
|
|
|
88614
88813
|
break;
|
|
88615
88814
|
case 271 /* ImportEqualsDeclaration */:
|
|
88616
88815
|
if (isInternalModuleImportEqualsDeclaration(node)) break;
|
|
88816
|
+
// falls through
|
|
88617
88817
|
case 272 /* ImportDeclaration */:
|
|
88618
88818
|
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
|
|
88619
88819
|
break;
|
|
@@ -88626,6 +88826,7 @@ function createTypeChecker(host) {
|
|
|
88626
88826
|
}
|
|
88627
88827
|
break;
|
|
88628
88828
|
}
|
|
88829
|
+
// falls through
|
|
88629
88830
|
case 263 /* ClassDeclaration */:
|
|
88630
88831
|
case 266 /* EnumDeclaration */:
|
|
88631
88832
|
case 262 /* FunctionDeclaration */:
|
|
@@ -89302,6 +89503,7 @@ function createTypeChecker(host) {
|
|
|
89302
89503
|
return checkJSDocPropertyTag(node);
|
|
89303
89504
|
case 317 /* JSDocFunctionType */:
|
|
89304
89505
|
checkJSDocFunctionType(node);
|
|
89506
|
+
// falls through
|
|
89305
89507
|
case 315 /* JSDocNonNullableType */:
|
|
89306
89508
|
case 314 /* JSDocNullableType */:
|
|
89307
89509
|
case 312 /* JSDocAllType */:
|
|
@@ -89725,6 +89927,7 @@ function createTypeChecker(host) {
|
|
|
89725
89927
|
switch (location.kind) {
|
|
89726
89928
|
case 307 /* SourceFile */:
|
|
89727
89929
|
if (!isExternalModule(location)) break;
|
|
89930
|
+
// falls through
|
|
89728
89931
|
case 267 /* ModuleDeclaration */:
|
|
89729
89932
|
copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */);
|
|
89730
89933
|
break;
|
|
@@ -89736,6 +89939,9 @@ function createTypeChecker(host) {
|
|
|
89736
89939
|
if (className) {
|
|
89737
89940
|
copySymbol(location.symbol, meaning);
|
|
89738
89941
|
}
|
|
89942
|
+
// this fall-through is necessary because we would like to handle
|
|
89943
|
+
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration.
|
|
89944
|
+
// falls through
|
|
89739
89945
|
case 263 /* ClassDeclaration */:
|
|
89740
89946
|
case 264 /* InterfaceDeclaration */:
|
|
89741
89947
|
if (!isStaticSymbol) {
|
|
@@ -89844,6 +90050,7 @@ function createTypeChecker(host) {
|
|
|
89844
90050
|
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
89845
90051
|
return void 0;
|
|
89846
90052
|
}
|
|
90053
|
+
// falls through
|
|
89847
90054
|
case 4 /* ThisProperty */:
|
|
89848
90055
|
case 2 /* ModuleExports */:
|
|
89849
90056
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
@@ -90137,6 +90344,7 @@ function createTypeChecker(host) {
|
|
|
90137
90344
|
if (!isThisInTypeQuery(node)) {
|
|
90138
90345
|
return getSymbolOfNameOrPropertyAccessExpression(node);
|
|
90139
90346
|
}
|
|
90347
|
+
// falls through
|
|
90140
90348
|
case 110 /* ThisKeyword */:
|
|
90141
90349
|
const container = getThisContainer(
|
|
90142
90350
|
node,
|
|
@@ -90154,6 +90362,7 @@ function createTypeChecker(host) {
|
|
|
90154
90362
|
if (isInExpressionContext(node)) {
|
|
90155
90363
|
return checkExpression(node).symbol;
|
|
90156
90364
|
}
|
|
90365
|
+
// falls through
|
|
90157
90366
|
case 197 /* ThisType */:
|
|
90158
90367
|
return getTypeFromThisTypeNode(node).symbol;
|
|
90159
90368
|
case 108 /* SuperKeyword */:
|
|
@@ -90176,6 +90385,7 @@ function createTypeChecker(host) {
|
|
|
90176
90385
|
if (isCallExpression(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) {
|
|
90177
90386
|
return getSymbolOfDeclaration(parent2);
|
|
90178
90387
|
}
|
|
90388
|
+
// falls through
|
|
90179
90389
|
case 9 /* NumericLiteral */:
|
|
90180
90390
|
const objectType = isElementAccessExpression(parent2) ? parent2.argumentExpression === node ? getTypeOfExpression(parent2.expression) : void 0 : isLiteralTypeNode(parent2) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0;
|
|
90181
90391
|
return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text));
|
|
@@ -90205,6 +90415,7 @@ function createTypeChecker(host) {
|
|
|
90205
90415
|
const symbol = getIntrinsicTagSymbol(node.parent);
|
|
90206
90416
|
return symbol === unknownSymbol ? void 0 : symbol;
|
|
90207
90417
|
}
|
|
90418
|
+
// falls through
|
|
90208
90419
|
default:
|
|
90209
90420
|
return void 0;
|
|
90210
90421
|
}
|
|
@@ -92299,6 +92510,7 @@ function createTypeChecker(host) {
|
|
|
92299
92510
|
);
|
|
92300
92511
|
break;
|
|
92301
92512
|
}
|
|
92513
|
+
// fallthrough
|
|
92302
92514
|
case 7 /* ES2022 */:
|
|
92303
92515
|
case 99 /* ESNext */:
|
|
92304
92516
|
case 200 /* Preserve */:
|
|
@@ -92306,6 +92518,7 @@ function createTypeChecker(host) {
|
|
|
92306
92518
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
92307
92519
|
break;
|
|
92308
92520
|
}
|
|
92521
|
+
// fallthrough
|
|
92309
92522
|
default:
|
|
92310
92523
|
diagnostics.add(
|
|
92311
92524
|
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)
|
|
@@ -94482,13 +94695,13 @@ var visitEachChildTable = {
|
|
|
94482
94695
|
);
|
|
94483
94696
|
},
|
|
94484
94697
|
// Transformation nodes
|
|
94485
|
-
[
|
|
94698
|
+
[355 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
94486
94699
|
return context.factory.updatePartiallyEmittedExpression(
|
|
94487
94700
|
node,
|
|
94488
94701
|
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
|
|
94489
94702
|
);
|
|
94490
94703
|
},
|
|
94491
|
-
[
|
|
94704
|
+
[356 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
94492
94705
|
return context.factory.updateCommaListExpression(
|
|
94493
94706
|
node,
|
|
94494
94707
|
nodesVisitor(node.elements, visitor, isExpression)
|
|
@@ -96594,6 +96807,8 @@ function transformTypeScript(context) {
|
|
|
96594
96807
|
case 148 /* ReadonlyKeyword */:
|
|
96595
96808
|
case 103 /* InKeyword */:
|
|
96596
96809
|
case 147 /* OutKeyword */:
|
|
96810
|
+
// TypeScript accessibility and readonly modifiers are elided
|
|
96811
|
+
// falls through
|
|
96597
96812
|
case 188 /* ArrayType */:
|
|
96598
96813
|
case 189 /* TupleType */:
|
|
96599
96814
|
case 190 /* OptionalType */:
|
|
@@ -96622,6 +96837,8 @@ function transformTypeScript(context) {
|
|
|
96622
96837
|
case 199 /* IndexedAccessType */:
|
|
96623
96838
|
case 200 /* MappedType */:
|
|
96624
96839
|
case 201 /* LiteralType */:
|
|
96840
|
+
// TypeScript type nodes are elided.
|
|
96841
|
+
// falls through
|
|
96625
96842
|
case 181 /* IndexSignature */:
|
|
96626
96843
|
return void 0;
|
|
96627
96844
|
case 265 /* TypeAliasDeclaration */:
|
|
@@ -98304,7 +98521,7 @@ function transformClassFields(context) {
|
|
|
98304
98521
|
/*discarded*/
|
|
98305
98522
|
true
|
|
98306
98523
|
);
|
|
98307
|
-
case
|
|
98524
|
+
case 356 /* CommaListExpression */:
|
|
98308
98525
|
return visitCommaListExpression(
|
|
98309
98526
|
node,
|
|
98310
98527
|
/*discarded*/
|
|
@@ -100244,6 +100461,7 @@ function transformClassFields(context) {
|
|
|
100244
100461
|
if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) {
|
|
100245
100462
|
break;
|
|
100246
100463
|
}
|
|
100464
|
+
// falls through
|
|
100247
100465
|
case 262 /* FunctionDeclaration */:
|
|
100248
100466
|
case 176 /* Constructor */:
|
|
100249
100467
|
case 177 /* GetAccessor */:
|
|
@@ -100519,6 +100737,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
100519
100737
|
case 197 /* ThisType */:
|
|
100520
100738
|
case 205 /* ImportType */:
|
|
100521
100739
|
break;
|
|
100740
|
+
// handle JSDoc types from an invalid parse
|
|
100522
100741
|
case 312 /* JSDocAllType */:
|
|
100523
100742
|
case 313 /* JSDocUnknownType */:
|
|
100524
100743
|
case 317 /* JSDocFunctionType */:
|
|
@@ -101364,6 +101583,7 @@ function transformESDecorators(context) {
|
|
|
101364
101583
|
return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
|
|
101365
101584
|
case 169 /* Parameter */:
|
|
101366
101585
|
return visitParameterDeclaration(node);
|
|
101586
|
+
// Support NamedEvaluation to ensure the correct class name for class expressions.
|
|
101367
101587
|
case 226 /* BinaryExpression */:
|
|
101368
101588
|
return visitBinaryExpression(
|
|
101369
101589
|
node,
|
|
@@ -101384,7 +101604,7 @@ function transformESDecorators(context) {
|
|
|
101384
101604
|
return visitForStatement(node);
|
|
101385
101605
|
case 244 /* ExpressionStatement */:
|
|
101386
101606
|
return visitExpressionStatement(node);
|
|
101387
|
-
case
|
|
101607
|
+
case 356 /* CommaListExpression */:
|
|
101388
101608
|
return visitCommaListExpression(
|
|
101389
101609
|
node,
|
|
101390
101610
|
/*discarded*/
|
|
@@ -101396,7 +101616,7 @@ function transformESDecorators(context) {
|
|
|
101396
101616
|
/*discarded*/
|
|
101397
101617
|
false
|
|
101398
101618
|
);
|
|
101399
|
-
case
|
|
101619
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
101400
101620
|
return visitPartiallyEmittedExpression(
|
|
101401
101621
|
node,
|
|
101402
101622
|
/*discarded*/
|
|
@@ -101420,6 +101640,7 @@ function transformESDecorators(context) {
|
|
|
101420
101640
|
case 167 /* ComputedPropertyName */:
|
|
101421
101641
|
return visitComputedPropertyName(node);
|
|
101422
101642
|
case 174 /* MethodDeclaration */:
|
|
101643
|
+
// object literal methods and accessors
|
|
101423
101644
|
case 178 /* SetAccessor */:
|
|
101424
101645
|
case 177 /* GetAccessor */:
|
|
101425
101646
|
case 218 /* FunctionExpression */:
|
|
@@ -101482,7 +101703,7 @@ function transformESDecorators(context) {
|
|
|
101482
101703
|
/*discarded*/
|
|
101483
101704
|
true
|
|
101484
101705
|
);
|
|
101485
|
-
case
|
|
101706
|
+
case 356 /* CommaListExpression */:
|
|
101486
101707
|
return visitCommaListExpression(
|
|
101487
101708
|
node,
|
|
101488
101709
|
/*discarded*/
|
|
@@ -104064,7 +104285,7 @@ function transformES2018(context) {
|
|
|
104064
104285
|
return visitObjectLiteralExpression(node);
|
|
104065
104286
|
case 226 /* BinaryExpression */:
|
|
104066
104287
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
104067
|
-
case
|
|
104288
|
+
case 356 /* CommaListExpression */:
|
|
104068
104289
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
104069
104290
|
case 299 /* CatchClause */:
|
|
104070
104291
|
return visitCatchClause(node);
|
|
@@ -107204,6 +107425,7 @@ function transformES2015(context) {
|
|
|
107204
107425
|
switch (node.kind) {
|
|
107205
107426
|
case 126 /* StaticKeyword */:
|
|
107206
107427
|
return void 0;
|
|
107428
|
+
// elide static keyword
|
|
107207
107429
|
case 263 /* ClassDeclaration */:
|
|
107208
107430
|
return visitClassDeclaration(node);
|
|
107209
107431
|
case 231 /* ClassExpression */:
|
|
@@ -107282,7 +107504,7 @@ function transformES2015(context) {
|
|
|
107282
107504
|
return visitParenthesizedExpression(node, expressionResultIsUnused2);
|
|
107283
107505
|
case 226 /* BinaryExpression */:
|
|
107284
107506
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
107285
|
-
case
|
|
107507
|
+
case 356 /* CommaListExpression */:
|
|
107286
107508
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
107287
107509
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
107288
107510
|
case 16 /* TemplateHead */:
|
|
@@ -107666,12 +107888,14 @@ function transformES2015(context) {
|
|
|
107666
107888
|
return false;
|
|
107667
107889
|
}
|
|
107668
107890
|
switch (node.kind) {
|
|
107891
|
+
// stop at function boundaries
|
|
107669
107892
|
case 219 /* ArrowFunction */:
|
|
107670
107893
|
case 218 /* FunctionExpression */:
|
|
107671
107894
|
case 262 /* FunctionDeclaration */:
|
|
107672
107895
|
case 176 /* Constructor */:
|
|
107673
107896
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
107674
107897
|
return false;
|
|
107898
|
+
// only step into computed property names for class and object literal elements
|
|
107675
107899
|
case 177 /* GetAccessor */:
|
|
107676
107900
|
case 178 /* SetAccessor */:
|
|
107677
107901
|
case 174 /* MethodDeclaration */:
|
|
@@ -107880,12 +108104,14 @@ function transformES2015(context) {
|
|
|
107880
108104
|
return factory2.createPartiallyEmittedExpression(node.right, node);
|
|
107881
108105
|
}
|
|
107882
108106
|
switch (node.kind) {
|
|
108107
|
+
// stop at function boundaries
|
|
107883
108108
|
case 219 /* ArrowFunction */:
|
|
107884
108109
|
case 218 /* FunctionExpression */:
|
|
107885
108110
|
case 262 /* FunctionDeclaration */:
|
|
107886
108111
|
case 176 /* Constructor */:
|
|
107887
108112
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
107888
108113
|
return node;
|
|
108114
|
+
// only step into computed property names for class and object literal elements
|
|
107889
108115
|
case 177 /* GetAccessor */:
|
|
107890
108116
|
case 178 /* SetAccessor */:
|
|
107891
108117
|
case 174 /* MethodDeclaration */:
|
|
@@ -107931,12 +108157,14 @@ function transformES2015(context) {
|
|
|
107931
108157
|
);
|
|
107932
108158
|
}
|
|
107933
108159
|
switch (node.kind) {
|
|
108160
|
+
// stop at function boundaries
|
|
107934
108161
|
case 219 /* ArrowFunction */:
|
|
107935
108162
|
case 218 /* FunctionExpression */:
|
|
107936
108163
|
case 262 /* FunctionDeclaration */:
|
|
107937
108164
|
case 176 /* Constructor */:
|
|
107938
108165
|
case 175 /* ClassStaticBlockDeclaration */:
|
|
107939
108166
|
return node;
|
|
108167
|
+
// only step into computed property names for class and object literal elements
|
|
107940
108168
|
case 177 /* GetAccessor */:
|
|
107941
108169
|
case 178 /* SetAccessor */:
|
|
107942
108170
|
case 174 /* MethodDeclaration */:
|
|
@@ -110568,7 +110796,7 @@ function transformGenerators(context) {
|
|
|
110568
110796
|
switch (node.kind) {
|
|
110569
110797
|
case 226 /* BinaryExpression */:
|
|
110570
110798
|
return visitBinaryExpression(node);
|
|
110571
|
-
case
|
|
110799
|
+
case 356 /* CommaListExpression */:
|
|
110572
110800
|
return visitCommaListExpression(node);
|
|
110573
110801
|
case 227 /* ConditionalExpression */:
|
|
110574
110802
|
return visitConditionalExpression(node);
|
|
@@ -112959,7 +113187,7 @@ function transformModule(context) {
|
|
|
112959
113187
|
return visitExpressionStatement(node);
|
|
112960
113188
|
case 217 /* ParenthesizedExpression */:
|
|
112961
113189
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
112962
|
-
case
|
|
113190
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
112963
113191
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
112964
113192
|
case 213 /* CallExpression */:
|
|
112965
113193
|
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
@@ -114719,6 +114947,7 @@ function transformSystemModule(context) {
|
|
|
114719
114947
|
if (!entry.importClause) {
|
|
114720
114948
|
break;
|
|
114721
114949
|
}
|
|
114950
|
+
// falls through
|
|
114722
114951
|
case 271 /* ImportEqualsDeclaration */:
|
|
114723
114952
|
Debug.assert(importVariableName !== void 0);
|
|
114724
114953
|
statements.push(
|
|
@@ -115353,7 +115582,7 @@ function transformSystemModule(context) {
|
|
|
115353
115582
|
return visitExpressionStatement(node);
|
|
115354
115583
|
case 217 /* ParenthesizedExpression */:
|
|
115355
115584
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
115356
|
-
case
|
|
115585
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
115357
115586
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
115358
115587
|
case 226 /* BinaryExpression */:
|
|
115359
115588
|
if (isDestructuringAssignment(node)) {
|
|
@@ -116952,6 +117181,7 @@ function transformDeclarations(context) {
|
|
|
116952
117181
|
case 265 /* TypeAliasDeclaration */:
|
|
116953
117182
|
case 266 /* EnumDeclaration */:
|
|
116954
117183
|
return !resolver.isDeclarationVisible(node);
|
|
117184
|
+
// The following should be doing their own visibility checks based on filtering their members
|
|
116955
117185
|
case 260 /* VariableDeclaration */:
|
|
116956
117186
|
return !getBindingNameVisible(node);
|
|
116957
117187
|
case 271 /* ImportEqualsDeclaration */:
|
|
@@ -118233,7 +118463,7 @@ function noEmitNotification(hint, node, callback) {
|
|
|
118233
118463
|
}
|
|
118234
118464
|
function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
|
|
118235
118465
|
var _a, _b;
|
|
118236
|
-
const enabledSyntaxKindFeatures = new Array(
|
|
118466
|
+
const enabledSyntaxKindFeatures = new Array(358 /* Count */);
|
|
118237
118467
|
let lexicalEnvironmentVariableDeclarations;
|
|
118238
118468
|
let lexicalEnvironmentFunctionDeclarations;
|
|
118239
118469
|
let lexicalEnvironmentStatements;
|
|
@@ -119447,6 +119677,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119447
119677
|
if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
|
|
119448
119678
|
return pipelineEmitWithNotification;
|
|
119449
119679
|
}
|
|
119680
|
+
// falls through
|
|
119450
119681
|
case 1 /* Substitution */:
|
|
119451
119682
|
if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
|
|
119452
119683
|
if (currentParenthesizerRule) {
|
|
@@ -119454,14 +119685,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119454
119685
|
}
|
|
119455
119686
|
return pipelineEmitWithSubstitution;
|
|
119456
119687
|
}
|
|
119688
|
+
// falls through
|
|
119457
119689
|
case 2 /* Comments */:
|
|
119458
119690
|
if (shouldEmitComments(node)) {
|
|
119459
119691
|
return pipelineEmitWithComments;
|
|
119460
119692
|
}
|
|
119693
|
+
// falls through
|
|
119461
119694
|
case 3 /* SourceMaps */:
|
|
119462
119695
|
if (shouldEmitSourceMaps(node)) {
|
|
119463
119696
|
return pipelineEmitWithSourceMaps;
|
|
119464
119697
|
}
|
|
119698
|
+
// falls through
|
|
119465
119699
|
case 4 /* Emit */:
|
|
119466
119700
|
return pipelineEmitWithHint;
|
|
119467
119701
|
default:
|
|
@@ -119513,6 +119747,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119513
119747
|
}
|
|
119514
119748
|
if (hint === 4 /* Unspecified */) {
|
|
119515
119749
|
switch (node.kind) {
|
|
119750
|
+
// Pseudo-literals
|
|
119516
119751
|
case 16 /* TemplateHead */:
|
|
119517
119752
|
case 17 /* TemplateMiddle */:
|
|
119518
119753
|
case 18 /* TemplateTail */:
|
|
@@ -119521,20 +119756,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119521
119756
|
/*jsxAttributeEscape*/
|
|
119522
119757
|
false
|
|
119523
119758
|
);
|
|
119759
|
+
// Identifiers
|
|
119524
119760
|
case 80 /* Identifier */:
|
|
119525
119761
|
return emitIdentifier(node);
|
|
119762
|
+
// PrivateIdentifiers
|
|
119526
119763
|
case 81 /* PrivateIdentifier */:
|
|
119527
119764
|
return emitPrivateIdentifier(node);
|
|
119765
|
+
// Parse tree nodes
|
|
119766
|
+
// Names
|
|
119528
119767
|
case 166 /* QualifiedName */:
|
|
119529
119768
|
return emitQualifiedName(node);
|
|
119530
119769
|
case 167 /* ComputedPropertyName */:
|
|
119531
119770
|
return emitComputedPropertyName(node);
|
|
119771
|
+
// Signature elements
|
|
119532
119772
|
case 168 /* TypeParameter */:
|
|
119533
119773
|
return emitTypeParameter(node);
|
|
119534
119774
|
case 169 /* Parameter */:
|
|
119535
119775
|
return emitParameter(node);
|
|
119536
119776
|
case 170 /* Decorator */:
|
|
119537
119777
|
return emitDecorator(node);
|
|
119778
|
+
// Type members
|
|
119538
119779
|
case 171 /* PropertySignature */:
|
|
119539
119780
|
return emitPropertySignature(node);
|
|
119540
119781
|
case 172 /* PropertyDeclaration */:
|
|
@@ -119556,6 +119797,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119556
119797
|
return emitConstructSignature(node);
|
|
119557
119798
|
case 181 /* IndexSignature */:
|
|
119558
119799
|
return emitIndexSignature(node);
|
|
119800
|
+
// Types
|
|
119559
119801
|
case 182 /* TypePredicate */:
|
|
119560
119802
|
return emitTypePredicate(node);
|
|
119561
119803
|
case 183 /* TypeReference */:
|
|
@@ -119574,6 +119816,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119574
119816
|
return emitTupleType(node);
|
|
119575
119817
|
case 190 /* OptionalType */:
|
|
119576
119818
|
return emitOptionalType(node);
|
|
119819
|
+
// SyntaxKind.RestType is handled below
|
|
119577
119820
|
case 192 /* UnionType */:
|
|
119578
119821
|
return emitUnionType(node);
|
|
119579
119822
|
case 193 /* IntersectionType */:
|
|
@@ -119604,16 +119847,19 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119604
119847
|
return emitTemplateTypeSpan(node);
|
|
119605
119848
|
case 205 /* ImportType */:
|
|
119606
119849
|
return emitImportTypeNode(node);
|
|
119850
|
+
// Binding patterns
|
|
119607
119851
|
case 206 /* ObjectBindingPattern */:
|
|
119608
119852
|
return emitObjectBindingPattern(node);
|
|
119609
119853
|
case 207 /* ArrayBindingPattern */:
|
|
119610
119854
|
return emitArrayBindingPattern(node);
|
|
119611
119855
|
case 208 /* BindingElement */:
|
|
119612
119856
|
return emitBindingElement(node);
|
|
119857
|
+
// Misc
|
|
119613
119858
|
case 239 /* TemplateSpan */:
|
|
119614
119859
|
return emitTemplateSpan(node);
|
|
119615
119860
|
case 240 /* SemicolonClassElement */:
|
|
119616
119861
|
return emitSemicolonClassElement();
|
|
119862
|
+
// Statements
|
|
119617
119863
|
case 241 /* Block */:
|
|
119618
119864
|
return emitBlock(node);
|
|
119619
119865
|
case 243 /* VariableStatement */:
|
|
@@ -119655,6 +119901,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119655
119901
|
return emitTryStatement(node);
|
|
119656
119902
|
case 259 /* DebuggerStatement */:
|
|
119657
119903
|
return emitDebuggerStatement(node);
|
|
119904
|
+
// Declarations
|
|
119658
119905
|
case 260 /* VariableDeclaration */:
|
|
119659
119906
|
return emitVariableDeclaration(node);
|
|
119660
119907
|
case 261 /* VariableDeclarationList */:
|
|
@@ -119705,8 +119952,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119705
119952
|
return emitImportAttribute(node);
|
|
119706
119953
|
case 282 /* MissingDeclaration */:
|
|
119707
119954
|
return;
|
|
119955
|
+
// Module references
|
|
119708
119956
|
case 283 /* ExternalModuleReference */:
|
|
119709
119957
|
return emitExternalModuleReference(node);
|
|
119958
|
+
// JSX (non-expression)
|
|
119710
119959
|
case 12 /* JsxText */:
|
|
119711
119960
|
return emitJsxText(node);
|
|
119712
119961
|
case 286 /* JsxOpeningElement */:
|
|
@@ -119725,6 +119974,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119725
119974
|
return emitJsxExpression(node);
|
|
119726
119975
|
case 295 /* JsxNamespacedName */:
|
|
119727
119976
|
return emitJsxNamespacedName(node);
|
|
119977
|
+
// Clauses
|
|
119728
119978
|
case 296 /* CaseClause */:
|
|
119729
119979
|
return emitCaseClause(node);
|
|
119730
119980
|
case 297 /* DefaultClause */:
|
|
@@ -119733,18 +119983,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119733
119983
|
return emitHeritageClause(node);
|
|
119734
119984
|
case 299 /* CatchClause */:
|
|
119735
119985
|
return emitCatchClause(node);
|
|
119986
|
+
// Property assignments
|
|
119736
119987
|
case 303 /* PropertyAssignment */:
|
|
119737
119988
|
return emitPropertyAssignment(node);
|
|
119738
119989
|
case 304 /* ShorthandPropertyAssignment */:
|
|
119739
119990
|
return emitShorthandPropertyAssignment(node);
|
|
119740
119991
|
case 305 /* SpreadAssignment */:
|
|
119741
119992
|
return emitSpreadAssignment(node);
|
|
119993
|
+
// Enum
|
|
119742
119994
|
case 306 /* EnumMember */:
|
|
119743
119995
|
return emitEnumMember(node);
|
|
119996
|
+
// Top-level nodes
|
|
119744
119997
|
case 307 /* SourceFile */:
|
|
119745
119998
|
return emitSourceFile(node);
|
|
119746
119999
|
case 308 /* Bundle */:
|
|
119747
120000
|
return Debug.fail("Bundles should be printed using printBundle");
|
|
120001
|
+
// JSDoc nodes (only used in codefixes currently)
|
|
119748
120002
|
case 309 /* JSDocTypeExpression */:
|
|
119749
120003
|
return emitJSDocTypeExpression(node);
|
|
119750
120004
|
case 310 /* JSDocNameReference */:
|
|
@@ -119782,6 +120036,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119782
120036
|
case 330 /* JSDocAuthorTag */:
|
|
119783
120037
|
case 331 /* JSDocDeprecatedTag */:
|
|
119784
120038
|
return;
|
|
120039
|
+
// SyntaxKind.JSDocClassTag (see JSDocTag, above)
|
|
119785
120040
|
case 333 /* JSDocPublicTag */:
|
|
119786
120041
|
case 334 /* JSDocPrivateTag */:
|
|
119787
120042
|
case 335 /* JSDocProtectedTag */:
|
|
@@ -119791,6 +120046,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119791
120046
|
return emitJSDocCallbackTag(node);
|
|
119792
120047
|
case 339 /* JSDocOverloadTag */:
|
|
119793
120048
|
return emitJSDocOverloadTag(node);
|
|
120049
|
+
// SyntaxKind.JSDocEnumTag (see below)
|
|
119794
120050
|
case 341 /* JSDocParameterTag */:
|
|
119795
120051
|
case 348 /* JSDocPropertyTag */:
|
|
119796
120052
|
return emitJSDocPropertyLikeTag(node);
|
|
@@ -119809,7 +120065,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119809
120065
|
return emitJSDocSeeTag(node);
|
|
119810
120066
|
case 351 /* JSDocImportTag */:
|
|
119811
120067
|
return emitJSDocImportTag(node);
|
|
120068
|
+
// SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above)
|
|
120069
|
+
// Transformation nodes
|
|
119812
120070
|
case 353 /* NotEmittedStatement */:
|
|
120071
|
+
case 354 /* NotEmittedTypeElement */:
|
|
119813
120072
|
return;
|
|
119814
120073
|
}
|
|
119815
120074
|
if (isExpression(node)) {
|
|
@@ -119827,6 +120086,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119827
120086
|
}
|
|
119828
120087
|
if (hint === 1 /* Expression */) {
|
|
119829
120088
|
switch (node.kind) {
|
|
120089
|
+
// Literals
|
|
119830
120090
|
case 9 /* NumericLiteral */:
|
|
119831
120091
|
case 10 /* BigIntLiteral */:
|
|
119832
120092
|
return emitNumericOrBigIntLiteral(node);
|
|
@@ -119838,10 +120098,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119838
120098
|
/*jsxAttributeEscape*/
|
|
119839
120099
|
false
|
|
119840
120100
|
);
|
|
120101
|
+
// Identifiers
|
|
119841
120102
|
case 80 /* Identifier */:
|
|
119842
120103
|
return emitIdentifier(node);
|
|
119843
120104
|
case 81 /* PrivateIdentifier */:
|
|
119844
120105
|
return emitPrivateIdentifier(node);
|
|
120106
|
+
// Expressions
|
|
119845
120107
|
case 209 /* ArrayLiteralExpression */:
|
|
119846
120108
|
return emitArrayLiteralExpression(node);
|
|
119847
120109
|
case 210 /* ObjectLiteralExpression */:
|
|
@@ -119904,21 +120166,24 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119904
120166
|
return Debug.fail("SyntheticExpression should never be printed.");
|
|
119905
120167
|
case 282 /* MissingDeclaration */:
|
|
119906
120168
|
return;
|
|
120169
|
+
// JSX
|
|
119907
120170
|
case 284 /* JsxElement */:
|
|
119908
120171
|
return emitJsxElement(node);
|
|
119909
120172
|
case 285 /* JsxSelfClosingElement */:
|
|
119910
120173
|
return emitJsxSelfClosingElement(node);
|
|
119911
120174
|
case 288 /* JsxFragment */:
|
|
119912
120175
|
return emitJsxFragment(node);
|
|
120176
|
+
// Synthesized list
|
|
119913
120177
|
case 352 /* SyntaxList */:
|
|
119914
120178
|
return Debug.fail("SyntaxList should not be printed");
|
|
120179
|
+
// Transformation nodes
|
|
119915
120180
|
case 353 /* NotEmittedStatement */:
|
|
119916
120181
|
return;
|
|
119917
|
-
case
|
|
120182
|
+
case 355 /* PartiallyEmittedExpression */:
|
|
119918
120183
|
return emitPartiallyEmittedExpression(node);
|
|
119919
|
-
case
|
|
120184
|
+
case 356 /* CommaListExpression */:
|
|
119920
120185
|
return emitCommaList(node);
|
|
119921
|
-
case
|
|
120186
|
+
case 357 /* SyntheticReferenceExpression */:
|
|
119922
120187
|
return Debug.fail("SyntheticReferenceExpression should not be printed");
|
|
119923
120188
|
}
|
|
119924
120189
|
}
|
|
@@ -126101,6 +126366,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126101
126366
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
|
126102
126367
|
return "skip";
|
|
126103
126368
|
}
|
|
126369
|
+
// falls through
|
|
126104
126370
|
case 173 /* MethodSignature */:
|
|
126105
126371
|
case 176 /* Constructor */:
|
|
126106
126372
|
case 177 /* GetAccessor */:
|
|
@@ -126232,6 +126498,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126232
126498
|
diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
|
|
126233
126499
|
return "skip";
|
|
126234
126500
|
}
|
|
126501
|
+
// falls through
|
|
126235
126502
|
case 243 /* VariableStatement */:
|
|
126236
126503
|
if (nodes === parent2.modifiers) {
|
|
126237
126504
|
checkModifiers(parent2.modifiers, parent2.kind === 243 /* VariableStatement */);
|
|
@@ -126274,6 +126541,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126274
126541
|
if (isConstValid) {
|
|
126275
126542
|
continue;
|
|
126276
126543
|
}
|
|
126544
|
+
// to report error,
|
|
126545
|
+
// falls through
|
|
126277
126546
|
case 125 /* PublicKeyword */:
|
|
126278
126547
|
case 123 /* PrivateKeyword */:
|
|
126279
126548
|
case 124 /* ProtectedKeyword */:
|
|
@@ -126285,6 +126554,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126285
126554
|
case 147 /* OutKeyword */:
|
|
126286
126555
|
diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
|
126287
126556
|
break;
|
|
126557
|
+
// These are all legal modifiers.
|
|
126288
126558
|
case 126 /* StaticKeyword */:
|
|
126289
126559
|
case 95 /* ExportKeyword */:
|
|
126290
126560
|
case 90 /* DefaultKeyword */:
|
|
@@ -131751,6 +132021,7 @@ function getSourceFileVersionAsHashFromText(host, text) {
|
|
|
131751
132021
|
if (pos && text.charCodeAt(pos - 1) === 13 /* carriageReturn */) {
|
|
131752
132022
|
pos--;
|
|
131753
132023
|
}
|
|
132024
|
+
// falls through
|
|
131754
132025
|
case 13 /* carriageReturn */:
|
|
131755
132026
|
break;
|
|
131756
132027
|
default:
|
|
@@ -133288,6 +133559,7 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
133288
133559
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
133289
133560
|
step++;
|
|
133290
133561
|
break;
|
|
133562
|
+
// Should never be done
|
|
133291
133563
|
case 3 /* Done */:
|
|
133292
133564
|
default:
|
|
133293
133565
|
assertType(step);
|
|
@@ -133828,6 +134100,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
133828
134100
|
status.type = 2 /* UpToDateWithUpstreamTypes */;
|
|
133829
134101
|
break;
|
|
133830
134102
|
}
|
|
134103
|
+
// falls through
|
|
133831
134104
|
case 15 /* UpToDateWithInputFileText */:
|
|
133832
134105
|
case 2 /* UpToDateWithUpstreamTypes */:
|
|
133833
134106
|
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
|
|
@@ -134345,6 +134618,8 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
134345
134618
|
relName(state, configFileName)
|
|
134346
134619
|
);
|
|
134347
134620
|
case 16 /* ContainerOnly */:
|
|
134621
|
+
// Don't report status on "solution" projects
|
|
134622
|
+
// falls through
|
|
134348
134623
|
case 13 /* ComputingUpstream */:
|
|
134349
134624
|
break;
|
|
134350
134625
|
default:
|
|
@@ -136177,6 +136452,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
|
|
|
136177
136452
|
return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`;
|
|
136178
136453
|
case 0 /* Ok */:
|
|
136179
136454
|
return Debug.fail();
|
|
136455
|
+
// Shouldn't have called this.
|
|
136180
136456
|
default:
|
|
136181
136457
|
Debug.assertNever(result);
|
|
136182
136458
|
}
|
|
@@ -136553,6 +136829,7 @@ function getMeaningFromDeclaration(node) {
|
|
|
136553
136829
|
case 277 /* ExportAssignment */:
|
|
136554
136830
|
case 278 /* ExportDeclaration */:
|
|
136555
136831
|
return 7 /* All */;
|
|
136832
|
+
// An external module can be a Value
|
|
136556
136833
|
case 307 /* SourceFile */:
|
|
136557
136834
|
return 4 /* Namespace */ | 1 /* Value */;
|
|
136558
136835
|
}
|
|
@@ -136861,6 +137138,7 @@ function getNodeKind(node) {
|
|
|
136861
137138
|
return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
|
|
136862
137139
|
case 4 /* ThisProperty */:
|
|
136863
137140
|
return "property" /* memberVariableElement */;
|
|
137141
|
+
// property
|
|
136864
137142
|
case 5 /* Property */:
|
|
136865
137143
|
return isFunctionExpression(right) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */;
|
|
136866
137144
|
case 6 /* Prototype */:
|
|
@@ -136954,6 +137232,7 @@ function isCompletedNode(n, sourceFile) {
|
|
|
136954
137232
|
if (!n.arguments) {
|
|
136955
137233
|
return true;
|
|
136956
137234
|
}
|
|
137235
|
+
// falls through
|
|
136957
137236
|
case 213 /* CallExpression */:
|
|
136958
137237
|
case 217 /* ParenthesizedExpression */:
|
|
136959
137238
|
case 196 /* ParenthesizedType */:
|
|
@@ -137682,16 +137961,19 @@ function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) {
|
|
|
137682
137961
|
token = findPrecedingMatchingToken(token, 23 /* OpenBracketToken */, sourceFile);
|
|
137683
137962
|
if (!token) return void 0;
|
|
137684
137963
|
break;
|
|
137964
|
+
// Valid tokens in a type name. Skip.
|
|
137685
137965
|
case 28 /* CommaToken */:
|
|
137686
137966
|
nTypeArguments++;
|
|
137687
137967
|
break;
|
|
137688
137968
|
case 39 /* EqualsGreaterThanToken */:
|
|
137969
|
+
// falls through
|
|
137689
137970
|
case 80 /* Identifier */:
|
|
137690
137971
|
case 11 /* StringLiteral */:
|
|
137691
137972
|
case 9 /* NumericLiteral */:
|
|
137692
137973
|
case 10 /* BigIntLiteral */:
|
|
137693
137974
|
case 112 /* TrueKeyword */:
|
|
137694
137975
|
case 97 /* FalseKeyword */:
|
|
137976
|
+
// falls through
|
|
137695
137977
|
case 114 /* TypeOfKeyword */:
|
|
137696
137978
|
case 96 /* ExtendsKeyword */:
|
|
137697
137979
|
case 143 /* KeyOfKeyword */:
|
|
@@ -139965,6 +140247,7 @@ function canFollow(keyword1, keyword2) {
|
|
|
139965
140247
|
case 126 /* StaticKeyword */:
|
|
139966
140248
|
case 129 /* AccessorKeyword */:
|
|
139967
140249
|
return true;
|
|
140250
|
+
// Allow things like "public get", "public constructor" and "public static".
|
|
139968
140251
|
default:
|
|
139969
140252
|
return false;
|
|
139970
140253
|
}
|
|
@@ -140775,6 +141058,7 @@ var DocumentHighlights;
|
|
|
140775
141058
|
if (statement.kind === 251 /* ContinueStatement */) {
|
|
140776
141059
|
return false;
|
|
140777
141060
|
}
|
|
141061
|
+
// falls through
|
|
140778
141062
|
case 248 /* ForStatement */:
|
|
140779
141063
|
case 249 /* ForInStatement */:
|
|
140780
141064
|
case 250 /* ForOfStatement */:
|
|
@@ -140820,6 +141104,7 @@ var DocumentHighlights;
|
|
|
140820
141104
|
return [...nodes, container];
|
|
140821
141105
|
}
|
|
140822
141106
|
return nodes;
|
|
141107
|
+
// Syntactically invalid positions that the parser might produce anyway
|
|
140823
141108
|
default:
|
|
140824
141109
|
return void 0;
|
|
140825
141110
|
}
|
|
@@ -142399,8 +142684,10 @@ function isFixablePromiseArgument(arg, checker) {
|
|
|
142399
142684
|
if (functionFlags & 1 /* Generator */) {
|
|
142400
142685
|
return false;
|
|
142401
142686
|
}
|
|
142687
|
+
// falls through
|
|
142402
142688
|
case 219 /* ArrowFunction */:
|
|
142403
142689
|
visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
|
|
142690
|
+
// falls through
|
|
142404
142691
|
case 106 /* NullKeyword */:
|
|
142405
142692
|
return true;
|
|
142406
142693
|
case 80 /* Identifier */:
|
|
@@ -143073,6 +143360,7 @@ function addChildrenRecursively(node) {
|
|
|
143073
143360
|
Debug.assertNever(special);
|
|
143074
143361
|
}
|
|
143075
143362
|
}
|
|
143363
|
+
// falls through
|
|
143076
143364
|
default:
|
|
143077
143365
|
if (hasJSDocNodes(node)) {
|
|
143078
143366
|
forEach(node.jsDoc, (jsDoc) => {
|
|
@@ -143665,6 +143953,7 @@ function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName
|
|
|
143665
143953
|
changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present")));
|
|
143666
143954
|
break;
|
|
143667
143955
|
}
|
|
143956
|
+
// falls through
|
|
143668
143957
|
case 266 /* EnumDeclaration */:
|
|
143669
143958
|
case 265 /* TypeAliasDeclaration */:
|
|
143670
143959
|
case 267 /* ModuleDeclaration */:
|
|
@@ -144771,6 +145060,7 @@ function getNamesToExportInCommonJS(decl) {
|
|
|
144771
145060
|
case 262 /* FunctionDeclaration */:
|
|
144772
145061
|
case 263 /* ClassDeclaration */:
|
|
144773
145062
|
return [decl.name.text];
|
|
145063
|
+
// TODO: GH#18217
|
|
144774
145064
|
case 243 /* VariableStatement */:
|
|
144775
145065
|
return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0);
|
|
144776
145066
|
case 267 /* ModuleDeclaration */:
|
|
@@ -146233,6 +146523,7 @@ function entryToFunctionCall(entry) {
|
|
|
146233
146523
|
const functionReference = entry.node;
|
|
146234
146524
|
const parent2 = functionReference.parent;
|
|
146235
146525
|
switch (parent2.kind) {
|
|
146526
|
+
// foo(...) or super(...) or new Foo(...)
|
|
146236
146527
|
case 213 /* CallExpression */:
|
|
146237
146528
|
case 214 /* NewExpression */:
|
|
146238
146529
|
const callOrNewExpression = tryCast(parent2, isCallOrNewExpression);
|
|
@@ -146240,6 +146531,7 @@ function entryToFunctionCall(entry) {
|
|
|
146240
146531
|
return callOrNewExpression;
|
|
146241
146532
|
}
|
|
146242
146533
|
break;
|
|
146534
|
+
// x.foo(...)
|
|
146243
146535
|
case 211 /* PropertyAccessExpression */:
|
|
146244
146536
|
const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
|
|
146245
146537
|
if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
|
|
@@ -146249,6 +146541,7 @@ function entryToFunctionCall(entry) {
|
|
|
146249
146541
|
}
|
|
146250
146542
|
}
|
|
146251
146543
|
break;
|
|
146544
|
+
// x["foo"](...)
|
|
146252
146545
|
case 212 /* ElementAccessExpression */:
|
|
146253
146546
|
const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
|
|
146254
146547
|
if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
|
|
@@ -146267,12 +146560,14 @@ function entryToAccessExpression(entry) {
|
|
|
146267
146560
|
const reference = entry.node;
|
|
146268
146561
|
const parent2 = reference.parent;
|
|
146269
146562
|
switch (parent2.kind) {
|
|
146563
|
+
// `C.foo`
|
|
146270
146564
|
case 211 /* PropertyAccessExpression */:
|
|
146271
146565
|
const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression);
|
|
146272
146566
|
if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
|
|
146273
146567
|
return propertyAccessExpression;
|
|
146274
146568
|
}
|
|
146275
146569
|
break;
|
|
146570
|
+
// `C["foo"]`
|
|
146276
146571
|
case 212 /* ElementAccessExpression */:
|
|
146277
146572
|
const elementAccessExpression = tryCast(parent2, isElementAccessExpression);
|
|
146278
146573
|
if (elementAccessExpression && elementAccessExpression.expression === reference) {
|
|
@@ -147365,11 +147660,13 @@ function getRangeToExtract2(sourceFile, span, invoked = true) {
|
|
|
147365
147660
|
forEachChild(n, check);
|
|
147366
147661
|
}
|
|
147367
147662
|
});
|
|
147663
|
+
// falls through
|
|
147368
147664
|
case 263 /* ClassDeclaration */:
|
|
147369
147665
|
case 262 /* FunctionDeclaration */:
|
|
147370
147666
|
if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) {
|
|
147371
147667
|
(errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope));
|
|
147372
147668
|
}
|
|
147669
|
+
// falls through
|
|
147373
147670
|
case 231 /* ClassExpression */:
|
|
147374
147671
|
case 218 /* FunctionExpression */:
|
|
147375
147672
|
case 174 /* MethodDeclaration */:
|
|
@@ -149544,6 +149841,7 @@ var SourceFileObject = class extends NodeObject {
|
|
|
149544
149841
|
if (!hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
|
149545
149842
|
break;
|
|
149546
149843
|
}
|
|
149844
|
+
// falls through
|
|
149547
149845
|
case 260 /* VariableDeclaration */:
|
|
149548
149846
|
case 208 /* BindingElement */: {
|
|
149549
149847
|
const decl = node;
|
|
@@ -149555,6 +149853,7 @@ var SourceFileObject = class extends NodeObject {
|
|
|
149555
149853
|
visit(decl.initializer);
|
|
149556
149854
|
}
|
|
149557
149855
|
}
|
|
149856
|
+
// falls through
|
|
149558
149857
|
case 306 /* EnumMember */:
|
|
149559
149858
|
case 172 /* PropertyDeclaration */:
|
|
149560
149859
|
case 171 /* PropertySignature */:
|
|
@@ -149589,6 +149888,7 @@ var SourceFileObject = class extends NodeObject {
|
|
|
149589
149888
|
if (getAssignmentDeclarationKind(node) !== 0 /* None */) {
|
|
149590
149889
|
addDeclaration(node);
|
|
149591
149890
|
}
|
|
149891
|
+
// falls through
|
|
149592
149892
|
default:
|
|
149593
149893
|
forEachChild(node, visit);
|
|
149594
149894
|
}
|
|
@@ -150476,6 +150776,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
150476
150776
|
case 197 /* ThisType */:
|
|
150477
150777
|
case 80 /* Identifier */:
|
|
150478
150778
|
break;
|
|
150779
|
+
// Cant create the text span
|
|
150479
150780
|
default:
|
|
150480
150781
|
return void 0;
|
|
150481
150782
|
}
|
|
@@ -151193,6 +151494,7 @@ function getContainingObjectLiteralElementWorker(node) {
|
|
|
151193
151494
|
if (node.parent.kind === 167 /* ComputedPropertyName */) {
|
|
151194
151495
|
return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0;
|
|
151195
151496
|
}
|
|
151497
|
+
// falls through
|
|
151196
151498
|
case 80 /* Identifier */:
|
|
151197
151499
|
return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 210 /* ObjectLiteralExpression */ || node.parent.parent.kind === 292 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0;
|
|
151198
151500
|
}
|
|
@@ -151347,6 +151649,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151347
151649
|
if (isFunctionBlock(node)) {
|
|
151348
151650
|
return spanInFunctionBlock(node);
|
|
151349
151651
|
}
|
|
151652
|
+
// falls through
|
|
151350
151653
|
case 268 /* ModuleBlock */:
|
|
151351
151654
|
return spanInBlock(node);
|
|
151352
151655
|
case 299 /* CatchClause */:
|
|
@@ -151395,6 +151698,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151395
151698
|
if (getModuleInstanceState(node) !== 1 /* Instantiated */) {
|
|
151396
151699
|
return void 0;
|
|
151397
151700
|
}
|
|
151701
|
+
// falls through
|
|
151398
151702
|
case 263 /* ClassDeclaration */:
|
|
151399
151703
|
case 266 /* EnumDeclaration */:
|
|
151400
151704
|
case 306 /* EnumMember */:
|
|
@@ -151407,9 +151711,11 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151407
151711
|
case 206 /* ObjectBindingPattern */:
|
|
151408
151712
|
case 207 /* ArrayBindingPattern */:
|
|
151409
151713
|
return spanInBindingPattern(node);
|
|
151714
|
+
// No breakpoint in interface, type alias
|
|
151410
151715
|
case 264 /* InterfaceDeclaration */:
|
|
151411
151716
|
case 265 /* TypeAliasDeclaration */:
|
|
151412
151717
|
return void 0;
|
|
151718
|
+
// Tokens:
|
|
151413
151719
|
case 27 /* SemicolonToken */:
|
|
151414
151720
|
case 1 /* EndOfFileToken */:
|
|
151415
151721
|
return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile));
|
|
@@ -151430,6 +151736,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151430
151736
|
case 32 /* GreaterThanToken */:
|
|
151431
151737
|
case 30 /* LessThanToken */:
|
|
151432
151738
|
return spanInGreaterThanOrLessThanToken(node);
|
|
151739
|
+
// Keywords:
|
|
151433
151740
|
case 117 /* WhileKeyword */:
|
|
151434
151741
|
return spanInWhileKeyword(node);
|
|
151435
151742
|
case 93 /* ElseKeyword */:
|
|
@@ -151580,10 +151887,13 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151580
151887
|
if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
|
|
151581
151888
|
return void 0;
|
|
151582
151889
|
}
|
|
151890
|
+
// Set on parent if on same line otherwise on first statement
|
|
151891
|
+
// falls through
|
|
151583
151892
|
case 247 /* WhileStatement */:
|
|
151584
151893
|
case 245 /* IfStatement */:
|
|
151585
151894
|
case 249 /* ForInStatement */:
|
|
151586
151895
|
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
|
|
151896
|
+
// Set span on previous token if it starts on same line otherwise on the first statement of the block
|
|
151587
151897
|
case 248 /* ForStatement */:
|
|
151588
151898
|
case 250 /* ForOfStatement */:
|
|
151589
151899
|
return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
|
|
@@ -151649,6 +151959,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151649
151959
|
if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) {
|
|
151650
151960
|
return void 0;
|
|
151651
151961
|
}
|
|
151962
|
+
// falls through
|
|
151652
151963
|
case 266 /* EnumDeclaration */:
|
|
151653
151964
|
case 263 /* ClassDeclaration */:
|
|
151654
151965
|
return textSpan(node2);
|
|
@@ -151656,6 +151967,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151656
151967
|
if (isFunctionBlock(node2.parent)) {
|
|
151657
151968
|
return textSpan(node2);
|
|
151658
151969
|
}
|
|
151970
|
+
// falls through
|
|
151659
151971
|
case 299 /* CatchClause */:
|
|
151660
151972
|
return spanInNode(lastOrUndefined(node2.parent.statements));
|
|
151661
151973
|
case 269 /* CaseBlock */:
|
|
@@ -151668,6 +151980,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151668
151980
|
case 206 /* ObjectBindingPattern */:
|
|
151669
151981
|
const bindingPattern = node2.parent;
|
|
151670
151982
|
return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
|
|
151983
|
+
// Default to parent node
|
|
151671
151984
|
default:
|
|
151672
151985
|
if (isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) {
|
|
151673
151986
|
const objectLiteral = node2.parent;
|
|
@@ -151717,6 +152030,7 @@ function spanInSourceFileAtLocation(sourceFile, position) {
|
|
|
151717
152030
|
case 214 /* NewExpression */:
|
|
151718
152031
|
case 217 /* ParenthesizedExpression */:
|
|
151719
152032
|
return spanInPreviousNode(node2);
|
|
152033
|
+
// Default to parent node
|
|
151720
152034
|
default:
|
|
151721
152035
|
return spanInNode(node2.parent);
|
|
151722
152036
|
}
|
|
@@ -154309,6 +154623,7 @@ function convertStatement(sourceFile, statement, checker, changes, identifiers,
|
|
|
154309
154623
|
}
|
|
154310
154624
|
}
|
|
154311
154625
|
}
|
|
154626
|
+
// falls through
|
|
154312
154627
|
default:
|
|
154313
154628
|
return false;
|
|
154314
154629
|
}
|
|
@@ -154408,6 +154723,8 @@ function tryChangeModuleExportsObject(object, useSitesToUnqualify) {
|
|
|
154408
154723
|
switch (prop.kind) {
|
|
154409
154724
|
case 177 /* GetAccessor */:
|
|
154410
154725
|
case 178 /* SetAccessor */:
|
|
154726
|
+
// TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
|
|
154727
|
+
// falls through
|
|
154411
154728
|
case 304 /* ShorthandPropertyAssignment */:
|
|
154412
154729
|
case 305 /* SpreadAssignment */:
|
|
154413
154730
|
return void 0;
|
|
@@ -154489,6 +154806,7 @@ function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualif
|
|
|
154489
154806
|
return exportConst();
|
|
154490
154807
|
}
|
|
154491
154808
|
}
|
|
154809
|
+
// falls through
|
|
154492
154810
|
case 219 /* ArrowFunction */:
|
|
154493
154811
|
return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify);
|
|
154494
154812
|
case 231 /* ClassExpression */:
|
|
@@ -154537,6 +154855,7 @@ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target
|
|
|
154537
154855
|
)]);
|
|
154538
154856
|
}
|
|
154539
154857
|
}
|
|
154858
|
+
// falls through -- object destructuring has an interesting pattern and must be a variable declaration
|
|
154540
154859
|
case 207 /* ArrayBindingPattern */: {
|
|
154541
154860
|
const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers);
|
|
154542
154861
|
return convertedImports([
|
|
@@ -159613,6 +159932,7 @@ function doChange27(changes, sourceFile, start, length2, errorCode) {
|
|
|
159613
159932
|
}
|
|
159614
159933
|
return;
|
|
159615
159934
|
}
|
|
159935
|
+
// falls through
|
|
159616
159936
|
case 247 /* WhileStatement */:
|
|
159617
159937
|
case 248 /* ForStatement */:
|
|
159618
159938
|
changes.delete(sourceFile, container);
|
|
@@ -160877,6 +161197,7 @@ function getDiagnostic(errorCode, token) {
|
|
|
160877
161197
|
case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
|
|
160878
161198
|
case Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:
|
|
160879
161199
|
return isSetAccessorDeclaration(getContainingFunction(token)) ? Diagnostics.Infer_type_of_0_from_usage : Diagnostics.Infer_parameter_types_from_usage;
|
|
161200
|
+
// TODO: GH#18217
|
|
160880
161201
|
case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
|
160881
161202
|
case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:
|
|
160882
161203
|
return Diagnostics.Infer_parameter_types_from_usage;
|
|
@@ -160915,6 +161236,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
|
|
|
160915
161236
|
const importAdder = createImportAdder(sourceFile, program, preferences, host);
|
|
160916
161237
|
errorCode = mapSuggestionDiagnostic(errorCode);
|
|
160917
161238
|
switch (errorCode) {
|
|
161239
|
+
// Variable and Property declarations
|
|
160918
161240
|
case Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
|
160919
161241
|
case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
|
160920
161242
|
if (isVariableDeclaration(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature(parent2)) {
|
|
@@ -160955,12 +161277,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
|
|
|
160955
161277
|
}
|
|
160956
161278
|
let declaration;
|
|
160957
161279
|
switch (errorCode) {
|
|
161280
|
+
// Parameter declarations
|
|
160958
161281
|
case Diagnostics.Parameter_0_implicitly_has_an_1_type.code:
|
|
160959
161282
|
if (isSetAccessorDeclaration(containingFunction)) {
|
|
160960
161283
|
annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
|
|
160961
161284
|
declaration = containingFunction;
|
|
160962
161285
|
break;
|
|
160963
161286
|
}
|
|
161287
|
+
// falls through
|
|
160964
161288
|
case Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
|
160965
161289
|
if (markSeen(containingFunction)) {
|
|
160966
161290
|
const param = cast(parent2, isParameter);
|
|
@@ -160968,6 +161292,7 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
|
|
|
160968
161292
|
declaration = param;
|
|
160969
161293
|
}
|
|
160970
161294
|
break;
|
|
161295
|
+
// Get Accessor declarations
|
|
160971
161296
|
case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:
|
|
160972
161297
|
case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:
|
|
160973
161298
|
if (isGetAccessorDeclaration(containingFunction) && isIdentifier(containingFunction.name)) {
|
|
@@ -160975,12 +161300,14 @@ function doChange33(changes, sourceFile, token, errorCode, program, cancellation
|
|
|
160975
161300
|
declaration = containingFunction;
|
|
160976
161301
|
}
|
|
160977
161302
|
break;
|
|
161303
|
+
// Set Accessor declarations
|
|
160978
161304
|
case Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:
|
|
160979
161305
|
if (isSetAccessorDeclaration(containingFunction)) {
|
|
160980
161306
|
annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken);
|
|
160981
161307
|
declaration = containingFunction;
|
|
160982
161308
|
}
|
|
160983
161309
|
break;
|
|
161310
|
+
// Function 'this'
|
|
160984
161311
|
case Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:
|
|
160985
161312
|
if (ts_textChanges_exports.isThisTypeAnnotatable(containingFunction) && markSeen(containingFunction)) {
|
|
160986
161313
|
annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken);
|
|
@@ -161362,6 +161689,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161362
161689
|
break;
|
|
161363
161690
|
}
|
|
161364
161691
|
}
|
|
161692
|
+
// falls through
|
|
161365
161693
|
default:
|
|
161366
161694
|
return inferTypeFromContextualType(node, usage);
|
|
161367
161695
|
}
|
|
@@ -161389,16 +161717,25 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161389
161717
|
}
|
|
161390
161718
|
function inferTypeFromBinaryExpression(node, parent2, usage) {
|
|
161391
161719
|
switch (parent2.operatorToken.kind) {
|
|
161720
|
+
// ExponentiationOperator
|
|
161392
161721
|
case 43 /* AsteriskAsteriskToken */:
|
|
161722
|
+
// MultiplicativeOperator
|
|
161723
|
+
// falls through
|
|
161393
161724
|
case 42 /* AsteriskToken */:
|
|
161394
161725
|
case 44 /* SlashToken */:
|
|
161395
161726
|
case 45 /* PercentToken */:
|
|
161727
|
+
// ShiftOperator
|
|
161728
|
+
// falls through
|
|
161396
161729
|
case 48 /* LessThanLessThanToken */:
|
|
161397
161730
|
case 49 /* GreaterThanGreaterThanToken */:
|
|
161398
161731
|
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
161732
|
+
// BitwiseOperator
|
|
161733
|
+
// falls through
|
|
161399
161734
|
case 51 /* AmpersandToken */:
|
|
161400
161735
|
case 52 /* BarToken */:
|
|
161401
161736
|
case 53 /* CaretToken */:
|
|
161737
|
+
// CompoundAssignmentOperator
|
|
161738
|
+
// falls through
|
|
161402
161739
|
case 66 /* MinusEqualsToken */:
|
|
161403
161740
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
161404
161741
|
case 67 /* AsteriskEqualsToken */:
|
|
@@ -161410,7 +161747,11 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161410
161747
|
case 71 /* LessThanLessThanEqualsToken */:
|
|
161411
161748
|
case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
|
161412
161749
|
case 72 /* GreaterThanGreaterThanEqualsToken */:
|
|
161750
|
+
// AdditiveOperator
|
|
161751
|
+
// falls through
|
|
161413
161752
|
case 41 /* MinusToken */:
|
|
161753
|
+
// RelationalOperator
|
|
161754
|
+
// falls through
|
|
161414
161755
|
case 30 /* LessThanToken */:
|
|
161415
161756
|
case 33 /* LessThanEqualsToken */:
|
|
161416
161757
|
case 32 /* GreaterThanToken */:
|
|
@@ -161436,6 +161777,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161436
161777
|
usage.isNumberOrString = true;
|
|
161437
161778
|
}
|
|
161438
161779
|
break;
|
|
161780
|
+
// AssignmentOperators
|
|
161439
161781
|
case 64 /* EqualsToken */:
|
|
161440
161782
|
case 35 /* EqualsEqualsToken */:
|
|
161441
161783
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
@@ -161451,6 +161793,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161451
161793
|
usage.isString = true;
|
|
161452
161794
|
}
|
|
161453
161795
|
break;
|
|
161796
|
+
// LogicalOperator Or NullishCoalescing
|
|
161454
161797
|
case 57 /* BarBarToken */:
|
|
161455
161798
|
case 61 /* QuestionQuestionToken */:
|
|
161456
161799
|
if (node === parent2.left && (node.parent.parent.kind === 260 /* VariableDeclaration */ || isAssignmentExpression(
|
|
@@ -161955,11 +162298,10 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
161955
162298
|
const optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
161956
162299
|
const ambient = !!(enclosingDeclaration.flags & 33554432 /* Ambient */) || isAmbient;
|
|
161957
162300
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
162301
|
+
const flags = 1 /* NoTruncation */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
161958
162302
|
switch (kind) {
|
|
161959
162303
|
case 171 /* PropertySignature */:
|
|
161960
162304
|
case 172 /* PropertyDeclaration */:
|
|
161961
|
-
let flags = 1 /* NoTruncation */;
|
|
161962
|
-
flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
|
|
161963
162305
|
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
|
|
161964
162306
|
if (importAdder) {
|
|
161965
162307
|
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
@@ -161983,8 +162325,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
161983
162325
|
let typeNode2 = checker.typeToTypeNode(
|
|
161984
162326
|
type,
|
|
161985
162327
|
enclosingDeclaration,
|
|
161986
|
-
|
|
161987
|
-
void 0,
|
|
162328
|
+
flags,
|
|
161988
162329
|
/*internalFlags*/
|
|
161989
162330
|
void 0,
|
|
161990
162331
|
getNoopSymbolTrackerWithResolver(context)
|
|
@@ -165704,6 +166045,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
|
|
|
165704
166045
|
switch (parent2.kind) {
|
|
165705
166046
|
case 260 /* VariableDeclaration */:
|
|
165706
166047
|
return checker.getContextualType(parent2.initializer);
|
|
166048
|
+
// TODO: GH#18217
|
|
165707
166049
|
case 226 /* BinaryExpression */:
|
|
165708
166050
|
return checker.getTypeAtLocation(parent2.left);
|
|
165709
166051
|
case 291 /* JsxAttribute */:
|
|
@@ -165890,6 +166232,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
165890
166232
|
if (!binaryExpressionMayBeOpenTag(parent2)) {
|
|
165891
166233
|
break;
|
|
165892
166234
|
}
|
|
166235
|
+
// falls through
|
|
165893
166236
|
case 285 /* JsxSelfClosingElement */:
|
|
165894
166237
|
case 284 /* JsxElement */:
|
|
165895
166238
|
case 286 /* JsxOpeningElement */:
|
|
@@ -166509,6 +166852,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166509
166852
|
case 28 /* CommaToken */:
|
|
166510
166853
|
switch (containingNodeKind) {
|
|
166511
166854
|
case 213 /* CallExpression */:
|
|
166855
|
+
// func( a, |
|
|
166512
166856
|
case 214 /* NewExpression */: {
|
|
166513
166857
|
const expression = contextToken.parent.expression;
|
|
166514
166858
|
if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
@@ -166519,7 +166863,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166519
166863
|
case 226 /* BinaryExpression */:
|
|
166520
166864
|
return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
|
|
166521
166865
|
case 176 /* Constructor */:
|
|
166866
|
+
// constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
|
|
166522
166867
|
case 184 /* FunctionType */:
|
|
166868
|
+
// var x: (s: string, list|
|
|
166523
166869
|
case 210 /* ObjectLiteralExpression */:
|
|
166524
166870
|
return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
|
|
166525
166871
|
case 209 /* ArrayLiteralExpression */:
|
|
@@ -166530,6 +166876,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166530
166876
|
case 21 /* OpenParenToken */:
|
|
166531
166877
|
switch (containingNodeKind) {
|
|
166532
166878
|
case 213 /* CallExpression */:
|
|
166879
|
+
// func( |
|
|
166533
166880
|
case 214 /* NewExpression */: {
|
|
166534
166881
|
const expression = contextToken.parent.expression;
|
|
166535
166882
|
if (getLineAndCharacterOfPosition(sourceFile, expression.end).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
@@ -166540,6 +166887,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166540
166887
|
case 217 /* ParenthesizedExpression */:
|
|
166541
166888
|
return { defaultCommitCharacters: noCommaCommitCharacters, isNewIdentifierLocation: true };
|
|
166542
166889
|
case 176 /* Constructor */:
|
|
166890
|
+
// constructor( |
|
|
166543
166891
|
case 196 /* ParenthesizedType */:
|
|
166544
166892
|
return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
|
|
166545
166893
|
default:
|
|
@@ -166548,15 +166896,20 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166548
166896
|
case 23 /* OpenBracketToken */:
|
|
166549
166897
|
switch (containingNodeKind) {
|
|
166550
166898
|
case 209 /* ArrayLiteralExpression */:
|
|
166899
|
+
// [ |
|
|
166551
166900
|
case 181 /* IndexSignature */:
|
|
166901
|
+
// [ | : string ]
|
|
166552
166902
|
case 189 /* TupleType */:
|
|
166903
|
+
// [ | : string ]
|
|
166553
166904
|
case 167 /* ComputedPropertyName */:
|
|
166554
166905
|
return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
|
|
166555
166906
|
default:
|
|
166556
166907
|
return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: false };
|
|
166557
166908
|
}
|
|
166558
166909
|
case 144 /* ModuleKeyword */:
|
|
166910
|
+
// module |
|
|
166559
166911
|
case 145 /* NamespaceKeyword */:
|
|
166912
|
+
// namespace |
|
|
166560
166913
|
case 102 /* ImportKeyword */:
|
|
166561
166914
|
return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
|
|
166562
166915
|
case 25 /* DotToken */:
|
|
@@ -166569,6 +166922,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166569
166922
|
case 19 /* OpenBraceToken */:
|
|
166570
166923
|
switch (containingNodeKind) {
|
|
166571
166924
|
case 263 /* ClassDeclaration */:
|
|
166925
|
+
// class A { |
|
|
166572
166926
|
case 210 /* ObjectLiteralExpression */:
|
|
166573
166927
|
return { defaultCommitCharacters: [], isNewIdentifierLocation: true };
|
|
166574
166928
|
default:
|
|
@@ -166577,6 +166931,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166577
166931
|
case 64 /* EqualsToken */:
|
|
166578
166932
|
switch (containingNodeKind) {
|
|
166579
166933
|
case 260 /* VariableDeclaration */:
|
|
166934
|
+
// const x = a|
|
|
166580
166935
|
case 226 /* BinaryExpression */:
|
|
166581
166936
|
return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: true };
|
|
166582
166937
|
default:
|
|
@@ -166831,6 +167186,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166831
167186
|
const parent2 = contextToken2.parent;
|
|
166832
167187
|
switch (contextToken2.kind) {
|
|
166833
167188
|
case 32 /* GreaterThanToken */:
|
|
167189
|
+
// End of a type argument list
|
|
166834
167190
|
case 31 /* LessThanSlashToken */:
|
|
166835
167191
|
case 44 /* SlashToken */:
|
|
166836
167192
|
case 80 /* Identifier */:
|
|
@@ -166853,6 +167209,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166853
167209
|
return parent2.parent.parent;
|
|
166854
167210
|
}
|
|
166855
167211
|
break;
|
|
167212
|
+
// The context token is the closing } or " of an attribute, which means
|
|
167213
|
+
// its parent is a JsxExpression, whose parent is a JsxAttribute,
|
|
167214
|
+
// whose parent is a JsxOpeningLikeElement
|
|
166856
167215
|
case 11 /* StringLiteral */:
|
|
166857
167216
|
if (parent2 && (parent2.kind === 291 /* JsxAttribute */ || parent2.kind === 293 /* JsxSpreadAttribute */)) {
|
|
166858
167217
|
return parent2.parent.parent;
|
|
@@ -166887,14 +167246,18 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166887
167246
|
isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
|
|
166888
167247
|
case 25 /* DotToken */:
|
|
166889
167248
|
return containingNodeKind === 207 /* ArrayBindingPattern */;
|
|
167249
|
+
// var [.|
|
|
166890
167250
|
case 59 /* ColonToken */:
|
|
166891
167251
|
return containingNodeKind === 208 /* BindingElement */;
|
|
167252
|
+
// var {x :html|
|
|
166892
167253
|
case 23 /* OpenBracketToken */:
|
|
166893
167254
|
return containingNodeKind === 207 /* ArrayBindingPattern */;
|
|
167255
|
+
// var [x|
|
|
166894
167256
|
case 21 /* OpenParenToken */:
|
|
166895
167257
|
return containingNodeKind === 299 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind);
|
|
166896
167258
|
case 19 /* OpenBraceToken */:
|
|
166897
167259
|
return containingNodeKind === 266 /* EnumDeclaration */;
|
|
167260
|
+
// enum a { |
|
|
166898
167261
|
case 30 /* LessThanToken */:
|
|
166899
167262
|
return containingNodeKind === 263 /* ClassDeclaration */ || // class A< |
|
|
166900
167263
|
containingNodeKind === 231 /* ClassExpression */ || // var C = class D< |
|
|
@@ -166905,6 +167268,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
166905
167268
|
return containingNodeKind === 172 /* PropertyDeclaration */ && !isClassLike(parent2.parent);
|
|
166906
167269
|
case 26 /* DotDotDotToken */:
|
|
166907
167270
|
return containingNodeKind === 169 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 207 /* ArrayBindingPattern */;
|
|
167271
|
+
// var [...z|
|
|
166908
167272
|
case 125 /* PublicKeyword */:
|
|
166909
167273
|
case 123 /* PrivateKeyword */:
|
|
166910
167274
|
case 124 /* ProtectedKeyword */:
|
|
@@ -167131,6 +167495,7 @@ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile)
|
|
|
167131
167495
|
const { parent: parent2 } = contextToken;
|
|
167132
167496
|
switch (contextToken.kind) {
|
|
167133
167497
|
case 19 /* OpenBraceToken */:
|
|
167498
|
+
// const x = { |
|
|
167134
167499
|
case 28 /* CommaToken */:
|
|
167135
167500
|
if (isObjectLiteralExpression(parent2) || isObjectBindingPattern(parent2)) {
|
|
167136
167501
|
return parent2;
|
|
@@ -167408,9 +167773,11 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
|
|
|
167408
167773
|
case 64 /* EqualsToken */:
|
|
167409
167774
|
return void 0;
|
|
167410
167775
|
case 27 /* SemicolonToken */:
|
|
167776
|
+
// class c {getValue(): number; | }
|
|
167411
167777
|
case 20 /* CloseBraceToken */:
|
|
167412
167778
|
return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : tryCast(location, isObjectTypeDeclaration);
|
|
167413
167779
|
case 19 /* OpenBraceToken */:
|
|
167780
|
+
// class c { |
|
|
167414
167781
|
case 28 /* CommaToken */:
|
|
167415
167782
|
return tryCast(contextToken.parent, isObjectTypeDeclaration);
|
|
167416
167783
|
default:
|
|
@@ -167916,6 +168283,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
|
|
|
167916
168283
|
const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 291 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile, typeChecker);
|
|
167917
168284
|
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
|
|
167918
168285
|
}
|
|
168286
|
+
// falls through (is `require("")` or `require(""` or `import("")`)
|
|
167919
168287
|
case 272 /* ImportDeclaration */:
|
|
167920
168288
|
case 278 /* ExportDeclaration */:
|
|
167921
168289
|
case 283 /* ExternalModuleReference */:
|
|
@@ -168722,6 +169090,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
|
|
|
168722
169090
|
break;
|
|
168723
169091
|
case 80 /* Identifier */:
|
|
168724
169092
|
break;
|
|
169093
|
+
// TODO: GH#23879
|
|
168725
169094
|
case 271 /* ImportEqualsDeclaration */:
|
|
168726
169095
|
handleNamespaceImport(
|
|
168727
169096
|
direct,
|
|
@@ -169616,6 +169985,7 @@ function declarationIsWriteAccess(decl) {
|
|
|
169616
169985
|
case 306 /* EnumMember */:
|
|
169617
169986
|
case 281 /* ExportSpecifier */:
|
|
169618
169987
|
case 273 /* ImportClause */:
|
|
169988
|
+
// default import
|
|
169619
169989
|
case 271 /* ImportEqualsDeclaration */:
|
|
169620
169990
|
case 276 /* ImportSpecifier */:
|
|
169621
169991
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -170002,6 +170372,7 @@ var Core;
|
|
|
170002
170372
|
Debug.assert(node.parent.name === node);
|
|
170003
170373
|
return 2 /* Class */;
|
|
170004
170374
|
}
|
|
170375
|
+
// falls through
|
|
170005
170376
|
default:
|
|
170006
170377
|
return 0 /* None */;
|
|
170007
170378
|
}
|
|
@@ -170333,6 +170704,7 @@ var Core;
|
|
|
170333
170704
|
if (isJSDocMemberName(node.parent)) {
|
|
170334
170705
|
return true;
|
|
170335
170706
|
}
|
|
170707
|
+
// falls through I guess
|
|
170336
170708
|
case 80 /* Identifier */:
|
|
170337
170709
|
return node.text.length === searchSymbolName.length;
|
|
170338
170710
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
@@ -170758,6 +171130,7 @@ var Core;
|
|
|
170758
171130
|
searchSpaceNode = searchSpaceNode.parent;
|
|
170759
171131
|
break;
|
|
170760
171132
|
}
|
|
171133
|
+
// falls through
|
|
170761
171134
|
case 172 /* PropertyDeclaration */:
|
|
170762
171135
|
case 171 /* PropertySignature */:
|
|
170763
171136
|
case 176 /* Constructor */:
|
|
@@ -170770,9 +171143,12 @@ var Core;
|
|
|
170770
171143
|
if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
|
|
170771
171144
|
return void 0;
|
|
170772
171145
|
}
|
|
171146
|
+
// falls through
|
|
170773
171147
|
case 262 /* FunctionDeclaration */:
|
|
170774
171148
|
case 218 /* FunctionExpression */:
|
|
170775
171149
|
break;
|
|
171150
|
+
// Computed properties in classes are not handled here because references to this are illegal,
|
|
171151
|
+
// so there is no point finding references to them.
|
|
170776
171152
|
default:
|
|
170777
171153
|
return void 0;
|
|
170778
171154
|
}
|
|
@@ -171112,6 +171488,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
171112
171488
|
if (!isDefaultClause(node.parent)) {
|
|
171113
171489
|
break;
|
|
171114
171490
|
}
|
|
171491
|
+
// falls through
|
|
171115
171492
|
case 84 /* CaseKeyword */:
|
|
171116
171493
|
const switchStatement = findAncestor(node.parent, isSwitchStatement);
|
|
171117
171494
|
if (switchStatement) {
|
|
@@ -171556,6 +171933,8 @@ function isDefinitionVisible(checker, declaration) {
|
|
|
171556
171933
|
case 178 /* SetAccessor */:
|
|
171557
171934
|
case 174 /* MethodDeclaration */:
|
|
171558
171935
|
if (hasEffectiveModifier(declaration, 2 /* Private */)) return false;
|
|
171936
|
+
// Public properties/methods are visible if its parents are visible, so:
|
|
171937
|
+
// falls through
|
|
171559
171938
|
case 176 /* Constructor */:
|
|
171560
171939
|
case 303 /* PropertyAssignment */:
|
|
171561
171940
|
case 304 /* ShorthandPropertyAssignment */:
|
|
@@ -172532,6 +172911,7 @@ function getCommentHavingNodes(declaration) {
|
|
|
172532
172911
|
if (isJSDocOverloadTag(declaration.parent)) {
|
|
172533
172912
|
return [declaration.parent.parent];
|
|
172534
172913
|
}
|
|
172914
|
+
// falls through
|
|
172535
172915
|
default:
|
|
172536
172916
|
return getJSDocCommentsAndTags(declaration);
|
|
172537
172917
|
}
|
|
@@ -173869,6 +174249,7 @@ function getOutliningSpanForNode(n, sourceFile) {
|
|
|
173869
174249
|
const node = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile);
|
|
173870
174250
|
if (node) return spanForNode(node);
|
|
173871
174251
|
}
|
|
174252
|
+
// falls through
|
|
173872
174253
|
default:
|
|
173873
174254
|
return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */);
|
|
173874
174255
|
}
|
|
@@ -177694,19 +178075,34 @@ function isBinaryOpContext(context) {
|
|
|
177694
178075
|
case 193 /* IntersectionType */:
|
|
177695
178076
|
case 238 /* SatisfiesExpression */:
|
|
177696
178077
|
return true;
|
|
178078
|
+
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
|
177697
178079
|
case 208 /* BindingElement */:
|
|
178080
|
+
// equals in type X = ...
|
|
178081
|
+
// falls through
|
|
177698
178082
|
case 265 /* TypeAliasDeclaration */:
|
|
178083
|
+
// equal in import a = module('a');
|
|
178084
|
+
// falls through
|
|
177699
178085
|
case 271 /* ImportEqualsDeclaration */:
|
|
178086
|
+
// equal in export = 1
|
|
178087
|
+
// falls through
|
|
177700
178088
|
case 277 /* ExportAssignment */:
|
|
178089
|
+
// equal in let a = 0
|
|
178090
|
+
// falls through
|
|
177701
178091
|
case 260 /* VariableDeclaration */:
|
|
178092
|
+
// equal in p = 0
|
|
178093
|
+
// falls through
|
|
177702
178094
|
case 169 /* Parameter */:
|
|
177703
178095
|
case 306 /* EnumMember */:
|
|
177704
178096
|
case 172 /* PropertyDeclaration */:
|
|
177705
178097
|
case 171 /* PropertySignature */:
|
|
177706
178098
|
return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
|
|
178099
|
+
// "in" keyword in for (let x in []) { }
|
|
177707
178100
|
case 249 /* ForInStatement */:
|
|
178101
|
+
// "in" keyword in [P in keyof T]: T[P]
|
|
178102
|
+
// falls through
|
|
177708
178103
|
case 168 /* TypeParameter */:
|
|
177709
178104
|
return context.currentTokenSpan.kind === 103 /* InKeyword */ || context.nextTokenSpan.kind === 103 /* InKeyword */ || context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */;
|
|
178105
|
+
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
|
177710
178106
|
case 250 /* ForOfStatement */:
|
|
177711
178107
|
return context.currentTokenSpan.kind === 165 /* OfKeyword */ || context.nextTokenSpan.kind === 165 /* OfKeyword */;
|
|
177712
178108
|
}
|
|
@@ -177770,12 +178166,20 @@ function isFunctionDeclContext(context) {
|
|
|
177770
178166
|
case 262 /* FunctionDeclaration */:
|
|
177771
178167
|
case 174 /* MethodDeclaration */:
|
|
177772
178168
|
case 173 /* MethodSignature */:
|
|
178169
|
+
// case SyntaxKind.MemberFunctionDeclaration:
|
|
178170
|
+
// falls through
|
|
177773
178171
|
case 177 /* GetAccessor */:
|
|
177774
178172
|
case 178 /* SetAccessor */:
|
|
178173
|
+
// case SyntaxKind.MethodSignature:
|
|
178174
|
+
// falls through
|
|
177775
178175
|
case 179 /* CallSignature */:
|
|
177776
178176
|
case 218 /* FunctionExpression */:
|
|
177777
178177
|
case 176 /* Constructor */:
|
|
177778
178178
|
case 219 /* ArrowFunction */:
|
|
178179
|
+
// case SyntaxKind.ConstructorDeclaration:
|
|
178180
|
+
// case SyntaxKind.SimpleArrowFunctionExpression:
|
|
178181
|
+
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
|
|
178182
|
+
// falls through
|
|
177779
178183
|
case 264 /* InterfaceDeclaration */:
|
|
177780
178184
|
return true;
|
|
177781
178185
|
}
|
|
@@ -177835,6 +178239,9 @@ function isControlDeclContext(context) {
|
|
|
177835
178239
|
case 258 /* TryStatement */:
|
|
177836
178240
|
case 246 /* DoStatement */:
|
|
177837
178241
|
case 254 /* WithStatement */:
|
|
178242
|
+
// TODO
|
|
178243
|
+
// case SyntaxKind.ElseClause:
|
|
178244
|
+
// falls through
|
|
177838
178245
|
case 299 /* CatchClause */:
|
|
177839
178246
|
return true;
|
|
177840
178247
|
default:
|
|
@@ -178463,6 +178870,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
178463
178870
|
if (node.asteriskToken) {
|
|
178464
178871
|
return 42 /* AsteriskToken */;
|
|
178465
178872
|
}
|
|
178873
|
+
// falls through
|
|
178466
178874
|
case 172 /* PropertyDeclaration */:
|
|
178467
178875
|
case 169 /* Parameter */:
|
|
178468
178876
|
const name = getNameOfDeclaration(node);
|
|
@@ -178475,6 +178883,10 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
178475
178883
|
return {
|
|
178476
178884
|
getIndentationForComment: (kind, tokenIndentation, container) => {
|
|
178477
178885
|
switch (kind) {
|
|
178886
|
+
// preceding comment to the token that closes the indentation scope inherits the indentation from the scope
|
|
178887
|
+
// .. {
|
|
178888
|
+
// // comment
|
|
178889
|
+
// }
|
|
178478
178890
|
case 20 /* CloseBraceToken */:
|
|
178479
178891
|
case 24 /* CloseBracketToken */:
|
|
178480
178892
|
case 22 /* CloseParenToken */:
|
|
@@ -178504,6 +178916,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
178504
178916
|
};
|
|
178505
178917
|
function shouldAddDelta(line, kind, container) {
|
|
178506
178918
|
switch (kind) {
|
|
178919
|
+
// open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
|
|
178507
178920
|
case 19 /* OpenBraceToken */:
|
|
178508
178921
|
case 20 /* CloseBraceToken */:
|
|
178509
178922
|
case 22 /* CloseParenToken */:
|
|
@@ -189417,9 +189830,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
189417
189830
|
const result = [];
|
|
189418
189831
|
const processDirectory = (directory) => {
|
|
189419
189832
|
switch (packageJsonCache.directoryHasPackageJson(directory)) {
|
|
189833
|
+
// Sync and check same directory again
|
|
189420
189834
|
case 3 /* Maybe */:
|
|
189421
189835
|
packageJsonCache.searchDirectoryAndAncestors(directory);
|
|
189422
189836
|
return processDirectory(directory);
|
|
189837
|
+
// Check package.json
|
|
189423
189838
|
case -1 /* True */:
|
|
189424
189839
|
const packageJsonFileName = combinePaths(directory, "package.json");
|
|
189425
189840
|
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
|