typescript 5.3.0-dev.20231022 → 5.3.0-dev.20231024
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 +346 -176
- package/lib/tsserver.js +350 -180
- package/lib/typescript.d.ts +12 -0
- package/lib/typescript.js +350 -180
- package/lib/typingsInstaller.js +24 -5
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231024`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20769,8 +20769,9 @@ ${lanes.join("\n")}
|
|
|
20769
20769
|
ensureUseStrict,
|
|
20770
20770
|
liftToBlock,
|
|
20771
20771
|
mergeLexicalEnvironment,
|
|
20772
|
-
|
|
20773
|
-
|
|
20772
|
+
replaceModifiers,
|
|
20773
|
+
replaceDecoratorsAndModifiers,
|
|
20774
|
+
replacePropertyName
|
|
20774
20775
|
};
|
|
20775
20776
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20776
20777
|
return factory2;
|
|
@@ -24278,7 +24279,7 @@ ${lanes.join("\n")}
|
|
|
24278
24279
|
}
|
|
24279
24280
|
return statements;
|
|
24280
24281
|
}
|
|
24281
|
-
function
|
|
24282
|
+
function replaceModifiers(node, modifiers) {
|
|
24282
24283
|
let modifierArray;
|
|
24283
24284
|
if (typeof modifiers === "number") {
|
|
24284
24285
|
modifierArray = createModifiersFromModifierFlags(modifiers);
|
|
@@ -24287,9 +24288,27 @@ ${lanes.join("\n")}
|
|
|
24287
24288
|
}
|
|
24288
24289
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node);
|
|
24289
24290
|
}
|
|
24290
|
-
function
|
|
24291
|
+
function replaceDecoratorsAndModifiers(node, modifierArray) {
|
|
24291
24292
|
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
24292
24293
|
}
|
|
24294
|
+
function replacePropertyName(node, name) {
|
|
24295
|
+
switch (node.kind) {
|
|
24296
|
+
case 177 /* GetAccessor */:
|
|
24297
|
+
return updateGetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.type, node.body);
|
|
24298
|
+
case 178 /* SetAccessor */:
|
|
24299
|
+
return updateSetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.body);
|
|
24300
|
+
case 174 /* MethodDeclaration */:
|
|
24301
|
+
return updateMethodDeclaration(node, node.modifiers, node.asteriskToken, name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
24302
|
+
case 173 /* MethodSignature */:
|
|
24303
|
+
return updateMethodSignature(node, node.modifiers, name, node.questionToken, node.typeParameters, node.parameters, node.type);
|
|
24304
|
+
case 172 /* PropertyDeclaration */:
|
|
24305
|
+
return updatePropertyDeclaration2(node, node.modifiers, name, node.questionToken ?? node.exclamationToken, node.type, node.initializer);
|
|
24306
|
+
case 171 /* PropertySignature */:
|
|
24307
|
+
return updatePropertySignature(node, node.modifiers, name, node.questionToken, node.type);
|
|
24308
|
+
case 303 /* PropertyAssignment */:
|
|
24309
|
+
return updatePropertyAssignment(node, name, node.initializer);
|
|
24310
|
+
}
|
|
24311
|
+
}
|
|
24293
24312
|
function asNodeArray(array) {
|
|
24294
24313
|
return array ? createNodeArray(array) : void 0;
|
|
24295
24314
|
}
|
|
@@ -52412,11 +52431,11 @@ ${lanes.join("\n")}
|
|
|
52412
52431
|
}
|
|
52413
52432
|
function addExportModifier(node) {
|
|
52414
52433
|
const flags = (getEffectiveModifierFlags(node) | 1 /* Export */) & ~2 /* Ambient */;
|
|
52415
|
-
return factory.
|
|
52434
|
+
return factory.replaceModifiers(node, flags);
|
|
52416
52435
|
}
|
|
52417
52436
|
function removeExportModifier(node) {
|
|
52418
52437
|
const flags = getEffectiveModifierFlags(node) & ~1 /* Export */;
|
|
52419
|
-
return factory.
|
|
52438
|
+
return factory.replaceModifiers(node, flags);
|
|
52420
52439
|
}
|
|
52421
52440
|
function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) {
|
|
52422
52441
|
if (!suppressNewPrivateContext) {
|
|
@@ -52657,7 +52676,7 @@ ${lanes.join("\n")}
|
|
|
52657
52676
|
newModifierFlags |= 1024 /* Default */;
|
|
52658
52677
|
}
|
|
52659
52678
|
if (newModifierFlags) {
|
|
52660
|
-
node = factory.
|
|
52679
|
+
node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
|
|
52661
52680
|
}
|
|
52662
52681
|
}
|
|
52663
52682
|
results.push(node);
|
|
@@ -65211,6 +65230,9 @@ ${lanes.join("\n")}
|
|
|
65211
65230
|
}
|
|
65212
65231
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
65213
65232
|
if (depth >= maxDepth) {
|
|
65233
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
65234
|
+
type = getMappedTargetWithSymbol(type);
|
|
65235
|
+
}
|
|
65214
65236
|
if (type.flags & 2097152 /* Intersection */) {
|
|
65215
65237
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
65216
65238
|
}
|
|
@@ -65219,7 +65241,7 @@ ${lanes.join("\n")}
|
|
|
65219
65241
|
let lastTypeId = 0;
|
|
65220
65242
|
for (let i = 0; i < depth; i++) {
|
|
65221
65243
|
const t = stack[i];
|
|
65222
|
-
if (
|
|
65244
|
+
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
65223
65245
|
if (t.id >= lastTypeId) {
|
|
65224
65246
|
count++;
|
|
65225
65247
|
if (count >= maxDepth) {
|
|
@@ -65232,18 +65254,29 @@ ${lanes.join("\n")}
|
|
|
65232
65254
|
}
|
|
65233
65255
|
return false;
|
|
65234
65256
|
}
|
|
65257
|
+
function getMappedTargetWithSymbol(type) {
|
|
65258
|
+
let target;
|
|
65259
|
+
while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
|
|
65260
|
+
type = target;
|
|
65261
|
+
}
|
|
65262
|
+
return type;
|
|
65263
|
+
}
|
|
65264
|
+
function hasMatchingRecursionIdentity(type, identity2) {
|
|
65265
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
65266
|
+
type = getMappedTargetWithSymbol(type);
|
|
65267
|
+
}
|
|
65268
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
65269
|
+
return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
|
|
65270
|
+
}
|
|
65271
|
+
return getRecursionIdentity(type) === identity2;
|
|
65272
|
+
}
|
|
65235
65273
|
function getRecursionIdentity(type) {
|
|
65236
65274
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
65237
65275
|
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
65238
65276
|
return type.node;
|
|
65239
65277
|
}
|
|
65240
|
-
if (type.symbol) {
|
|
65241
|
-
|
|
65242
|
-
type = getMappedTargetWithSymbol(type);
|
|
65243
|
-
}
|
|
65244
|
-
if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
65245
|
-
return type.symbol;
|
|
65246
|
-
}
|
|
65278
|
+
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
65279
|
+
return type.symbol;
|
|
65247
65280
|
}
|
|
65248
65281
|
if (isTupleType(type)) {
|
|
65249
65282
|
return type.target;
|
|
@@ -65263,13 +65296,6 @@ ${lanes.join("\n")}
|
|
|
65263
65296
|
}
|
|
65264
65297
|
return type;
|
|
65265
65298
|
}
|
|
65266
|
-
function getMappedTargetWithSymbol(type) {
|
|
65267
|
-
let target = type;
|
|
65268
|
-
while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
|
|
65269
|
-
target = getModifiersTypeFromMappedType(target);
|
|
65270
|
-
}
|
|
65271
|
-
return target.symbol ? target : type;
|
|
65272
|
-
}
|
|
65273
65299
|
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
|
65274
65300
|
return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
|
65275
65301
|
}
|
|
@@ -100906,7 +100932,7 @@ ${lanes.join("\n")}
|
|
|
100906
100932
|
hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 /* SubtreeFactsMask */ | ancestorFacts;
|
|
100907
100933
|
}
|
|
100908
100934
|
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
|
|
100909
|
-
return (hierarchyFacts & 8192 /*
|
|
100935
|
+
return (hierarchyFacts & 8192 /* ConstructorWithSuperCall */) !== 0 && node.kind === 253 /* ReturnStatement */ && !node.expression;
|
|
100910
100936
|
}
|
|
100911
100937
|
function isOrMayContainReturnCompletion(node) {
|
|
100912
100938
|
return node.transformFlags & 4194304 /* ContainsHoistedDeclarationOrCompletion */ && (isReturnStatement(node) || isIfStatement(node) || isWithStatement(node) || isSwitchStatement(node) || isCaseBlock(node) || isCaseClause(node) || isDefaultClause(node) || isTryStatement(node) || isCatchClause(node) || isLabeledStatement(node) || isIterationStatement(
|
|
@@ -100916,7 +100942,7 @@ ${lanes.join("\n")}
|
|
|
100916
100942
|
) || isBlock(node));
|
|
100917
100943
|
}
|
|
100918
100944
|
function shouldVisitNode(node) {
|
|
100919
|
-
return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /*
|
|
100945
|
+
return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /* ConstructorWithSuperCall */ && isOrMayContainReturnCompletion(node) || isIterationStatement(
|
|
100920
100946
|
node,
|
|
100921
100947
|
/*lookInLabeledStatements*/
|
|
100922
100948
|
false
|
|
@@ -100949,7 +100975,7 @@ ${lanes.join("\n")}
|
|
|
100949
100975
|
/*expressionResultIsUnused*/
|
|
100950
100976
|
false
|
|
100951
100977
|
);
|
|
100952
|
-
exitSubtree(ancestorFacts,
|
|
100978
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
100953
100979
|
return result;
|
|
100954
100980
|
}
|
|
100955
100981
|
return visitorWorker(
|
|
@@ -100963,6 +100989,7 @@ ${lanes.join("\n")}
|
|
|
100963
100989
|
function callExpressionVisitor(node) {
|
|
100964
100990
|
if (node.kind === 108 /* SuperKeyword */) {
|
|
100965
100991
|
return visitSuperKeyword(
|
|
100992
|
+
node,
|
|
100966
100993
|
/*isExpressionOfCall*/
|
|
100967
100994
|
true
|
|
100968
100995
|
);
|
|
@@ -101072,6 +101099,7 @@ ${lanes.join("\n")}
|
|
|
101072
101099
|
return visitSpreadElement(node);
|
|
101073
101100
|
case 108 /* SuperKeyword */:
|
|
101074
101101
|
return visitSuperKeyword(
|
|
101102
|
+
node,
|
|
101075
101103
|
/*isExpressionOfCall*/
|
|
101076
101104
|
false
|
|
101077
101105
|
);
|
|
@@ -101141,7 +101169,10 @@ ${lanes.join("\n")}
|
|
|
101141
101169
|
return updated;
|
|
101142
101170
|
}
|
|
101143
101171
|
function returnCapturedThis(node) {
|
|
101144
|
-
return setOriginalNode(factory2.createReturnStatement(
|
|
101172
|
+
return setOriginalNode(factory2.createReturnStatement(createCapturedThis()), node);
|
|
101173
|
+
}
|
|
101174
|
+
function createCapturedThis() {
|
|
101175
|
+
return factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
101145
101176
|
}
|
|
101146
101177
|
function visitReturnStatement(node) {
|
|
101147
101178
|
if (convertedLoopState) {
|
|
@@ -101165,8 +101196,9 @@ ${lanes.join("\n")}
|
|
|
101165
101196
|
return visitEachChild(node, visitor, context);
|
|
101166
101197
|
}
|
|
101167
101198
|
function visitThisKeyword(node) {
|
|
101199
|
+
hierarchyFacts |= 65536 /* LexicalThis */;
|
|
101168
101200
|
if (hierarchyFacts & 2 /* ArrowFunction */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
|
|
101169
|
-
hierarchyFacts |=
|
|
101201
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
101170
101202
|
}
|
|
101171
101203
|
if (convertedLoopState) {
|
|
101172
101204
|
if (hierarchyFacts & 2 /* ArrowFunction */) {
|
|
@@ -101305,7 +101337,7 @@ ${lanes.join("\n")}
|
|
|
101305
101337
|
void 0,
|
|
101306
101338
|
/*dotDotDotToken*/
|
|
101307
101339
|
void 0,
|
|
101308
|
-
|
|
101340
|
+
createSyntheticSuper()
|
|
101309
101341
|
)] : [],
|
|
101310
101342
|
/*type*/
|
|
101311
101343
|
void 0,
|
|
@@ -101395,7 +101427,7 @@ ${lanes.join("\n")}
|
|
|
101395
101427
|
setEmitFlags(constructorFunction, 16 /* CapturesThis */);
|
|
101396
101428
|
}
|
|
101397
101429
|
statements.push(constructorFunction);
|
|
101398
|
-
exitSubtree(ancestorFacts,
|
|
101430
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
101399
101431
|
convertedLoopState = savedConvertedLoopState;
|
|
101400
101432
|
}
|
|
101401
101433
|
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
|
|
@@ -101419,103 +101451,35 @@ ${lanes.join("\n")}
|
|
|
101419
101451
|
setEmitFlags(block, 3072 /* NoComments */);
|
|
101420
101452
|
return block;
|
|
101421
101453
|
}
|
|
101422
|
-
function transformConstructorBodyWorker(prologueOut, statementsOut, statementsIn, statementOffset, superPath, superPathDepth, constructor, isDerivedClass, hasSynthesizedSuper, isFirstStatement) {
|
|
101423
|
-
let mayReplaceThis = false;
|
|
101424
|
-
const superStatementIndex = superPathDepth < superPath.length ? superPath[superPathDepth] : -1;
|
|
101425
|
-
const leadingStatementsEnd = superStatementIndex >= 0 ? superStatementIndex : statementsIn.length;
|
|
101426
|
-
if (isFirstStatement && superStatementIndex >= 0) {
|
|
101427
|
-
let firstMaterialIndex = statementOffset;
|
|
101428
|
-
while (isFirstStatement && firstMaterialIndex < superStatementIndex) {
|
|
101429
|
-
const statement = constructor.body.statements[firstMaterialIndex];
|
|
101430
|
-
if (!isUninitializedVariableStatement(statement) && !isUsingDeclarationStateVariableStatement(statement))
|
|
101431
|
-
break;
|
|
101432
|
-
firstMaterialIndex++;
|
|
101433
|
-
}
|
|
101434
|
-
isFirstStatement = superStatementIndex === firstMaterialIndex;
|
|
101435
|
-
}
|
|
101436
|
-
addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, leadingStatementsEnd - statementOffset));
|
|
101437
|
-
const superStatement = superStatementIndex >= 0 ? statementsIn[superStatementIndex] : void 0;
|
|
101438
|
-
if (superStatement && isTryStatement(superStatement)) {
|
|
101439
|
-
const tryBlockStatements = [];
|
|
101440
|
-
mayReplaceThis = transformConstructorBodyWorker(
|
|
101441
|
-
prologueOut,
|
|
101442
|
-
tryBlockStatements,
|
|
101443
|
-
superStatement.tryBlock.statements,
|
|
101444
|
-
/*statementOffset*/
|
|
101445
|
-
0,
|
|
101446
|
-
superPath,
|
|
101447
|
-
superPathDepth + 1,
|
|
101448
|
-
constructor,
|
|
101449
|
-
isDerivedClass,
|
|
101450
|
-
hasSynthesizedSuper,
|
|
101451
|
-
isFirstStatement
|
|
101452
|
-
);
|
|
101453
|
-
const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements);
|
|
101454
|
-
setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements);
|
|
101455
|
-
statementsOut.push(factory2.updateTryStatement(
|
|
101456
|
-
superStatement,
|
|
101457
|
-
factory2.updateBlock(superStatement.tryBlock, tryBlockStatements),
|
|
101458
|
-
visitNode(superStatement.catchClause, visitor, isCatchClause),
|
|
101459
|
-
visitNode(superStatement.finallyBlock, visitor, isBlock)
|
|
101460
|
-
));
|
|
101461
|
-
} else {
|
|
101462
|
-
const superCall = superStatement && getSuperCallFromStatement(superStatement);
|
|
101463
|
-
let superCallExpression;
|
|
101464
|
-
if (hasSynthesizedSuper) {
|
|
101465
|
-
superCallExpression = createDefaultSuperCallOrThis();
|
|
101466
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
101467
|
-
} else if (superCall) {
|
|
101468
|
-
superCallExpression = visitSuperCallInBody(superCall);
|
|
101469
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
101470
|
-
}
|
|
101471
|
-
if (isDerivedClass || superCallExpression) {
|
|
101472
|
-
if (superCallExpression && superStatementIndex === statementsIn.length - 1 && !(constructor.body.transformFlags & 16384 /* ContainsLexicalThis */)) {
|
|
101473
|
-
const superCall2 = cast(cast(superCallExpression, isBinaryExpression).left, isCallExpression);
|
|
101474
|
-
const returnStatement = factory2.createReturnStatement(superCallExpression);
|
|
101475
|
-
setCommentRange(returnStatement, getCommentRange(superCall2));
|
|
101476
|
-
setEmitFlags(superCall2, 3072 /* NoComments */);
|
|
101477
|
-
statementsOut.push(returnStatement);
|
|
101478
|
-
return false;
|
|
101479
|
-
} else {
|
|
101480
|
-
if (isFirstStatement) {
|
|
101481
|
-
insertCaptureThisForNode(statementsOut, constructor, superCallExpression || createActualThis());
|
|
101482
|
-
} else {
|
|
101483
|
-
insertCaptureThisForNode(prologueOut, constructor, createActualThis());
|
|
101484
|
-
if (superCallExpression) {
|
|
101485
|
-
addSuperThisCaptureThisForNode(statementsOut, superCallExpression);
|
|
101486
|
-
}
|
|
101487
|
-
}
|
|
101488
|
-
mayReplaceThis = true;
|
|
101489
|
-
}
|
|
101490
|
-
} else {
|
|
101491
|
-
insertCaptureThisForNodeIfNeeded(prologueOut, constructor);
|
|
101492
|
-
}
|
|
101493
|
-
}
|
|
101494
|
-
if (superStatementIndex >= 0) {
|
|
101495
|
-
addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1));
|
|
101496
|
-
}
|
|
101497
|
-
return mayReplaceThis;
|
|
101498
|
-
}
|
|
101499
101454
|
function isUninitializedVariableStatement(node) {
|
|
101500
101455
|
return isVariableStatement(node) && every(node.declarationList.declarations, (decl) => isIdentifier(decl.name) && !decl.initializer);
|
|
101501
101456
|
}
|
|
101502
|
-
function
|
|
101503
|
-
if (
|
|
101504
|
-
return
|
|
101505
|
-
|
|
101506
|
-
if (!
|
|
101507
|
-
return false;
|
|
101508
|
-
const initializer = varDecl.initializer;
|
|
101509
|
-
if (!isObjectLiteralExpression(initializer) || initializer.properties.length !== 3)
|
|
101510
|
-
return false;
|
|
101511
|
-
const [stackProp, errorProp, hasErrorProp] = initializer.properties;
|
|
101512
|
-
if (!isPropertyAssignment(stackProp) || !isIdentifier(stackProp.name) || idText(stackProp.name) !== "stack" || !isArrayLiteralExpression(stackProp.initializer))
|
|
101513
|
-
return false;
|
|
101514
|
-
if (!isPropertyAssignment(errorProp) || !isIdentifier(errorProp.name) || idText(errorProp.name) !== "error" || !isVoidExpression(errorProp.initializer) || !isNumericLiteral(errorProp.initializer.expression))
|
|
101515
|
-
return false;
|
|
101516
|
-
if (!isPropertyAssignment(hasErrorProp) || !isIdentifier(hasErrorProp.name) || idText(hasErrorProp.name) !== "hasError" || hasErrorProp.initializer.kind !== 97 /* FalseKeyword */)
|
|
101457
|
+
function containsSuperCall(node) {
|
|
101458
|
+
if (isSuperCall(node)) {
|
|
101459
|
+
return true;
|
|
101460
|
+
}
|
|
101461
|
+
if (!(node.transformFlags & 134217728 /* ContainsLexicalSuper */)) {
|
|
101517
101462
|
return false;
|
|
101518
|
-
|
|
101463
|
+
}
|
|
101464
|
+
switch (node.kind) {
|
|
101465
|
+
case 219 /* ArrowFunction */:
|
|
101466
|
+
case 218 /* FunctionExpression */:
|
|
101467
|
+
case 262 /* FunctionDeclaration */:
|
|
101468
|
+
case 176 /* Constructor */:
|
|
101469
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
101470
|
+
return false;
|
|
101471
|
+
case 177 /* GetAccessor */:
|
|
101472
|
+
case 178 /* SetAccessor */:
|
|
101473
|
+
case 174 /* MethodDeclaration */:
|
|
101474
|
+
case 172 /* PropertyDeclaration */: {
|
|
101475
|
+
const named = node;
|
|
101476
|
+
if (isComputedPropertyName(named.name)) {
|
|
101477
|
+
return !!forEachChild(named.name, containsSuperCall);
|
|
101478
|
+
}
|
|
101479
|
+
return false;
|
|
101480
|
+
}
|
|
101481
|
+
}
|
|
101482
|
+
return !!forEachChild(node, containsSuperCall);
|
|
101519
101483
|
}
|
|
101520
101484
|
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
|
|
101521
101485
|
const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */;
|
|
@@ -101530,31 +101494,22 @@ ${lanes.join("\n")}
|
|
|
101530
101494
|
/*statementOffset*/
|
|
101531
101495
|
0
|
|
101532
101496
|
);
|
|
101533
|
-
|
|
101534
|
-
|
|
101535
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
101497
|
+
if (hasSynthesizedSuper || containsSuperCall(constructor.body)) {
|
|
101498
|
+
hierarchyFacts |= 8192 /* ConstructorWithSuperCall */;
|
|
101536
101499
|
}
|
|
101537
|
-
|
|
101538
|
-
|
|
101539
|
-
statements,
|
|
101540
|
-
constructor.body.statements,
|
|
101541
|
-
standardPrologueEnd,
|
|
101542
|
-
superStatementIndices,
|
|
101543
|
-
/*superPathDepth*/
|
|
101544
|
-
0,
|
|
101545
|
-
constructor,
|
|
101546
|
-
isDerivedClass,
|
|
101547
|
-
hasSynthesizedSuper,
|
|
101548
|
-
/*isFirstStatement*/
|
|
101549
|
-
true
|
|
101550
|
-
// NOTE: this will be recalculated inside of transformConstructorBodyWorker
|
|
101551
|
-
);
|
|
101500
|
+
addRange(statements, visitNodes2(constructor.body.statements, visitor, isStatement, standardPrologueEnd));
|
|
101501
|
+
const mayReplaceThis = isDerivedClass || hierarchyFacts & 8192 /* ConstructorWithSuperCall */;
|
|
101552
101502
|
addDefaultValueAssignmentsIfNeeded2(prologue, constructor);
|
|
101553
101503
|
addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
|
|
101554
101504
|
insertCaptureNewTargetIfNeeded(prologue, constructor);
|
|
101505
|
+
if (mayReplaceThis) {
|
|
101506
|
+
insertCaptureThisForNode(prologue, constructor, createActualThis());
|
|
101507
|
+
} else {
|
|
101508
|
+
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
101509
|
+
}
|
|
101555
101510
|
factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
|
|
101556
101511
|
if (mayReplaceThis && !isSufficientlyCoveredByReturnStatements(constructor.body)) {
|
|
101557
|
-
statements.push(factory2.createReturnStatement(
|
|
101512
|
+
statements.push(factory2.createReturnStatement(createCapturedThis()));
|
|
101558
101513
|
}
|
|
101559
101514
|
const body = factory2.createBlock(
|
|
101560
101515
|
setTextRange(
|
|
@@ -101571,6 +101526,230 @@ ${lanes.join("\n")}
|
|
|
101571
101526
|
true
|
|
101572
101527
|
);
|
|
101573
101528
|
setTextRange(body, constructor.body);
|
|
101529
|
+
return simplifyConstructor(body, constructor.body, hasSynthesizedSuper);
|
|
101530
|
+
}
|
|
101531
|
+
function isCapturedThis(node) {
|
|
101532
|
+
return isGeneratedIdentifier(node) && idText(node) === "_this";
|
|
101533
|
+
}
|
|
101534
|
+
function isSyntheticSuper(node) {
|
|
101535
|
+
return isGeneratedIdentifier(node) && idText(node) === "_super";
|
|
101536
|
+
}
|
|
101537
|
+
function isThisCapturingVariableStatement(node) {
|
|
101538
|
+
return isVariableStatement(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]);
|
|
101539
|
+
}
|
|
101540
|
+
function isThisCapturingVariableDeclaration(node) {
|
|
101541
|
+
return isVariableDeclaration(node) && isCapturedThis(node.name) && !!node.initializer;
|
|
101542
|
+
}
|
|
101543
|
+
function isThisCapturingAssignment(node) {
|
|
101544
|
+
return isAssignmentExpression(
|
|
101545
|
+
node,
|
|
101546
|
+
/*excludeCompoundAssignment*/
|
|
101547
|
+
true
|
|
101548
|
+
) && isCapturedThis(node.left);
|
|
101549
|
+
}
|
|
101550
|
+
function isTransformedSuperCall(node) {
|
|
101551
|
+
return isCallExpression(node) && isPropertyAccessExpression(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier(node.expression.name) && (idText(node.expression.name) === "call" || idText(node.expression.name) === "apply") && node.arguments.length >= 1 && node.arguments[0].kind === 110 /* ThisKeyword */;
|
|
101552
|
+
}
|
|
101553
|
+
function isTransformedSuperCallWithFallback(node) {
|
|
101554
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isTransformedSuperCall(node.left);
|
|
101555
|
+
}
|
|
101556
|
+
function isImplicitSuperCall(node) {
|
|
101557
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && isBinaryExpression(node.left) && node.left.operatorToken.kind === 38 /* ExclamationEqualsEqualsToken */ && isSyntheticSuper(node.left.left) && node.left.right.kind === 106 /* NullKeyword */ && isTransformedSuperCall(node.right) && idText(node.right.expression.name) === "apply";
|
|
101558
|
+
}
|
|
101559
|
+
function isImplicitSuperCallWithFallback(node) {
|
|
101560
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isImplicitSuperCall(node.left);
|
|
101561
|
+
}
|
|
101562
|
+
function isThisCapturingTransformedSuperCallWithFallback(node) {
|
|
101563
|
+
return isThisCapturingAssignment(node) && isTransformedSuperCallWithFallback(node.right);
|
|
101564
|
+
}
|
|
101565
|
+
function isThisCapturingImplicitSuperCallWithFallback(node) {
|
|
101566
|
+
return isThisCapturingAssignment(node) && isImplicitSuperCallWithFallback(node.right);
|
|
101567
|
+
}
|
|
101568
|
+
function isTransformedSuperCallLike(node) {
|
|
101569
|
+
return isTransformedSuperCall(node) || isTransformedSuperCallWithFallback(node) || isThisCapturingTransformedSuperCallWithFallback(node) || isImplicitSuperCall(node) || isImplicitSuperCallWithFallback(node) || isThisCapturingImplicitSuperCallWithFallback(node);
|
|
101570
|
+
}
|
|
101571
|
+
function simplifyConstructorInlineSuperInThisCaptureVariable(body) {
|
|
101572
|
+
for (let i = 0; i < body.statements.length - 1; i++) {
|
|
101573
|
+
const statement = body.statements[i];
|
|
101574
|
+
if (!isThisCapturingVariableStatement(statement)) {
|
|
101575
|
+
continue;
|
|
101576
|
+
}
|
|
101577
|
+
const varDecl = statement.declarationList.declarations[0];
|
|
101578
|
+
if (varDecl.initializer.kind !== 110 /* ThisKeyword */) {
|
|
101579
|
+
continue;
|
|
101580
|
+
}
|
|
101581
|
+
const thisCaptureStatementIndex = i;
|
|
101582
|
+
let superCallIndex = i + 1;
|
|
101583
|
+
while (superCallIndex < body.statements.length) {
|
|
101584
|
+
const statement2 = body.statements[superCallIndex];
|
|
101585
|
+
if (isExpressionStatement(statement2)) {
|
|
101586
|
+
if (isTransformedSuperCallLike(skipOuterExpressions(statement2.expression))) {
|
|
101587
|
+
break;
|
|
101588
|
+
}
|
|
101589
|
+
}
|
|
101590
|
+
if (isUninitializedVariableStatement(statement2)) {
|
|
101591
|
+
superCallIndex++;
|
|
101592
|
+
continue;
|
|
101593
|
+
}
|
|
101594
|
+
return body;
|
|
101595
|
+
}
|
|
101596
|
+
const following = body.statements[superCallIndex];
|
|
101597
|
+
let expression = following.expression;
|
|
101598
|
+
if (isThisCapturingAssignment(expression)) {
|
|
101599
|
+
expression = expression.right;
|
|
101600
|
+
}
|
|
101601
|
+
const newVarDecl = factory2.updateVariableDeclaration(
|
|
101602
|
+
varDecl,
|
|
101603
|
+
varDecl.name,
|
|
101604
|
+
/*exclamationToken*/
|
|
101605
|
+
void 0,
|
|
101606
|
+
/*type*/
|
|
101607
|
+
void 0,
|
|
101608
|
+
expression
|
|
101609
|
+
);
|
|
101610
|
+
const newDeclList = factory2.updateVariableDeclarationList(statement.declarationList, [newVarDecl]);
|
|
101611
|
+
const newVarStatement = factory2.createVariableStatement(statement.modifiers, newDeclList);
|
|
101612
|
+
setOriginalNode(newVarStatement, following);
|
|
101613
|
+
setTextRange(newVarStatement, following);
|
|
101614
|
+
const newStatements = factory2.createNodeArray([
|
|
101615
|
+
...body.statements.slice(0, thisCaptureStatementIndex),
|
|
101616
|
+
// copy statements preceding to `var _this`
|
|
101617
|
+
...body.statements.slice(thisCaptureStatementIndex + 1, superCallIndex),
|
|
101618
|
+
// copy intervening temp variables
|
|
101619
|
+
newVarStatement,
|
|
101620
|
+
...body.statements.slice(superCallIndex + 1)
|
|
101621
|
+
// copy statements following `super.call(this, ...)`
|
|
101622
|
+
]);
|
|
101623
|
+
setTextRange(newStatements, body.statements);
|
|
101624
|
+
return factory2.updateBlock(body, newStatements);
|
|
101625
|
+
}
|
|
101626
|
+
return body;
|
|
101627
|
+
}
|
|
101628
|
+
function simplifyConstructorInlineSuperReturn(body, original) {
|
|
101629
|
+
for (const statement of original.statements) {
|
|
101630
|
+
if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
|
|
101631
|
+
return body;
|
|
101632
|
+
}
|
|
101633
|
+
}
|
|
101634
|
+
const canElideThisCapturingVariable = !(original.transformFlags & 16384 /* ContainsLexicalThis */) && !(hierarchyFacts & 65536 /* LexicalThis */) && !(hierarchyFacts & 131072 /* CapturedLexicalThis */);
|
|
101635
|
+
for (let i = body.statements.length - 1; i > 0; i--) {
|
|
101636
|
+
const statement = body.statements[i];
|
|
101637
|
+
if (isReturnStatement(statement) && statement.expression && isCapturedThis(statement.expression)) {
|
|
101638
|
+
const preceding = body.statements[i - 1];
|
|
101639
|
+
let expression;
|
|
101640
|
+
if (isExpressionStatement(preceding) && isThisCapturingTransformedSuperCallWithFallback(skipOuterExpressions(preceding.expression))) {
|
|
101641
|
+
expression = preceding.expression;
|
|
101642
|
+
} else if (canElideThisCapturingVariable && isThisCapturingVariableStatement(preceding)) {
|
|
101643
|
+
const varDecl = preceding.declarationList.declarations[0];
|
|
101644
|
+
if (isTransformedSuperCallLike(skipOuterExpressions(varDecl.initializer))) {
|
|
101645
|
+
expression = factory2.createAssignment(
|
|
101646
|
+
createCapturedThis(),
|
|
101647
|
+
varDecl.initializer
|
|
101648
|
+
);
|
|
101649
|
+
}
|
|
101650
|
+
}
|
|
101651
|
+
if (!expression) {
|
|
101652
|
+
break;
|
|
101653
|
+
}
|
|
101654
|
+
const newReturnStatement = factory2.createReturnStatement(expression);
|
|
101655
|
+
setOriginalNode(newReturnStatement, preceding);
|
|
101656
|
+
setTextRange(newReturnStatement, preceding);
|
|
101657
|
+
const newStatements = factory2.createNodeArray([
|
|
101658
|
+
...body.statements.slice(0, i - 1),
|
|
101659
|
+
// copy all statements preceding `_super.call(this, ...)`
|
|
101660
|
+
newReturnStatement,
|
|
101661
|
+
...body.statements.slice(i + 1)
|
|
101662
|
+
// copy all statements following `return _this;`
|
|
101663
|
+
]);
|
|
101664
|
+
setTextRange(newStatements, body.statements);
|
|
101665
|
+
return factory2.updateBlock(body, newStatements);
|
|
101666
|
+
}
|
|
101667
|
+
}
|
|
101668
|
+
return body;
|
|
101669
|
+
}
|
|
101670
|
+
function elideUnusedThisCaptureWorker(node) {
|
|
101671
|
+
if (isThisCapturingVariableStatement(node)) {
|
|
101672
|
+
const varDecl = node.declarationList.declarations[0];
|
|
101673
|
+
if (varDecl.initializer.kind === 110 /* ThisKeyword */) {
|
|
101674
|
+
return void 0;
|
|
101675
|
+
}
|
|
101676
|
+
} else if (isThisCapturingAssignment(node)) {
|
|
101677
|
+
return factory2.createPartiallyEmittedExpression(node.right, node);
|
|
101678
|
+
}
|
|
101679
|
+
switch (node.kind) {
|
|
101680
|
+
case 219 /* ArrowFunction */:
|
|
101681
|
+
case 218 /* FunctionExpression */:
|
|
101682
|
+
case 262 /* FunctionDeclaration */:
|
|
101683
|
+
case 176 /* Constructor */:
|
|
101684
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
101685
|
+
return node;
|
|
101686
|
+
case 177 /* GetAccessor */:
|
|
101687
|
+
case 178 /* SetAccessor */:
|
|
101688
|
+
case 174 /* MethodDeclaration */:
|
|
101689
|
+
case 172 /* PropertyDeclaration */: {
|
|
101690
|
+
const named = node;
|
|
101691
|
+
if (isComputedPropertyName(named.name)) {
|
|
101692
|
+
return factory2.replacePropertyName(named, visitEachChild(named.name, elideUnusedThisCaptureWorker, nullTransformationContext));
|
|
101693
|
+
}
|
|
101694
|
+
return node;
|
|
101695
|
+
}
|
|
101696
|
+
}
|
|
101697
|
+
return visitEachChild(node, elideUnusedThisCaptureWorker, nullTransformationContext);
|
|
101698
|
+
}
|
|
101699
|
+
function simplifyConstructorElideUnusedThisCapture(body, original) {
|
|
101700
|
+
if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
|
|
101701
|
+
return body;
|
|
101702
|
+
}
|
|
101703
|
+
for (const statement of original.statements) {
|
|
101704
|
+
if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
|
|
101705
|
+
return body;
|
|
101706
|
+
}
|
|
101707
|
+
}
|
|
101708
|
+
return factory2.updateBlock(body, visitNodes2(body.statements, elideUnusedThisCaptureWorker, isStatement));
|
|
101709
|
+
}
|
|
101710
|
+
function injectSuperPresenceCheckWorker(node) {
|
|
101711
|
+
if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier(node.arguments[1]) && idText(node.arguments[1]) === "arguments") {
|
|
101712
|
+
return factory2.createLogicalAnd(
|
|
101713
|
+
factory2.createStrictInequality(
|
|
101714
|
+
createSyntheticSuper(),
|
|
101715
|
+
factory2.createNull()
|
|
101716
|
+
),
|
|
101717
|
+
node
|
|
101718
|
+
);
|
|
101719
|
+
}
|
|
101720
|
+
switch (node.kind) {
|
|
101721
|
+
case 219 /* ArrowFunction */:
|
|
101722
|
+
case 218 /* FunctionExpression */:
|
|
101723
|
+
case 262 /* FunctionDeclaration */:
|
|
101724
|
+
case 176 /* Constructor */:
|
|
101725
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
101726
|
+
return node;
|
|
101727
|
+
case 177 /* GetAccessor */:
|
|
101728
|
+
case 178 /* SetAccessor */:
|
|
101729
|
+
case 174 /* MethodDeclaration */:
|
|
101730
|
+
case 172 /* PropertyDeclaration */: {
|
|
101731
|
+
const named = node;
|
|
101732
|
+
if (isComputedPropertyName(named.name)) {
|
|
101733
|
+
return factory2.replacePropertyName(named, visitEachChild(named.name, injectSuperPresenceCheckWorker, nullTransformationContext));
|
|
101734
|
+
}
|
|
101735
|
+
return node;
|
|
101736
|
+
}
|
|
101737
|
+
}
|
|
101738
|
+
return visitEachChild(node, injectSuperPresenceCheckWorker, nullTransformationContext);
|
|
101739
|
+
}
|
|
101740
|
+
function complicateConstructorInjectSuperPresenceCheck(body) {
|
|
101741
|
+
return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
|
|
101742
|
+
}
|
|
101743
|
+
function simplifyConstructor(body, original, hasSynthesizedSuper) {
|
|
101744
|
+
const inputBody = body;
|
|
101745
|
+
body = simplifyConstructorInlineSuperInThisCaptureVariable(body);
|
|
101746
|
+
body = simplifyConstructorInlineSuperReturn(body, original);
|
|
101747
|
+
if (body !== inputBody) {
|
|
101748
|
+
body = simplifyConstructorElideUnusedThisCapture(body, original);
|
|
101749
|
+
}
|
|
101750
|
+
if (hasSynthesizedSuper) {
|
|
101751
|
+
body = complicateConstructorInjectSuperPresenceCheck(body);
|
|
101752
|
+
}
|
|
101574
101753
|
return body;
|
|
101575
101754
|
}
|
|
101576
101755
|
function isSufficientlyCoveredByReturnStatements(statement) {
|
|
@@ -101596,11 +101775,11 @@ ${lanes.join("\n")}
|
|
|
101596
101775
|
return factory2.createLogicalOr(
|
|
101597
101776
|
factory2.createLogicalAnd(
|
|
101598
101777
|
factory2.createStrictInequality(
|
|
101599
|
-
|
|
101778
|
+
createSyntheticSuper(),
|
|
101600
101779
|
factory2.createNull()
|
|
101601
101780
|
),
|
|
101602
101781
|
factory2.createFunctionApplyCall(
|
|
101603
|
-
|
|
101782
|
+
createSyntheticSuper(),
|
|
101604
101783
|
createActualThis(),
|
|
101605
101784
|
factory2.createIdentifier("arguments")
|
|
101606
101785
|
)
|
|
@@ -101855,24 +102034,12 @@ ${lanes.join("\n")}
|
|
|
101855
102034
|
return true;
|
|
101856
102035
|
}
|
|
101857
102036
|
function insertCaptureThisForNodeIfNeeded(statements, node) {
|
|
101858
|
-
if (hierarchyFacts &
|
|
102037
|
+
if (hierarchyFacts & 131072 /* CapturedLexicalThis */ && node.kind !== 219 /* ArrowFunction */) {
|
|
101859
102038
|
insertCaptureThisForNode(statements, node, factory2.createThis());
|
|
101860
102039
|
return true;
|
|
101861
102040
|
}
|
|
101862
102041
|
return false;
|
|
101863
102042
|
}
|
|
101864
|
-
function addSuperThisCaptureThisForNode(statements, superExpression) {
|
|
101865
|
-
enableSubstitutionsForCapturedThis();
|
|
101866
|
-
const assignSuperExpression = factory2.createExpressionStatement(
|
|
101867
|
-
factory2.createBinaryExpression(
|
|
101868
|
-
factory2.createThis(),
|
|
101869
|
-
64 /* EqualsToken */,
|
|
101870
|
-
superExpression
|
|
101871
|
-
)
|
|
101872
|
-
);
|
|
101873
|
-
statements.push(assignSuperExpression);
|
|
101874
|
-
setCommentRange(assignSuperExpression, getOriginalNode(superExpression).parent);
|
|
101875
|
-
}
|
|
101876
102043
|
function insertCaptureThisForNode(statements, node, initializer) {
|
|
101877
102044
|
enableSubstitutionsForCapturedThis();
|
|
101878
102045
|
const captureThisStatement = factory2.createVariableStatement(
|
|
@@ -101880,7 +102047,7 @@ ${lanes.join("\n")}
|
|
|
101880
102047
|
void 0,
|
|
101881
102048
|
factory2.createVariableDeclarationList([
|
|
101882
102049
|
factory2.createVariableDeclaration(
|
|
101883
|
-
|
|
102050
|
+
createCapturedThis(),
|
|
101884
102051
|
/*exclamationToken*/
|
|
101885
102052
|
void 0,
|
|
101886
102053
|
/*type*/
|
|
@@ -102101,7 +102268,7 @@ ${lanes.join("\n")}
|
|
|
102101
102268
|
}
|
|
102102
102269
|
function visitArrowFunction(node) {
|
|
102103
102270
|
if (node.transformFlags & 16384 /* ContainsLexicalThis */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
|
|
102104
|
-
hierarchyFacts |=
|
|
102271
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
102105
102272
|
}
|
|
102106
102273
|
const savedConvertedLoopState = convertedLoopState;
|
|
102107
102274
|
convertedLoopState = void 0;
|
|
@@ -102134,7 +102301,7 @@ ${lanes.join("\n")}
|
|
|
102134
102301
|
const parameters = visitParameterList(node.parameters, visitor, context);
|
|
102135
102302
|
const body = transformFunctionBody2(node);
|
|
102136
102303
|
const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
|
|
102137
|
-
exitSubtree(ancestorFacts,
|
|
102304
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
102138
102305
|
convertedLoopState = savedConvertedLoopState;
|
|
102139
102306
|
return factory2.updateFunctionExpression(
|
|
102140
102307
|
node,
|
|
@@ -102157,7 +102324,7 @@ ${lanes.join("\n")}
|
|
|
102157
102324
|
const parameters = visitParameterList(node.parameters, visitor, context);
|
|
102158
102325
|
const body = transformFunctionBody2(node);
|
|
102159
102326
|
const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
|
|
102160
|
-
exitSubtree(ancestorFacts,
|
|
102327
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
102161
102328
|
convertedLoopState = savedConvertedLoopState;
|
|
102162
102329
|
return factory2.updateFunctionDeclaration(
|
|
102163
102330
|
node,
|
|
@@ -102181,7 +102348,7 @@ ${lanes.join("\n")}
|
|
|
102181
102348
|
if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
102182
102349
|
name = factory2.getGeneratedNameForNode(node);
|
|
102183
102350
|
}
|
|
102184
|
-
exitSubtree(ancestorFacts,
|
|
102351
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
102185
102352
|
convertedLoopState = savedConvertedLoopState;
|
|
102186
102353
|
return setOriginalNode(
|
|
102187
102354
|
setTextRange(
|
|
@@ -103590,7 +103757,7 @@ ${lanes.join("\n")}
|
|
|
103590
103757
|
} else {
|
|
103591
103758
|
updated = factory2.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body);
|
|
103592
103759
|
}
|
|
103593
|
-
exitSubtree(ancestorFacts,
|
|
103760
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
103594
103761
|
convertedLoopState = savedConvertedLoopState;
|
|
103595
103762
|
return updated;
|
|
103596
103763
|
}
|
|
@@ -103740,13 +103907,6 @@ ${lanes.join("\n")}
|
|
|
103740
103907
|
)
|
|
103741
103908
|
);
|
|
103742
103909
|
}
|
|
103743
|
-
function visitSuperCallInBody(node) {
|
|
103744
|
-
return visitCallExpressionWithPotentialCapturedThisAssignment(
|
|
103745
|
-
node,
|
|
103746
|
-
/*assignToCapturedThis*/
|
|
103747
|
-
false
|
|
103748
|
-
);
|
|
103749
|
-
}
|
|
103750
103910
|
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
|
|
103751
103911
|
if (node.transformFlags & 32768 /* ContainsRestOrSpread */ || node.expression.kind === 108 /* SuperKeyword */ || isSuperProperty(skipOuterExpressions(node.expression))) {
|
|
103752
103912
|
const { target, thisArg } = factory2.createCallBinding(node.expression, hoistVariableDeclaration);
|
|
@@ -103783,10 +103943,13 @@ ${lanes.join("\n")}
|
|
|
103783
103943
|
resultingCall,
|
|
103784
103944
|
createActualThis()
|
|
103785
103945
|
);
|
|
103786
|
-
resultingCall = assignToCapturedThis ? factory2.createAssignment(
|
|
103946
|
+
resultingCall = assignToCapturedThis ? factory2.createAssignment(createCapturedThis(), initializer) : initializer;
|
|
103787
103947
|
}
|
|
103788
103948
|
return setOriginalNode(resultingCall, node);
|
|
103789
103949
|
}
|
|
103950
|
+
if (isSuperCall(node)) {
|
|
103951
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
103952
|
+
}
|
|
103790
103953
|
return visitEachChild(node, visitor, context);
|
|
103791
103954
|
}
|
|
103792
103955
|
function visitNewExpression(node) {
|
|
@@ -103913,8 +104076,15 @@ ${lanes.join("\n")}
|
|
|
103913
104076
|
}
|
|
103914
104077
|
return setTextRange(expression, node);
|
|
103915
104078
|
}
|
|
103916
|
-
function
|
|
103917
|
-
return
|
|
104079
|
+
function createSyntheticSuper() {
|
|
104080
|
+
return factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
104081
|
+
}
|
|
104082
|
+
function visitSuperKeyword(node, isExpressionOfCall) {
|
|
104083
|
+
const expression = hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall ? factory2.createPropertyAccessExpression(setOriginalNode(createSyntheticSuper(), node), "prototype") : createSyntheticSuper();
|
|
104084
|
+
setOriginalNode(expression, node);
|
|
104085
|
+
setCommentRange(expression, node);
|
|
104086
|
+
setSourceMapRange(expression, node);
|
|
104087
|
+
return expression;
|
|
103918
104088
|
}
|
|
103919
104089
|
function visitMetaProperty(node) {
|
|
103920
104090
|
if (node.keywordToken === 105 /* NewKeyword */ && node.name.escapedText === "target") {
|
|
@@ -104020,7 +104190,7 @@ ${lanes.join("\n")}
|
|
|
104020
104190
|
}
|
|
104021
104191
|
function substituteThisKeyword(node) {
|
|
104022
104192
|
if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) {
|
|
104023
|
-
return setTextRange(
|
|
104193
|
+
return setTextRange(createCapturedThis(), node);
|
|
104024
104194
|
}
|
|
104025
104195
|
return node;
|
|
104026
104196
|
}
|
|
@@ -111166,7 +111336,7 @@ ${lanes.join("\n")}
|
|
|
111166
111336
|
return statement;
|
|
111167
111337
|
}
|
|
111168
111338
|
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
|
|
111169
|
-
return factory2.
|
|
111339
|
+
return factory2.replaceModifiers(statement, modifiers);
|
|
111170
111340
|
}
|
|
111171
111341
|
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
111172
111342
|
const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
|
|
@@ -111297,7 +111467,7 @@ ${lanes.join("\n")}
|
|
|
111297
111467
|
return factory2.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory2.createToken(95 /* ExportKeyword */)], factory2.createVariableDeclarationList([varDecl]));
|
|
111298
111468
|
});
|
|
111299
111469
|
if (!exportMappings.length) {
|
|
111300
|
-
declarations = mapDefined(declarations, (declaration) => factory2.
|
|
111470
|
+
declarations = mapDefined(declarations, (declaration) => factory2.replaceModifiers(declaration, 0 /* None */));
|
|
111301
111471
|
} else {
|
|
111302
111472
|
declarations.push(factory2.createExportDeclaration(
|
|
111303
111473
|
/*modifiers*/
|
|
@@ -145503,7 +145673,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
145503
145673
|
}
|
|
145504
145674
|
}
|
|
145505
145675
|
fixedDeclarations == null ? void 0 : fixedDeclarations.add(getNodeId(insertionSite));
|
|
145506
|
-
const cloneWithModifier = factory.
|
|
145676
|
+
const cloneWithModifier = factory.replaceModifiers(
|
|
145507
145677
|
getSynthesizedDeepClone(
|
|
145508
145678
|
insertionSite,
|
|
145509
145679
|
/*includeTrivia*/
|
|
@@ -157086,7 +157256,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157086
157256
|
if (!completionNodes.length) {
|
|
157087
157257
|
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
157088
157258
|
}
|
|
157089
|
-
node = factory.
|
|
157259
|
+
node = factory.replaceModifiers(node, modifiers);
|
|
157090
157260
|
completionNodes.push(node);
|
|
157091
157261
|
},
|
|
157092
157262
|
body,
|
|
@@ -157112,11 +157282,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157112
157282
|
modifiers &= ~4 /* Public */;
|
|
157113
157283
|
}
|
|
157114
157284
|
modifiers |= allowedAndPresent;
|
|
157115
|
-
completionNodes = completionNodes.map((node) => factory.
|
|
157285
|
+
completionNodes = completionNodes.map((node) => factory.replaceModifiers(node, modifiers));
|
|
157116
157286
|
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
157117
157287
|
const lastNode = completionNodes[completionNodes.length - 1];
|
|
157118
157288
|
if (canHaveDecorators(lastNode)) {
|
|
157119
|
-
completionNodes[completionNodes.length - 1] = factory.
|
|
157289
|
+
completionNodes[completionNodes.length - 1] = factory.replaceDecoratorsAndModifiers(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
157120
157290
|
}
|
|
157121
157291
|
}
|
|
157122
157292
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|