typescript 5.2.0-dev.20230803 → 5.2.0-dev.20230805
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 +151 -85
- package/lib/tsserver.js +194 -121
- package/lib/tsserverlibrary.d.ts +8 -2
- package/lib/tsserverlibrary.js +194 -121
- package/lib/typescript.d.ts +5 -1
- package/lib/typescript.js +185 -111
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2331,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2331
2331
|
|
|
2332
2332
|
// src/compiler/corePublic.ts
|
|
2333
2333
|
var versionMajorMinor = "5.2";
|
|
2334
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2334
|
+
var version = `${versionMajorMinor}.0-dev.20230805`;
|
|
2335
2335
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2336
2336
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2337
2337
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6625,15 +6625,13 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
|
|
|
6625
6625
|
NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
6626
6626
|
NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
6627
6627
|
NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
6628
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6629
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6630
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6631
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6632
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6633
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6634
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6635
|
-
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 8388608] = "ContainsSuperPropertyInStaticInitializer";
|
|
6636
|
-
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 16777216] = "InCheckIdentifier";
|
|
6628
|
+
NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
6629
|
+
NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
6630
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
6631
|
+
NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
6632
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
6633
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
6634
|
+
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
6637
6635
|
return NodeCheckFlags2;
|
|
6638
6636
|
})(NodeCheckFlags || {});
|
|
6639
6637
|
var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
@@ -29939,7 +29937,7 @@ function createAccessorPropertyBackingField(factory2, node, modifiers, initializ
|
|
|
29939
29937
|
initializer
|
|
29940
29938
|
);
|
|
29941
29939
|
}
|
|
29942
|
-
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
29940
|
+
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
29943
29941
|
return factory2.createGetAccessorDeclaration(
|
|
29944
29942
|
modifiers,
|
|
29945
29943
|
name,
|
|
@@ -29949,7 +29947,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
|
29949
29947
|
factory2.createBlock([
|
|
29950
29948
|
factory2.createReturnStatement(
|
|
29951
29949
|
factory2.createPropertyAccessExpression(
|
|
29952
|
-
|
|
29950
|
+
receiver,
|
|
29953
29951
|
factory2.getGeneratedPrivateNameForNode(
|
|
29954
29952
|
node.name,
|
|
29955
29953
|
/*prefix*/
|
|
@@ -29961,7 +29959,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
|
29961
29959
|
])
|
|
29962
29960
|
);
|
|
29963
29961
|
}
|
|
29964
|
-
function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
|
|
29962
|
+
function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
29965
29963
|
return factory2.createSetAccessorDeclaration(
|
|
29966
29964
|
modifiers,
|
|
29967
29965
|
name,
|
|
@@ -29976,7 +29974,7 @@ function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
|
|
|
29976
29974
|
factory2.createExpressionStatement(
|
|
29977
29975
|
factory2.createAssignment(
|
|
29978
29976
|
factory2.createPropertyAccessExpression(
|
|
29979
|
-
|
|
29977
|
+
receiver,
|
|
29980
29978
|
factory2.getGeneratedPrivateNameForNode(
|
|
29981
29979
|
node.name,
|
|
29982
29980
|
/*prefix*/
|
|
@@ -49068,7 +49066,7 @@ function createTypeChecker(host) {
|
|
|
49068
49066
|
return symbol;
|
|
49069
49067
|
}
|
|
49070
49068
|
if (symbol.flags & 2097152 /* Alias */) {
|
|
49071
|
-
const targetFlags =
|
|
49069
|
+
const targetFlags = getSymbolFlags(symbol);
|
|
49072
49070
|
if (targetFlags & meaning) {
|
|
49073
49071
|
return symbol;
|
|
49074
49072
|
}
|
|
@@ -49828,7 +49826,7 @@ function createTypeChecker(host) {
|
|
|
49828
49826
|
/*isUse*/
|
|
49829
49827
|
false
|
|
49830
49828
|
));
|
|
49831
|
-
const allFlags = symbol &&
|
|
49829
|
+
const allFlags = symbol && getSymbolFlags(symbol);
|
|
49832
49830
|
if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
|
|
49833
49831
|
const rawName = unescapeLeadingUnderscores(name);
|
|
49834
49832
|
if (isES2015OrLaterConstructorName(name)) {
|
|
@@ -50564,11 +50562,23 @@ function createTypeChecker(host) {
|
|
|
50564
50562
|
}
|
|
50565
50563
|
return void 0;
|
|
50566
50564
|
}
|
|
50567
|
-
function
|
|
50568
|
-
|
|
50565
|
+
function getSymbolFlags(symbol, excludeTypeOnlyMeanings, excludeLocalMeanings) {
|
|
50566
|
+
const typeOnlyDeclaration = excludeTypeOnlyMeanings && getTypeOnlyAliasDeclaration(symbol);
|
|
50567
|
+
const typeOnlyDeclarationIsExportStar = typeOnlyDeclaration && isExportDeclaration(typeOnlyDeclaration);
|
|
50568
|
+
const typeOnlyResolution = typeOnlyDeclaration && (typeOnlyDeclarationIsExportStar ? resolveExternalModuleName(
|
|
50569
|
+
typeOnlyDeclaration.moduleSpecifier,
|
|
50570
|
+
typeOnlyDeclaration.moduleSpecifier,
|
|
50571
|
+
/*ignoreErrors*/
|
|
50572
|
+
true
|
|
50573
|
+
) : resolveAlias(typeOnlyDeclaration.symbol));
|
|
50574
|
+
const typeOnlyExportStarTargets = typeOnlyDeclarationIsExportStar && typeOnlyResolution ? getExportsOfModule(typeOnlyResolution) : void 0;
|
|
50575
|
+
let flags = excludeLocalMeanings ? 0 /* None */ : symbol.flags;
|
|
50569
50576
|
let seenSymbols;
|
|
50570
50577
|
while (symbol.flags & 2097152 /* Alias */) {
|
|
50571
|
-
const target = resolveAlias(symbol);
|
|
50578
|
+
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
50579
|
+
if (!typeOnlyDeclarationIsExportStar && target === typeOnlyResolution || (typeOnlyExportStarTargets == null ? void 0 : typeOnlyExportStarTargets.get(target.escapedName)) === target) {
|
|
50580
|
+
break;
|
|
50581
|
+
}
|
|
50572
50582
|
if (target === unknownSymbol) {
|
|
50573
50583
|
return 67108863 /* All */;
|
|
50574
50584
|
}
|
|
@@ -50626,7 +50636,7 @@ function createTypeChecker(host) {
|
|
|
50626
50636
|
}
|
|
50627
50637
|
if (links.typeOnlyDeclaration) {
|
|
50628
50638
|
const resolved = links.typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol);
|
|
50629
|
-
return
|
|
50639
|
+
return getSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
|
|
50630
50640
|
}
|
|
50631
50641
|
return void 0;
|
|
50632
50642
|
}
|
|
@@ -50637,7 +50647,11 @@ function createTypeChecker(host) {
|
|
|
50637
50647
|
const symbol = getSymbolOfDeclaration(node);
|
|
50638
50648
|
const target = resolveAlias(symbol);
|
|
50639
50649
|
if (target) {
|
|
50640
|
-
const markAlias = target === unknownSymbol ||
|
|
50650
|
+
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
50651
|
+
symbol,
|
|
50652
|
+
/*excludeTypeOnlyMeanings*/
|
|
50653
|
+
true
|
|
50654
|
+
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
50641
50655
|
if (markAlias) {
|
|
50642
50656
|
markAliasSymbolAsReferenced(symbol);
|
|
50643
50657
|
}
|
|
@@ -50652,7 +50666,7 @@ function createTypeChecker(host) {
|
|
|
50652
50666
|
if (!node)
|
|
50653
50667
|
return Debug.fail();
|
|
50654
50668
|
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
50655
|
-
if (
|
|
50669
|
+
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
50656
50670
|
checkExpressionCached(node.moduleReference);
|
|
50657
50671
|
}
|
|
50658
50672
|
}
|
|
@@ -51503,7 +51517,7 @@ function createTypeChecker(host) {
|
|
|
51503
51517
|
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51504
51518
|
}
|
|
51505
51519
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
51506
|
-
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ &&
|
|
51520
|
+
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
51507
51521
|
}
|
|
51508
51522
|
function findConstructorDeclaration(node) {
|
|
51509
51523
|
const members = node.members;
|
|
@@ -51770,7 +51784,7 @@ function createTypeChecker(host) {
|
|
|
51770
51784
|
}
|
|
51771
51785
|
const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 281 /* ExportSpecifier */);
|
|
51772
51786
|
symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
|
|
51773
|
-
const flags = shouldResolveAlias ?
|
|
51787
|
+
const flags = shouldResolveAlias ? getSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
|
|
51774
51788
|
if (flags & meaning) {
|
|
51775
51789
|
qualify = true;
|
|
51776
51790
|
return true;
|
|
@@ -54632,7 +54646,7 @@ function createTypeChecker(host) {
|
|
|
54632
54646
|
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
54633
54647
|
}
|
|
54634
54648
|
function isTypeOnlyNamespace(symbol) {
|
|
54635
|
-
return every(getNamespaceMembersForSerialization(symbol), (m) => !(
|
|
54649
|
+
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
54636
54650
|
}
|
|
54637
54651
|
function serializeModule(symbol, symbolName2, modifierFlags) {
|
|
54638
54652
|
const members = getNamespaceMembersForSerialization(symbol);
|
|
@@ -56904,7 +56918,7 @@ function createTypeChecker(host) {
|
|
|
56904
56918
|
true
|
|
56905
56919
|
);
|
|
56906
56920
|
const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
|
|
56907
|
-
links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType :
|
|
56921
|
+
links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType;
|
|
56908
56922
|
}
|
|
56909
56923
|
return links.type;
|
|
56910
56924
|
}
|
|
@@ -64514,6 +64528,7 @@ function createTypeChecker(host) {
|
|
|
64514
64528
|
let errorInfo;
|
|
64515
64529
|
let relatedInfo;
|
|
64516
64530
|
let maybeKeys;
|
|
64531
|
+
let maybeKeysSet;
|
|
64517
64532
|
let sourceStack;
|
|
64518
64533
|
let targetStack;
|
|
64519
64534
|
let maybeCount = 0;
|
|
@@ -65383,9 +65398,13 @@ function createTypeChecker(host) {
|
|
|
65383
65398
|
}
|
|
65384
65399
|
if (!maybeKeys) {
|
|
65385
65400
|
maybeKeys = [];
|
|
65401
|
+
maybeKeysSet = /* @__PURE__ */ new Set();
|
|
65386
65402
|
sourceStack = [];
|
|
65387
65403
|
targetStack = [];
|
|
65388
65404
|
} else {
|
|
65405
|
+
if (maybeKeysSet.has(id)) {
|
|
65406
|
+
return 3 /* Maybe */;
|
|
65407
|
+
}
|
|
65389
65408
|
const broadestEquivalentId = id.startsWith("*") ? getRelationKey(
|
|
65390
65409
|
source2,
|
|
65391
65410
|
target2,
|
|
@@ -65394,10 +65413,8 @@ function createTypeChecker(host) {
|
|
|
65394
65413
|
/*ignoreConstraints*/
|
|
65395
65414
|
true
|
|
65396
65415
|
) : void 0;
|
|
65397
|
-
|
|
65398
|
-
|
|
65399
|
-
return 3 /* Maybe */;
|
|
65400
|
-
}
|
|
65416
|
+
if (broadestEquivalentId && maybeKeysSet.has(broadestEquivalentId)) {
|
|
65417
|
+
return 3 /* Maybe */;
|
|
65401
65418
|
}
|
|
65402
65419
|
if (sourceDepth === 100 || targetDepth === 100) {
|
|
65403
65420
|
overflow = true;
|
|
@@ -65406,6 +65423,7 @@ function createTypeChecker(host) {
|
|
|
65406
65423
|
}
|
|
65407
65424
|
const maybeStart = maybeCount;
|
|
65408
65425
|
maybeKeys[maybeCount] = id;
|
|
65426
|
+
maybeKeysSet.add(id);
|
|
65409
65427
|
maybeCount++;
|
|
65410
65428
|
const saveExpandingFlags = expandingFlags;
|
|
65411
65429
|
if (recursionFlags & 1 /* Source */) {
|
|
@@ -65458,17 +65476,34 @@ function createTypeChecker(host) {
|
|
|
65458
65476
|
if (result2) {
|
|
65459
65477
|
if (result2 === -1 /* True */ || sourceDepth === 0 && targetDepth === 0) {
|
|
65460
65478
|
if (result2 === -1 /* True */ || result2 === 3 /* Maybe */) {
|
|
65461
|
-
|
|
65462
|
-
|
|
65463
|
-
|
|
65479
|
+
resetMaybeStack(
|
|
65480
|
+
/*markAllAsSucceeded*/
|
|
65481
|
+
true
|
|
65482
|
+
);
|
|
65483
|
+
} else {
|
|
65484
|
+
resetMaybeStack(
|
|
65485
|
+
/*markAllAsSucceeded*/
|
|
65486
|
+
false
|
|
65487
|
+
);
|
|
65464
65488
|
}
|
|
65465
|
-
maybeCount = maybeStart;
|
|
65466
65489
|
}
|
|
65467
65490
|
} else {
|
|
65468
65491
|
relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
|
|
65469
|
-
|
|
65492
|
+
resetMaybeStack(
|
|
65493
|
+
/*markAllAsSucceeded*/
|
|
65494
|
+
false
|
|
65495
|
+
);
|
|
65470
65496
|
}
|
|
65471
65497
|
return result2;
|
|
65498
|
+
function resetMaybeStack(markAllAsSucceeded) {
|
|
65499
|
+
for (let i = maybeStart; i < maybeCount; i++) {
|
|
65500
|
+
maybeKeysSet.delete(maybeKeys[i]);
|
|
65501
|
+
if (markAllAsSucceeded) {
|
|
65502
|
+
relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
|
|
65503
|
+
}
|
|
65504
|
+
}
|
|
65505
|
+
maybeCount = maybeStart;
|
|
65506
|
+
}
|
|
65472
65507
|
}
|
|
65473
65508
|
function structuredTypeRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
65474
65509
|
const saveErrorInfo = captureErrorCalculationState();
|
|
@@ -70821,8 +70856,8 @@ function createTypeChecker(host) {
|
|
|
70821
70856
|
}
|
|
70822
70857
|
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
70823
70858
|
const links = getNodeLinks(parent2);
|
|
70824
|
-
if (!(links.flags &
|
|
70825
|
-
links.flags |=
|
|
70859
|
+
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
70860
|
+
links.flags |= 131072 /* AssignmentsMarked */;
|
|
70826
70861
|
if (!hasParentWithAssignmentsMarked(parent2)) {
|
|
70827
70862
|
markNodeAssignments(parent2);
|
|
70828
70863
|
}
|
|
@@ -70830,7 +70865,7 @@ function createTypeChecker(host) {
|
|
|
70830
70865
|
return symbol.isAssigned || false;
|
|
70831
70866
|
}
|
|
70832
70867
|
function hasParentWithAssignmentsMarked(node) {
|
|
70833
|
-
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags &
|
|
70868
|
+
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
70834
70869
|
}
|
|
70835
70870
|
function markNodeAssignments(node) {
|
|
70836
70871
|
if (node.kind === 80 /* Identifier */) {
|
|
@@ -70912,9 +70947,13 @@ function createTypeChecker(host) {
|
|
|
70912
70947
|
symbol,
|
|
70913
70948
|
/*excludes*/
|
|
70914
70949
|
111551 /* Value */
|
|
70915
|
-
) && !isInTypeQuery(location)
|
|
70950
|
+
) && !isInTypeQuery(location)) {
|
|
70916
70951
|
const target = resolveAlias(symbol);
|
|
70917
|
-
if (
|
|
70952
|
+
if (getSymbolFlags(
|
|
70953
|
+
symbol,
|
|
70954
|
+
/*excludeTypeOnlyMeanings*/
|
|
70955
|
+
true
|
|
70956
|
+
) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
70918
70957
|
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
|
|
70919
70958
|
markAliasSymbolAsReferenced(symbol);
|
|
70920
70959
|
} else {
|
|
@@ -70932,11 +70971,11 @@ function createTypeChecker(host) {
|
|
|
70932
70971
|
const parent2 = declaration.parent.parent;
|
|
70933
70972
|
if (parent2.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent2.kind === 169 /* Parameter */) {
|
|
70934
70973
|
const links = getNodeLinks(parent2);
|
|
70935
|
-
if (!(links.flags &
|
|
70936
|
-
links.flags |=
|
|
70974
|
+
if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
|
|
70975
|
+
links.flags |= 4194304 /* InCheckIdentifier */;
|
|
70937
70976
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
70938
70977
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
70939
|
-
links.flags &= ~
|
|
70978
|
+
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
70940
70979
|
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
70941
70980
|
const pattern = declaration.parent;
|
|
70942
70981
|
const narrowedType = getFlowTypeOfReference(
|
|
@@ -71013,17 +71052,7 @@ function createTypeChecker(host) {
|
|
|
71013
71052
|
}
|
|
71014
71053
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
71015
71054
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
71016
|
-
if (declaration
|
|
71017
|
-
let container = getContainingClass(node);
|
|
71018
|
-
while (container !== void 0) {
|
|
71019
|
-
if (container === declaration && container.name !== node) {
|
|
71020
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
71021
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
71022
|
-
break;
|
|
71023
|
-
}
|
|
71024
|
-
container = getContainingClass(container);
|
|
71025
|
-
}
|
|
71026
|
-
} else if (declaration.kind === 231 /* ClassExpression */) {
|
|
71055
|
+
if (isClassLike(declaration) && declaration.name !== node) {
|
|
71027
71056
|
let container = getThisContainer(
|
|
71028
71057
|
node,
|
|
71029
71058
|
/*includeArrowFunctions*/
|
|
@@ -71031,14 +71060,7 @@ function createTypeChecker(host) {
|
|
|
71031
71060
|
/*includeClassComputedPropertyName*/
|
|
71032
71061
|
false
|
|
71033
71062
|
);
|
|
71034
|
-
while (container.kind !== 312 /* SourceFile */) {
|
|
71035
|
-
if (container.parent === declaration) {
|
|
71036
|
-
if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
|
|
71037
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
71038
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
71039
|
-
}
|
|
71040
|
-
break;
|
|
71041
|
-
}
|
|
71063
|
+
while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) {
|
|
71042
71064
|
container = getThisContainer(
|
|
71043
71065
|
container,
|
|
71044
71066
|
/*includeArrowFunctions*/
|
|
@@ -71047,6 +71069,11 @@ function createTypeChecker(host) {
|
|
|
71047
71069
|
false
|
|
71048
71070
|
);
|
|
71049
71071
|
}
|
|
71072
|
+
if (container.kind !== 312 /* SourceFile */) {
|
|
71073
|
+
getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */;
|
|
71074
|
+
getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */;
|
|
71075
|
+
getNodeLinks(node).flags |= 536870912 /* ConstructorReference */;
|
|
71076
|
+
}
|
|
71050
71077
|
}
|
|
71051
71078
|
}
|
|
71052
71079
|
checkNestedBlockScopedBinding(node, symbol);
|
|
@@ -71177,7 +71204,7 @@ function createTypeChecker(host) {
|
|
|
71177
71204
|
if (isForStatement(container)) {
|
|
71178
71205
|
const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */);
|
|
71179
71206
|
if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
|
|
71180
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
71207
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */;
|
|
71181
71208
|
}
|
|
71182
71209
|
}
|
|
71183
71210
|
getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
@@ -71455,7 +71482,7 @@ function createTypeChecker(host) {
|
|
|
71455
71482
|
if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
|
|
71456
71483
|
forEachEnclosingBlockScopeContainer(node.parent, (current) => {
|
|
71457
71484
|
if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
|
|
71458
|
-
getNodeLinks(current).flags |=
|
|
71485
|
+
getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
71459
71486
|
}
|
|
71460
71487
|
});
|
|
71461
71488
|
}
|
|
@@ -74997,7 +75024,7 @@ function createTypeChecker(host) {
|
|
|
74997
75024
|
}
|
|
74998
75025
|
}
|
|
74999
75026
|
function getThisArgumentOfCall(node) {
|
|
75000
|
-
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : void 0;
|
|
75027
|
+
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
|
|
75001
75028
|
if (expression) {
|
|
75002
75029
|
const callee = skipOuterExpressions(expression);
|
|
75003
75030
|
if (isAccessExpression(callee)) {
|
|
@@ -79904,7 +79931,7 @@ function createTypeChecker(host) {
|
|
|
79904
79931
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
79905
79932
|
if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
|
|
79906
79933
|
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
79907
|
-
getNodeLinks(lexicalScope).flags |=
|
|
79934
|
+
getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
|
|
79908
79935
|
}
|
|
79909
79936
|
if (isClassExpression(node.parent)) {
|
|
79910
79937
|
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
@@ -81657,7 +81684,7 @@ function createTypeChecker(host) {
|
|
|
81657
81684
|
}
|
|
81658
81685
|
function checkWeakMapSetCollision(node) {
|
|
81659
81686
|
const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
|
|
81660
|
-
if (getNodeCheckFlags(enclosingBlockScope) &
|
|
81687
|
+
if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) {
|
|
81661
81688
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
|
|
81662
81689
|
errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
|
|
81663
81690
|
}
|
|
@@ -81671,18 +81698,18 @@ function createTypeChecker(host) {
|
|
|
81671
81698
|
let hasCollision = false;
|
|
81672
81699
|
if (isClassExpression(node)) {
|
|
81673
81700
|
for (const member of node.members) {
|
|
81674
|
-
if (getNodeCheckFlags(member) &
|
|
81701
|
+
if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81675
81702
|
hasCollision = true;
|
|
81676
81703
|
break;
|
|
81677
81704
|
}
|
|
81678
81705
|
}
|
|
81679
81706
|
} else if (isFunctionExpression(node)) {
|
|
81680
|
-
if (getNodeCheckFlags(node) &
|
|
81707
|
+
if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81681
81708
|
hasCollision = true;
|
|
81682
81709
|
}
|
|
81683
81710
|
} else {
|
|
81684
81711
|
const container = getEnclosingBlockScopeContainer(node);
|
|
81685
|
-
if (container && getNodeCheckFlags(container) &
|
|
81712
|
+
if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81686
81713
|
hasCollision = true;
|
|
81687
81714
|
}
|
|
81688
81715
|
}
|
|
@@ -81717,9 +81744,6 @@ function createTypeChecker(host) {
|
|
|
81717
81744
|
if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
|
|
81718
81745
|
return;
|
|
81719
81746
|
}
|
|
81720
|
-
if (node.kind === 260 /* VariableDeclaration */ && !node.initializer) {
|
|
81721
|
-
return;
|
|
81722
|
-
}
|
|
81723
81747
|
const symbol = getSymbolOfDeclaration(node);
|
|
81724
81748
|
if (symbol.flags & 1 /* FunctionScopedVariable */) {
|
|
81725
81749
|
if (!isIdentifier(node.name))
|
|
@@ -84341,7 +84365,7 @@ function createTypeChecker(host) {
|
|
|
84341
84365
|
}
|
|
84342
84366
|
return;
|
|
84343
84367
|
}
|
|
84344
|
-
const targetFlags =
|
|
84368
|
+
const targetFlags = getSymbolFlags(target);
|
|
84345
84369
|
const excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) | (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
|
|
84346
84370
|
if (targetFlags & excludedMeanings) {
|
|
84347
84371
|
const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
@@ -84499,7 +84523,7 @@ function createTypeChecker(host) {
|
|
|
84499
84523
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
84500
84524
|
const target = resolveAlias(getSymbolOfDeclaration(node));
|
|
84501
84525
|
if (target !== unknownSymbol) {
|
|
84502
|
-
const targetFlags =
|
|
84526
|
+
const targetFlags = getSymbolFlags(target);
|
|
84503
84527
|
if (targetFlags & 111551 /* Value */) {
|
|
84504
84528
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
84505
84529
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
@@ -84639,7 +84663,7 @@ function createTypeChecker(host) {
|
|
|
84639
84663
|
markExportAsReferenced(node);
|
|
84640
84664
|
}
|
|
84641
84665
|
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
84642
|
-
if (!target ||
|
|
84666
|
+
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
84643
84667
|
checkExpressionCached(node.propertyName || node.name);
|
|
84644
84668
|
}
|
|
84645
84669
|
}
|
|
@@ -84684,7 +84708,7 @@ function createTypeChecker(host) {
|
|
|
84684
84708
|
));
|
|
84685
84709
|
if (sym) {
|
|
84686
84710
|
markAliasReferenced(sym, id);
|
|
84687
|
-
if (
|
|
84711
|
+
if (getSymbolFlags(sym) & 111551 /* Value */) {
|
|
84688
84712
|
checkExpressionCached(id);
|
|
84689
84713
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
84690
84714
|
error2(
|
|
@@ -85931,7 +85955,7 @@ function createTypeChecker(host) {
|
|
|
85931
85955
|
return symbolLinks2.exportsSomeValue;
|
|
85932
85956
|
function isValue(s) {
|
|
85933
85957
|
s = resolveSymbol(s);
|
|
85934
|
-
return s && !!(
|
|
85958
|
+
return s && !!(getSymbolFlags(s) & 111551 /* Value */);
|
|
85935
85959
|
}
|
|
85936
85960
|
}
|
|
85937
85961
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
@@ -86061,7 +86085,11 @@ function createTypeChecker(host) {
|
|
|
86061
86085
|
case 276 /* ImportSpecifier */:
|
|
86062
86086
|
case 281 /* ExportSpecifier */:
|
|
86063
86087
|
const symbol = getSymbolOfDeclaration(node);
|
|
86064
|
-
return !!symbol && isAliasResolvedToValue(
|
|
86088
|
+
return !!symbol && isAliasResolvedToValue(
|
|
86089
|
+
symbol,
|
|
86090
|
+
/*excludeTypeOnlyValues*/
|
|
86091
|
+
true
|
|
86092
|
+
);
|
|
86065
86093
|
case 278 /* ExportDeclaration */:
|
|
86066
86094
|
const exportClause = node.exportClause;
|
|
86067
86095
|
return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration));
|
|
@@ -86078,7 +86106,7 @@ function createTypeChecker(host) {
|
|
|
86078
86106
|
const isValue = isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
86079
86107
|
return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference);
|
|
86080
86108
|
}
|
|
86081
|
-
function isAliasResolvedToValue(symbol) {
|
|
86109
|
+
function isAliasResolvedToValue(symbol, excludeTypeOnlyValues) {
|
|
86082
86110
|
if (!symbol) {
|
|
86083
86111
|
return false;
|
|
86084
86112
|
}
|
|
@@ -86086,7 +86114,12 @@ function createTypeChecker(host) {
|
|
|
86086
86114
|
if (target === unknownSymbol) {
|
|
86087
86115
|
return true;
|
|
86088
86116
|
}
|
|
86089
|
-
return !!((
|
|
86117
|
+
return !!(getSymbolFlags(
|
|
86118
|
+
symbol,
|
|
86119
|
+
excludeTypeOnlyValues,
|
|
86120
|
+
/*excludeLocalMeanings*/
|
|
86121
|
+
true
|
|
86122
|
+
) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
|
|
86090
86123
|
}
|
|
86091
86124
|
function isConstEnumOrConstEnumOnlyModule(s) {
|
|
86092
86125
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
@@ -86100,7 +86133,7 @@ function createTypeChecker(host) {
|
|
|
86100
86133
|
return true;
|
|
86101
86134
|
}
|
|
86102
86135
|
const target = getSymbolLinks(symbol).aliasTarget;
|
|
86103
|
-
if (target && getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86136
|
+
if (target && getEffectiveModifierFlags(node) & 1 /* Export */ && getSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
86104
86137
|
return true;
|
|
86105
86138
|
}
|
|
86106
86139
|
}
|
|
@@ -93966,6 +93999,11 @@ function transformClassFields(context) {
|
|
|
93966
93999
|
}
|
|
93967
94000
|
}
|
|
93968
94001
|
}
|
|
94002
|
+
function getClassThis() {
|
|
94003
|
+
const lex = getClassLexicalEnvironment();
|
|
94004
|
+
const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
94005
|
+
return Debug.checkDefined(classThis);
|
|
94006
|
+
}
|
|
93969
94007
|
function transformAutoAccessor(node) {
|
|
93970
94008
|
const commentRange = getCommentRange(node);
|
|
93971
94009
|
const sourceMapRange = getSourceMapRange(node);
|
|
@@ -93992,11 +94030,13 @@ function transformClassFields(context) {
|
|
|
93992
94030
|
setOriginalNode(backingField, node);
|
|
93993
94031
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
93994
94032
|
setSourceMapRange(backingField, sourceMapRange);
|
|
93995
|
-
const
|
|
94033
|
+
const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
|
|
94034
|
+
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
93996
94035
|
setOriginalNode(getter, node);
|
|
93997
94036
|
setCommentRange(getter, commentRange);
|
|
93998
94037
|
setSourceMapRange(getter, sourceMapRange);
|
|
93999
|
-
const
|
|
94038
|
+
const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers));
|
|
94039
|
+
const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver);
|
|
94000
94040
|
setOriginalNode(setter, node);
|
|
94001
94041
|
setEmitFlags(setter, 3072 /* NoComments */);
|
|
94002
94042
|
setSourceMapRange(setter, sourceMapRange);
|
|
@@ -94553,6 +94593,7 @@ function transformClassFields(context) {
|
|
|
94553
94593
|
return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName);
|
|
94554
94594
|
}
|
|
94555
94595
|
function getClassFacts(node) {
|
|
94596
|
+
var _a;
|
|
94556
94597
|
let facts = 0 /* None */;
|
|
94557
94598
|
const original = getOriginalNode(node);
|
|
94558
94599
|
if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
@@ -94569,6 +94610,8 @@ function transformClassFields(context) {
|
|
|
94569
94610
|
if (isStatic(member)) {
|
|
94570
94611
|
if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
94571
94612
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94613
|
+
} else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) {
|
|
94614
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94572
94615
|
}
|
|
94573
94616
|
if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
|
|
94574
94617
|
if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
|
|
@@ -94589,6 +94632,9 @@ function transformClassFields(context) {
|
|
|
94589
94632
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
94590
94633
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
94591
94634
|
containsInstancePrivateElements = true;
|
|
94635
|
+
if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
|
|
94636
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94637
|
+
}
|
|
94592
94638
|
} else if (isPropertyDeclaration(member)) {
|
|
94593
94639
|
containsPublicInstanceFields = true;
|
|
94594
94640
|
containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
|
|
@@ -94689,10 +94735,11 @@ function transformClassFields(context) {
|
|
|
94689
94735
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp);
|
|
94690
94736
|
pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node));
|
|
94691
94737
|
}
|
|
94692
|
-
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
94693
|
-
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
94694
|
-
}
|
|
94695
94738
|
}
|
|
94739
|
+
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
94740
|
+
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
94741
|
+
}
|
|
94742
|
+
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
|
|
94696
94743
|
const isExport = hasSyntacticModifier(node, 1 /* Export */);
|
|
94697
94744
|
const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
|
|
94698
94745
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -94727,6 +94774,11 @@ function transformClassFields(context) {
|
|
|
94727
94774
|
)
|
|
94728
94775
|
));
|
|
94729
94776
|
}
|
|
94777
|
+
const alias = getClassLexicalEnvironment().classConstructor;
|
|
94778
|
+
if (isClassWithConstructorReference && alias) {
|
|
94779
|
+
enableSubstitutionForClassAliases();
|
|
94780
|
+
classAliases[getOriginalNodeId(node)] = alias;
|
|
94781
|
+
}
|
|
94730
94782
|
const classDecl = factory2.updateClassDeclaration(
|
|
94731
94783
|
node,
|
|
94732
94784
|
modifiers,
|
|
@@ -94749,14 +94801,14 @@ function transformClassFields(context) {
|
|
|
94749
94801
|
var _a, _b, _c;
|
|
94750
94802
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
94751
94803
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
94752
|
-
const
|
|
94804
|
+
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
94805
|
+
const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
|
|
94753
94806
|
let temp;
|
|
94754
94807
|
function createClassTempVar() {
|
|
94755
94808
|
var _a2;
|
|
94756
94809
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
94757
94810
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
94758
94811
|
}
|
|
94759
|
-
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
94760
94812
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
94761
94813
|
const temp2 = factory2.createTempVariable(
|
|
94762
94814
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
@@ -95723,7 +95775,7 @@ function transformClassFields(context) {
|
|
|
95723
95775
|
}
|
|
95724
95776
|
function trySubstituteClassAlias(node) {
|
|
95725
95777
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
95726
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
95778
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
95727
95779
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95728
95780
|
if (declaration) {
|
|
95729
95781
|
const classAlias = classAliases[declaration.id];
|
|
@@ -96577,7 +96629,7 @@ function transformLegacyDecorators(context) {
|
|
|
96577
96629
|
}
|
|
96578
96630
|
}
|
|
96579
96631
|
function getClassAliasIfNeeded(node) {
|
|
96580
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
96632
|
+
if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
|
|
96581
96633
|
enableSubstitutionForClassAliases();
|
|
96582
96634
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
96583
96635
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -96610,7 +96662,7 @@ function transformLegacyDecorators(context) {
|
|
|
96610
96662
|
}
|
|
96611
96663
|
function trySubstituteClassAlias(node) {
|
|
96612
96664
|
if (classAliases) {
|
|
96613
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
96665
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
96614
96666
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
96615
96667
|
if (declaration) {
|
|
96616
96668
|
const classAlias = classAliases[declaration.id];
|
|
@@ -96636,6 +96688,7 @@ function transformESDecorators(context) {
|
|
|
96636
96688
|
endLexicalEnvironment,
|
|
96637
96689
|
hoistVariableDeclaration
|
|
96638
96690
|
} = context;
|
|
96691
|
+
const languageVersion = getEmitScriptTarget(context.getCompilerOptions());
|
|
96639
96692
|
let top;
|
|
96640
96693
|
let classInfo;
|
|
96641
96694
|
let classThis;
|
|
@@ -98137,6 +98190,17 @@ function transformESDecorators(context) {
|
|
|
98137
98190
|
function transformDecorator(decorator) {
|
|
98138
98191
|
const expression = visitNode(decorator.expression, visitor, isExpression);
|
|
98139
98192
|
setEmitFlags(expression, 3072 /* NoComments */);
|
|
98193
|
+
const innerExpression = skipOuterExpressions(expression);
|
|
98194
|
+
if (isAccessExpression(innerExpression)) {
|
|
98195
|
+
const { target, thisArg } = factory2.createCallBinding(
|
|
98196
|
+
expression,
|
|
98197
|
+
hoistVariableDeclaration,
|
|
98198
|
+
languageVersion,
|
|
98199
|
+
/*cacheIdentifiers*/
|
|
98200
|
+
true
|
|
98201
|
+
);
|
|
98202
|
+
return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, []));
|
|
98203
|
+
}
|
|
98140
98204
|
return expression;
|
|
98141
98205
|
}
|
|
98142
98206
|
function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) {
|
|
@@ -104780,10 +104844,10 @@ function transformES2015(context) {
|
|
|
104780
104844
|
name
|
|
104781
104845
|
));
|
|
104782
104846
|
const checkFlags = resolver.getNodeCheckFlags(decl);
|
|
104783
|
-
if (checkFlags &
|
|
104847
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
|
|
104784
104848
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
104785
104849
|
let flags = 0 /* None */;
|
|
104786
|
-
if (checkFlags &
|
|
104850
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
|
|
104787
104851
|
flags |= 1 /* Body */;
|
|
104788
104852
|
}
|
|
104789
104853
|
if (isForStatement(container)) {
|
|
@@ -138349,7 +138413,7 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
138349
138413
|
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
138350
138414
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
138351
138415
|
}
|
|
138352
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
138416
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
138353
138417
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
138354
138418
|
}
|
|
138355
138419
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
@@ -138985,25 +139049,25 @@ function getRangeToMove(context) {
|
|
|
138985
139049
|
const { file } = context;
|
|
138986
139050
|
const range = createTextRangeFromSpan(getRefactorContextSpan(context));
|
|
138987
139051
|
const { statements } = file;
|
|
138988
|
-
|
|
139052
|
+
let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
|
|
138989
139053
|
if (startNodeIndex === -1)
|
|
138990
139054
|
return void 0;
|
|
138991
139055
|
const startStatement = statements[startNodeIndex];
|
|
138992
|
-
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
138993
|
-
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
138994
|
-
}
|
|
138995
139056
|
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
138996
139057
|
if (overloadRangeToMove) {
|
|
138997
|
-
|
|
139058
|
+
startNodeIndex = overloadRangeToMove.start;
|
|
139059
|
+
}
|
|
139060
|
+
let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
|
|
139061
|
+
if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
|
|
139062
|
+
endNodeIndex--;
|
|
139063
|
+
}
|
|
139064
|
+
const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
|
|
139065
|
+
if (endingOverloadRangeToMove) {
|
|
139066
|
+
endNodeIndex = endingOverloadRangeToMove.end;
|
|
138998
139067
|
}
|
|
138999
|
-
if (range.pos > startStatement.getStart(file))
|
|
139000
|
-
return void 0;
|
|
139001
|
-
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
139002
|
-
if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
|
|
139003
|
-
return void 0;
|
|
139004
139068
|
return {
|
|
139005
|
-
toMove: statements.slice(startNodeIndex,
|
|
139006
|
-
afterLast:
|
|
139069
|
+
toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
|
|
139070
|
+
afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
|
|
139007
139071
|
};
|
|
139008
139072
|
}
|
|
139009
139073
|
function getStatementsToMove(context) {
|
|
@@ -139258,10 +139322,12 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
139258
139322
|
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
139259
139323
|
return void 0;
|
|
139260
139324
|
}
|
|
139325
|
+
const firstDecl = declarations[0];
|
|
139261
139326
|
const lastDecl = declarations[length(declarations) - 1];
|
|
139262
139327
|
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
139263
|
-
const end =
|
|
139264
|
-
|
|
139328
|
+
const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
|
|
139329
|
+
const start2 = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
|
|
139330
|
+
return { toMove: statementsToMove, start: start2, end };
|
|
139265
139331
|
}
|
|
139266
139332
|
return void 0;
|
|
139267
139333
|
}
|
|
@@ -160444,6 +160510,11 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
|
|
|
160444
160510
|
return cls;
|
|
160445
160511
|
}
|
|
160446
160512
|
break;
|
|
160513
|
+
case 81 /* PrivateIdentifier */:
|
|
160514
|
+
if (tryCast(location.parent, isPropertyDeclaration)) {
|
|
160515
|
+
return findAncestor(location, isClassLike);
|
|
160516
|
+
}
|
|
160517
|
+
break;
|
|
160447
160518
|
case 80 /* Identifier */: {
|
|
160448
160519
|
const originalKeywordKind = identifierToKeywordKind(location);
|
|
160449
160520
|
if (originalKeywordKind) {
|
|
@@ -164691,8 +164762,10 @@ function provideInlayHints(context) {
|
|
|
164691
164762
|
}
|
|
164692
164763
|
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164693
164764
|
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164765
|
+
let displayParts;
|
|
164694
164766
|
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164695
|
-
|
|
164767
|
+
displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164768
|
+
hintText = "";
|
|
164696
164769
|
} else {
|
|
164697
164770
|
hintText += ":";
|
|
164698
164771
|
}
|
|
@@ -164700,7 +164773,8 @@ function provideInlayHints(context) {
|
|
|
164700
164773
|
text: hintText,
|
|
164701
164774
|
position,
|
|
164702
164775
|
kind: "Parameter" /* Parameter */,
|
|
164703
|
-
whitespaceAfter: true
|
|
164776
|
+
whitespaceAfter: true,
|
|
164777
|
+
displayParts
|
|
164704
164778
|
});
|
|
164705
164779
|
}
|
|
164706
164780
|
function addTypeHints(text, position) {
|
|
@@ -183588,19 +183662,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183588
183662
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
183589
183663
|
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
|
|
183590
183664
|
return hints.map((hint) => {
|
|
183591
|
-
const {
|
|
183592
|
-
const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
|
|
183593
|
-
text: text2,
|
|
183594
|
-
span: span && {
|
|
183595
|
-
start: scriptInfo.positionToLineOffset(span.start),
|
|
183596
|
-
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
183597
|
-
file: file2
|
|
183598
|
-
}
|
|
183599
|
-
}));
|
|
183665
|
+
const { position, displayParts } = hint;
|
|
183600
183666
|
return {
|
|
183601
183667
|
...hint,
|
|
183602
183668
|
position: scriptInfo.positionToLineOffset(position),
|
|
183603
|
-
text:
|
|
183669
|
+
displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
|
|
183670
|
+
text,
|
|
183671
|
+
span: span && {
|
|
183672
|
+
start: scriptInfo.positionToLineOffset(span.start),
|
|
183673
|
+
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
183674
|
+
file: file2
|
|
183675
|
+
}
|
|
183676
|
+
}))
|
|
183604
183677
|
};
|
|
183605
183678
|
});
|
|
183606
183679
|
}
|