@typescript-deploys/pr-build 5.4.0-pr-56859-8 → 5.4.0-pr-56908-56
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 +239 -97
- package/lib/tsserver.js +239 -92
- package/lib/typescript.js +239 -90
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240108`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -10860,17 +10860,6 @@ function isMethodOrAccessor(node) {
|
|
|
10860
10860
|
return false;
|
|
10861
10861
|
}
|
|
10862
10862
|
}
|
|
10863
|
-
function isNamedClassElement(node) {
|
|
10864
|
-
switch (node.kind) {
|
|
10865
|
-
case 174 /* MethodDeclaration */:
|
|
10866
|
-
case 177 /* GetAccessor */:
|
|
10867
|
-
case 178 /* SetAccessor */:
|
|
10868
|
-
case 172 /* PropertyDeclaration */:
|
|
10869
|
-
return true;
|
|
10870
|
-
default:
|
|
10871
|
-
return false;
|
|
10872
|
-
}
|
|
10873
|
-
}
|
|
10874
10863
|
function isModifierLike(node) {
|
|
10875
10864
|
return isModifier(node) || isDecorator(node);
|
|
10876
10865
|
}
|
|
@@ -16081,7 +16070,7 @@ function Symbol4(flags, name) {
|
|
|
16081
16070
|
this.exportSymbol = void 0;
|
|
16082
16071
|
this.constEnumOnlyModule = void 0;
|
|
16083
16072
|
this.isReferenced = void 0;
|
|
16084
|
-
this.
|
|
16073
|
+
this.lastAssignmentPos = void 0;
|
|
16085
16074
|
this.links = void 0;
|
|
16086
16075
|
}
|
|
16087
16076
|
function Type3(checker, flags) {
|
|
@@ -17503,13 +17492,6 @@ function hasContextSensitiveParameters(node) {
|
|
|
17503
17492
|
function isInfinityOrNaNString(name) {
|
|
17504
17493
|
return name === "Infinity" || name === "-Infinity" || name === "NaN";
|
|
17505
17494
|
}
|
|
17506
|
-
function isCatchClauseVariableDeclaration(node) {
|
|
17507
|
-
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
17508
|
-
}
|
|
17509
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
17510
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
17511
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
17512
|
-
}
|
|
17513
17495
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
17514
17496
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
17515
17497
|
}
|
|
@@ -66189,7 +66171,7 @@ function createTypeChecker(host) {
|
|
|
66189
66171
|
case 80 /* Identifier */:
|
|
66190
66172
|
if (!isThisInTypeQuery(node)) {
|
|
66191
66173
|
const symbol = getResolvedSymbol(node);
|
|
66192
|
-
return isConstantVariable(symbol) ||
|
|
66174
|
+
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
|
66193
66175
|
}
|
|
66194
66176
|
break;
|
|
66195
66177
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -67279,10 +67261,17 @@ function createTypeChecker(host) {
|
|
|
67279
67261
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
67280
67262
|
}
|
|
67281
67263
|
function isSymbolAssigned(symbol) {
|
|
67282
|
-
|
|
67264
|
+
return !isPastLastAssignment(
|
|
67265
|
+
symbol,
|
|
67266
|
+
/*location*/
|
|
67267
|
+
void 0
|
|
67268
|
+
);
|
|
67269
|
+
}
|
|
67270
|
+
function isPastLastAssignment(symbol, location) {
|
|
67271
|
+
const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
67272
|
+
if (!parent) {
|
|
67283
67273
|
return false;
|
|
67284
67274
|
}
|
|
67285
|
-
const parent = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
67286
67275
|
const links = getNodeLinks(parent);
|
|
67287
67276
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
67288
67277
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -67290,7 +67279,7 @@ function createTypeChecker(host) {
|
|
|
67290
67279
|
markNodeAssignments(parent);
|
|
67291
67280
|
}
|
|
67292
67281
|
}
|
|
67293
|
-
return symbol.
|
|
67282
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
67294
67283
|
}
|
|
67295
67284
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
67296
67285
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -67303,23 +67292,81 @@ function createTypeChecker(host) {
|
|
|
67303
67292
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
67304
67293
|
}
|
|
67305
67294
|
function hasParentWithAssignmentsMarked(node) {
|
|
67306
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
67295
|
+
return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
67296
|
+
}
|
|
67297
|
+
function isFunctionOrSourceFile(node) {
|
|
67298
|
+
return isFunctionLikeDeclaration(node) || isSourceFile(node);
|
|
67307
67299
|
}
|
|
67308
67300
|
function markNodeAssignments(node) {
|
|
67309
|
-
|
|
67310
|
-
|
|
67311
|
-
|
|
67312
|
-
|
|
67313
|
-
symbol.
|
|
67301
|
+
switch (node.kind) {
|
|
67302
|
+
case 80 /* Identifier */:
|
|
67303
|
+
if (isAssignmentTarget(node)) {
|
|
67304
|
+
const symbol = getResolvedSymbol(node);
|
|
67305
|
+
if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
67306
|
+
const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
|
|
67307
|
+
const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
67308
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
|
|
67309
|
+
}
|
|
67310
|
+
}
|
|
67311
|
+
return;
|
|
67312
|
+
case 281 /* ExportSpecifier */:
|
|
67313
|
+
const exportDeclaration = node.parent.parent;
|
|
67314
|
+
if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
|
|
67315
|
+
const symbol = resolveEntityName(
|
|
67316
|
+
node.propertyName || node.name,
|
|
67317
|
+
111551 /* Value */,
|
|
67318
|
+
/*ignoreErrors*/
|
|
67319
|
+
true,
|
|
67320
|
+
/*dontResolveAlias*/
|
|
67321
|
+
true
|
|
67322
|
+
);
|
|
67323
|
+
if (symbol && isParameterOrMutableLocalVariable(symbol)) {
|
|
67324
|
+
symbol.lastAssignmentPos = Number.MAX_VALUE;
|
|
67325
|
+
}
|
|
67314
67326
|
}
|
|
67327
|
+
return;
|
|
67328
|
+
case 264 /* InterfaceDeclaration */:
|
|
67329
|
+
case 265 /* TypeAliasDeclaration */:
|
|
67330
|
+
case 266 /* EnumDeclaration */:
|
|
67331
|
+
return;
|
|
67332
|
+
}
|
|
67333
|
+
if (isTypeNode(node)) {
|
|
67334
|
+
return;
|
|
67335
|
+
}
|
|
67336
|
+
forEachChild(node, markNodeAssignments);
|
|
67337
|
+
}
|
|
67338
|
+
function extendAssignmentPosition(node, declaration) {
|
|
67339
|
+
let pos = node.pos;
|
|
67340
|
+
while (node && node.pos > declaration.pos) {
|
|
67341
|
+
switch (node.kind) {
|
|
67342
|
+
case 243 /* VariableStatement */:
|
|
67343
|
+
case 244 /* ExpressionStatement */:
|
|
67344
|
+
case 245 /* IfStatement */:
|
|
67345
|
+
case 246 /* DoStatement */:
|
|
67346
|
+
case 247 /* WhileStatement */:
|
|
67347
|
+
case 248 /* ForStatement */:
|
|
67348
|
+
case 249 /* ForInStatement */:
|
|
67349
|
+
case 250 /* ForOfStatement */:
|
|
67350
|
+
case 254 /* WithStatement */:
|
|
67351
|
+
case 255 /* SwitchStatement */:
|
|
67352
|
+
case 258 /* TryStatement */:
|
|
67353
|
+
case 263 /* ClassDeclaration */:
|
|
67354
|
+
pos = node.end;
|
|
67315
67355
|
}
|
|
67316
|
-
|
|
67317
|
-
forEachChild(node, markNodeAssignments);
|
|
67356
|
+
node = node.parent;
|
|
67318
67357
|
}
|
|
67358
|
+
return pos;
|
|
67319
67359
|
}
|
|
67320
67360
|
function isConstantVariable(symbol) {
|
|
67321
67361
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
67322
67362
|
}
|
|
67363
|
+
function isParameterOrMutableLocalVariable(symbol) {
|
|
67364
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
67365
|
+
return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
|
|
67366
|
+
}
|
|
67367
|
+
function isMutableLocalVariableDeclaration(declaration) {
|
|
67368
|
+
return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
|
|
67369
|
+
}
|
|
67323
67370
|
function parameterInitializerContainsUndefined(declaration) {
|
|
67324
67371
|
const links = getNodeLinks(declaration);
|
|
67325
67372
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -67568,7 +67615,7 @@ function createTypeChecker(host) {
|
|
|
67568
67615
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
67569
67616
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
67570
67617
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
67571
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
67618
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
67572
67619
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
67573
67620
|
}
|
|
67574
67621
|
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
|
|
@@ -73887,9 +73934,6 @@ function createTypeChecker(host) {
|
|
|
73887
73934
|
let fallbackReturnType = voidType;
|
|
73888
73935
|
if (func.body.kind !== 241 /* Block */) {
|
|
73889
73936
|
returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
73890
|
-
if (isConstContext(func.body)) {
|
|
73891
|
-
returnType = getRegularTypeOfLiteralType(returnType);
|
|
73892
|
-
}
|
|
73893
73937
|
if (isAsync) {
|
|
73894
73938
|
returnType = unwrapAwaitedType(checkAwaitedType(
|
|
73895
73939
|
returnType,
|
|
@@ -74022,10 +74066,7 @@ function createTypeChecker(host) {
|
|
|
74022
74066
|
const nextTypes = [];
|
|
74023
74067
|
const isAsync = (getFunctionFlags(func) & 2 /* Async */) !== 0;
|
|
74024
74068
|
forEachYieldExpression(func.body, (yieldExpression) => {
|
|
74025
|
-
|
|
74026
|
-
if (yieldExpression.expression && isConstContext(yieldExpression.expression)) {
|
|
74027
|
-
yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType);
|
|
74028
|
-
}
|
|
74069
|
+
const yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType;
|
|
74029
74070
|
pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync));
|
|
74030
74071
|
let nextType;
|
|
74031
74072
|
if (yieldExpression.asteriskToken) {
|
|
@@ -74140,7 +74181,7 @@ function createTypeChecker(host) {
|
|
|
74140
74181
|
if (type.flags & 131072 /* Never */) {
|
|
74141
74182
|
hasReturnOfTypeNever = true;
|
|
74142
74183
|
}
|
|
74143
|
-
pushIfUnique(aggregatedTypes,
|
|
74184
|
+
pushIfUnique(aggregatedTypes, type);
|
|
74144
74185
|
} else {
|
|
74145
74186
|
hasReturnWithNoExpression = true;
|
|
74146
74187
|
}
|
|
@@ -93409,22 +93450,49 @@ function transformESDecorators(context) {
|
|
|
93409
93450
|
}
|
|
93410
93451
|
function createClassInfo(node) {
|
|
93411
93452
|
const metadataReference = factory2.createUniqueName("_metadata", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93412
|
-
let
|
|
93413
|
-
let
|
|
93453
|
+
let instanceMethodExtraInitializersName;
|
|
93454
|
+
let staticMethodExtraInitializersName;
|
|
93414
93455
|
let hasStaticInitializers = false;
|
|
93415
93456
|
let hasNonAmbientInstanceFields = false;
|
|
93416
93457
|
let hasStaticPrivateClassElements = false;
|
|
93458
|
+
let classThis2;
|
|
93459
|
+
let pendingStaticInitializers;
|
|
93460
|
+
let pendingInstanceInitializers;
|
|
93461
|
+
if (nodeIsDecorated(
|
|
93462
|
+
/*useLegacyDecorators*/
|
|
93463
|
+
false,
|
|
93464
|
+
node
|
|
93465
|
+
)) {
|
|
93466
|
+
const needsUniqueClassThis = some(node.members, (member) => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member));
|
|
93467
|
+
classThis2 = factory2.createUniqueName(
|
|
93468
|
+
"_classThis",
|
|
93469
|
+
needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */
|
|
93470
|
+
);
|
|
93471
|
+
}
|
|
93417
93472
|
for (const member of node.members) {
|
|
93418
|
-
if (
|
|
93473
|
+
if (isMethodOrAccessor(member) && nodeOrChildIsDecorated(
|
|
93419
93474
|
/*useLegacyDecorators*/
|
|
93420
93475
|
false,
|
|
93421
93476
|
member,
|
|
93422
93477
|
node
|
|
93423
93478
|
)) {
|
|
93424
93479
|
if (hasStaticModifier(member)) {
|
|
93425
|
-
|
|
93480
|
+
if (!staticMethodExtraInitializersName) {
|
|
93481
|
+
staticMethodExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93482
|
+
const initializer = emitHelpers().createRunInitializersHelper(classThis2 ?? factory2.createThis(), staticMethodExtraInitializersName);
|
|
93483
|
+
setSourceMapRange(initializer, node.name ?? moveRangePastDecorators(node));
|
|
93484
|
+
pendingStaticInitializers ?? (pendingStaticInitializers = []);
|
|
93485
|
+
pendingStaticInitializers.push(initializer);
|
|
93486
|
+
}
|
|
93426
93487
|
} else {
|
|
93427
|
-
|
|
93488
|
+
if (!instanceMethodExtraInitializersName) {
|
|
93489
|
+
instanceMethodExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93490
|
+
const initializer = emitHelpers().createRunInitializersHelper(factory2.createThis(), instanceMethodExtraInitializersName);
|
|
93491
|
+
setSourceMapRange(initializer, node.name ?? moveRangePastDecorators(node));
|
|
93492
|
+
pendingInstanceInitializers ?? (pendingInstanceInitializers = []);
|
|
93493
|
+
pendingInstanceInitializers.push(initializer);
|
|
93494
|
+
}
|
|
93495
|
+
instanceMethodExtraInitializersName ?? (instanceMethodExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */));
|
|
93428
93496
|
}
|
|
93429
93497
|
}
|
|
93430
93498
|
if (isClassStaticBlockDeclaration(member)) {
|
|
@@ -93441,18 +93509,21 @@ function transformESDecorators(context) {
|
|
|
93441
93509
|
if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) {
|
|
93442
93510
|
hasStaticPrivateClassElements = true;
|
|
93443
93511
|
}
|
|
93444
|
-
if (
|
|
93512
|
+
if (staticMethodExtraInitializersName && instanceMethodExtraInitializersName && hasStaticInitializers && hasNonAmbientInstanceFields && hasStaticPrivateClassElements) {
|
|
93445
93513
|
break;
|
|
93446
93514
|
}
|
|
93447
93515
|
}
|
|
93448
93516
|
return {
|
|
93449
93517
|
class: node,
|
|
93518
|
+
classThis: classThis2,
|
|
93450
93519
|
metadataReference,
|
|
93451
|
-
|
|
93452
|
-
|
|
93520
|
+
instanceMethodExtraInitializersName,
|
|
93521
|
+
staticMethodExtraInitializersName,
|
|
93453
93522
|
hasStaticInitializers,
|
|
93454
93523
|
hasNonAmbientInstanceFields,
|
|
93455
|
-
hasStaticPrivateClassElements
|
|
93524
|
+
hasStaticPrivateClassElements,
|
|
93525
|
+
pendingStaticInitializers,
|
|
93526
|
+
pendingInstanceInitializers
|
|
93456
93527
|
};
|
|
93457
93528
|
}
|
|
93458
93529
|
function transformClassLike(node) {
|
|
@@ -93485,11 +93556,7 @@ function transformESDecorators(context) {
|
|
|
93485
93556
|
classInfo2.classDecoratorsName = factory2.createUniqueName("_classDecorators", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93486
93557
|
classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93487
93558
|
classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
93488
|
-
|
|
93489
|
-
classInfo2.classThis = factory2.createUniqueName(
|
|
93490
|
-
"_classThis",
|
|
93491
|
-
needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */
|
|
93492
|
-
);
|
|
93559
|
+
Debug.assertIsDefined(classInfo2.classThis);
|
|
93493
93560
|
classDefinitionStatements.push(
|
|
93494
93561
|
createLet(classInfo2.classDecoratorsName, factory2.createArrayLiteralExpression(classDecorators)),
|
|
93495
93562
|
createLet(classInfo2.classDescriptorName),
|
|
@@ -93521,7 +93588,9 @@ function transformESDecorators(context) {
|
|
|
93521
93588
|
const renamedClassThis = classInfo2.classThis ?? factory2.createThis();
|
|
93522
93589
|
enterClass(classInfo2);
|
|
93523
93590
|
leadingBlockStatements = append(leadingBlockStatements, createMetadata(classInfo2.metadataReference, classInfo2.classSuper));
|
|
93524
|
-
let members =
|
|
93591
|
+
let members = node.members;
|
|
93592
|
+
members = visitNodes2(members, (node2) => isConstructorDeclaration(node2) ? node2 : classElementVisitor(node2), isClassElement);
|
|
93593
|
+
members = visitNodes2(members, (node2) => isConstructorDeclaration(node2) ? classElementVisitor(node2) : node2, isClassElement);
|
|
93525
93594
|
if (pendingExpressions) {
|
|
93526
93595
|
let outerThis;
|
|
93527
93596
|
for (let expression of pendingExpressions) {
|
|
@@ -93546,7 +93615,7 @@ function transformESDecorators(context) {
|
|
|
93546
93615
|
pendingExpressions = void 0;
|
|
93547
93616
|
}
|
|
93548
93617
|
exitClass();
|
|
93549
|
-
if (classInfo2.
|
|
93618
|
+
if (some(classInfo2.pendingInstanceInitializers) && !getFirstConstructorWithBody(node)) {
|
|
93550
93619
|
const initializerStatements = prepareConstructor(node, classInfo2);
|
|
93551
93620
|
if (initializerStatements) {
|
|
93552
93621
|
const extendsClauseElement = getEffectiveBaseTypeNode(node);
|
|
@@ -93576,14 +93645,14 @@ function transformESDecorators(context) {
|
|
|
93576
93645
|
);
|
|
93577
93646
|
}
|
|
93578
93647
|
}
|
|
93579
|
-
if (classInfo2.
|
|
93648
|
+
if (classInfo2.staticMethodExtraInitializersName) {
|
|
93580
93649
|
classDefinitionStatements.push(
|
|
93581
|
-
createLet(classInfo2.
|
|
93650
|
+
createLet(classInfo2.staticMethodExtraInitializersName, factory2.createArrayLiteralExpression())
|
|
93582
93651
|
);
|
|
93583
93652
|
}
|
|
93584
|
-
if (classInfo2.
|
|
93653
|
+
if (classInfo2.instanceMethodExtraInitializersName) {
|
|
93585
93654
|
classDefinitionStatements.push(
|
|
93586
|
-
createLet(classInfo2.
|
|
93655
|
+
createLet(classInfo2.instanceMethodExtraInitializersName, factory2.createArrayLiteralExpression())
|
|
93587
93656
|
);
|
|
93588
93657
|
}
|
|
93589
93658
|
if (classInfo2.memberInfos) {
|
|
@@ -93593,6 +93662,9 @@ function transformESDecorators(context) {
|
|
|
93593
93662
|
if (memberInfo.memberInitializersName) {
|
|
93594
93663
|
classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory2.createArrayLiteralExpression()));
|
|
93595
93664
|
}
|
|
93665
|
+
if (memberInfo.memberExtraInitializersName) {
|
|
93666
|
+
classDefinitionStatements.push(createLet(memberInfo.memberExtraInitializersName, factory2.createArrayLiteralExpression()));
|
|
93667
|
+
}
|
|
93596
93668
|
if (memberInfo.memberDescriptorName) {
|
|
93597
93669
|
classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName));
|
|
93598
93670
|
}
|
|
@@ -93606,6 +93678,9 @@ function transformESDecorators(context) {
|
|
|
93606
93678
|
if (memberInfo.memberInitializersName) {
|
|
93607
93679
|
classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory2.createArrayLiteralExpression()));
|
|
93608
93680
|
}
|
|
93681
|
+
if (memberInfo.memberExtraInitializersName) {
|
|
93682
|
+
classDefinitionStatements.push(createLet(memberInfo.memberExtraInitializersName, factory2.createArrayLiteralExpression()));
|
|
93683
|
+
}
|
|
93609
93684
|
if (memberInfo.memberDescriptorName) {
|
|
93610
93685
|
classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName));
|
|
93611
93686
|
}
|
|
@@ -93639,11 +93714,13 @@ function transformESDecorators(context) {
|
|
|
93639
93714
|
leadingBlockStatements.push(factory2.createExpressionStatement(classReferenceAssignment));
|
|
93640
93715
|
}
|
|
93641
93716
|
leadingBlockStatements.push(createSymbolMetadata(renamedClassThis, classInfo2.metadataReference));
|
|
93642
|
-
if (classInfo2.
|
|
93643
|
-
const
|
|
93644
|
-
|
|
93645
|
-
|
|
93646
|
-
|
|
93717
|
+
if (some(classInfo2.pendingStaticInitializers)) {
|
|
93718
|
+
for (const initializer of classInfo2.pendingStaticInitializers) {
|
|
93719
|
+
const initializerStatement = factory2.createExpressionStatement(initializer);
|
|
93720
|
+
setSourceMapRange(initializerStatement, getSourceMapRange(initializer));
|
|
93721
|
+
trailingBlockStatements = append(trailingBlockStatements, initializerStatement);
|
|
93722
|
+
}
|
|
93723
|
+
classInfo2.pendingStaticInitializers = void 0;
|
|
93647
93724
|
}
|
|
93648
93725
|
if (classInfo2.classExtraInitializersName) {
|
|
93649
93726
|
const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo2.classExtraInitializersName);
|
|
@@ -93874,16 +93951,14 @@ function transformESDecorators(context) {
|
|
|
93874
93951
|
}
|
|
93875
93952
|
}
|
|
93876
93953
|
function prepareConstructor(_parent, classInfo2) {
|
|
93877
|
-
if (classInfo2.
|
|
93954
|
+
if (some(classInfo2.pendingInstanceInitializers)) {
|
|
93878
93955
|
const statements = [];
|
|
93879
93956
|
statements.push(
|
|
93880
93957
|
factory2.createExpressionStatement(
|
|
93881
|
-
|
|
93882
|
-
factory2.createThis(),
|
|
93883
|
-
classInfo2.instanceExtraInitializersName
|
|
93884
|
-
)
|
|
93958
|
+
factory2.inlineExpressions(classInfo2.pendingInstanceInitializers)
|
|
93885
93959
|
)
|
|
93886
93960
|
);
|
|
93961
|
+
classInfo2.pendingInstanceInitializers = void 0;
|
|
93887
93962
|
return statements;
|
|
93888
93963
|
}
|
|
93889
93964
|
}
|
|
@@ -93963,6 +94038,7 @@ function transformESDecorators(context) {
|
|
|
93963
94038
|
let referencedName;
|
|
93964
94039
|
let name;
|
|
93965
94040
|
let initializersName;
|
|
94041
|
+
let extraInitializersName;
|
|
93966
94042
|
let thisArg;
|
|
93967
94043
|
let descriptorName;
|
|
93968
94044
|
if (!classInfo2) {
|
|
@@ -94020,20 +94096,22 @@ function transformESDecorators(context) {
|
|
|
94020
94096
|
},
|
|
94021
94097
|
metadata: classInfo2.metadataReference
|
|
94022
94098
|
};
|
|
94023
|
-
const extraInitializers = isStatic(member) ? classInfo2.staticExtraInitializersName ?? (classInfo2.staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */)) : classInfo2.instanceExtraInitializersName ?? (classInfo2.instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */));
|
|
94024
94099
|
if (isMethodOrAccessor(member)) {
|
|
94100
|
+
const methodExtraInitializersName = isStatic(member) ? classInfo2.staticMethodExtraInitializersName : classInfo2.instanceMethodExtraInitializersName;
|
|
94101
|
+
Debug.assertIsDefined(methodExtraInitializersName);
|
|
94025
94102
|
let descriptor;
|
|
94026
94103
|
if (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) {
|
|
94027
94104
|
descriptor = createDescriptor(member, visitNodes2(modifiers, (node) => tryCast(node, isAsyncModifier), isModifier));
|
|
94028
94105
|
memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor");
|
|
94029
94106
|
descriptor = factory2.createAssignment(descriptorName, descriptor);
|
|
94030
94107
|
}
|
|
94031
|
-
const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor ?? factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(),
|
|
94108
|
+
const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor ?? factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(), methodExtraInitializersName);
|
|
94032
94109
|
const esDecorateStatement = factory2.createExpressionStatement(esDecorateExpression);
|
|
94033
94110
|
setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member));
|
|
94034
94111
|
statements.push(esDecorateStatement);
|
|
94035
94112
|
} else if (isPropertyDeclaration(member)) {
|
|
94036
94113
|
initializersName = memberInfo.memberInitializersName ?? (memberInfo.memberInitializersName = createHelperVariable(member, "initializers"));
|
|
94114
|
+
extraInitializersName = memberInfo.memberExtraInitializersName ?? (memberInfo.memberExtraInitializersName = createHelperVariable(member, "extraInitializers"));
|
|
94037
94115
|
if (isStatic(member)) {
|
|
94038
94116
|
thisArg = classInfo2.classThis;
|
|
94039
94117
|
}
|
|
@@ -94053,7 +94131,7 @@ function transformESDecorators(context) {
|
|
|
94053
94131
|
memberDecoratorsName,
|
|
94054
94132
|
context2,
|
|
94055
94133
|
initializersName,
|
|
94056
|
-
|
|
94134
|
+
extraInitializersName
|
|
94057
94135
|
);
|
|
94058
94136
|
const esDecorateStatement = factory2.createExpressionStatement(esDecorateExpression);
|
|
94059
94137
|
setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member));
|
|
@@ -94068,7 +94146,7 @@ function transformESDecorators(context) {
|
|
|
94068
94146
|
if (!some(modifiers) && (isMethodDeclaration(member) || isPropertyDeclaration(member))) {
|
|
94069
94147
|
setEmitFlags(name, 1024 /* NoLeadingComments */);
|
|
94070
94148
|
}
|
|
94071
|
-
return { modifiers, referencedName, name, initializersName, descriptorName, thisArg };
|
|
94149
|
+
return { modifiers, referencedName, name, initializersName, extraInitializersName, descriptorName, thisArg };
|
|
94072
94150
|
}
|
|
94073
94151
|
function visitMethodDeclaration(node) {
|
|
94074
94152
|
enterClassElement(node);
|
|
@@ -94141,9 +94219,27 @@ function transformESDecorators(context) {
|
|
|
94141
94219
|
result = visitEachChild(node, visitor, context);
|
|
94142
94220
|
classThis = savedClassThis;
|
|
94143
94221
|
} else {
|
|
94144
|
-
|
|
94222
|
+
node = visitEachChild(node, visitor, context);
|
|
94223
|
+
result = node;
|
|
94224
|
+
if (classInfo) {
|
|
94145
94225
|
classInfo.hasStaticInitializers = true;
|
|
94146
|
-
|
|
94226
|
+
if (some(classInfo.pendingStaticInitializers)) {
|
|
94227
|
+
const statements = [];
|
|
94228
|
+
for (const initializer of classInfo.pendingStaticInitializers) {
|
|
94229
|
+
const initializerStatement = factory2.createExpressionStatement(initializer);
|
|
94230
|
+
setSourceMapRange(initializerStatement, getSourceMapRange(initializer));
|
|
94231
|
+
statements.push(initializerStatement);
|
|
94232
|
+
}
|
|
94233
|
+
const body = factory2.createBlock(
|
|
94234
|
+
statements,
|
|
94235
|
+
/*multiLine*/
|
|
94236
|
+
true
|
|
94237
|
+
);
|
|
94238
|
+
const staticBlock = factory2.createClassStaticBlockDeclaration(body);
|
|
94239
|
+
result = [staticBlock, result];
|
|
94240
|
+
classInfo.pendingStaticInitializers = void 0;
|
|
94241
|
+
}
|
|
94242
|
+
}
|
|
94147
94243
|
}
|
|
94148
94244
|
exitClassElement();
|
|
94149
94245
|
return result;
|
|
@@ -94154,7 +94250,7 @@ function transformESDecorators(context) {
|
|
|
94154
94250
|
}
|
|
94155
94251
|
enterClassElement(node);
|
|
94156
94252
|
Debug.assert(!isAmbientPropertyDeclaration(node), "Not yet implemented.");
|
|
94157
|
-
const { modifiers, name, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : void 0);
|
|
94253
|
+
const { modifiers, name, initializersName, extraInitializersName, descriptorName, thisArg } = partialTransformClassElement(node, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : void 0);
|
|
94158
94254
|
startLexicalEnvironment();
|
|
94159
94255
|
let initializer = visitNode(node.initializer, visitor, isExpression);
|
|
94160
94256
|
if (initializersName) {
|
|
@@ -94164,17 +94260,6 @@ function transformESDecorators(context) {
|
|
|
94164
94260
|
initializer ?? factory2.createVoidZero()
|
|
94165
94261
|
);
|
|
94166
94262
|
}
|
|
94167
|
-
if (!isStatic(node) && (classInfo == null ? void 0 : classInfo.instanceExtraInitializersName) && !(classInfo == null ? void 0 : classInfo.hasInjectedInstanceInitializers)) {
|
|
94168
|
-
classInfo.hasInjectedInstanceInitializers = true;
|
|
94169
|
-
initializer ?? (initializer = factory2.createVoidZero());
|
|
94170
|
-
initializer = factory2.createParenthesizedExpression(factory2.createComma(
|
|
94171
|
-
emitHelpers().createRunInitializersHelper(
|
|
94172
|
-
factory2.createThis(),
|
|
94173
|
-
classInfo.instanceExtraInitializersName
|
|
94174
|
-
),
|
|
94175
|
-
initializer
|
|
94176
|
-
));
|
|
94177
|
-
}
|
|
94178
94263
|
if (isStatic(node) && classInfo && initializer) {
|
|
94179
94264
|
classInfo.hasStaticInitializers = true;
|
|
94180
94265
|
}
|
|
@@ -94185,6 +94270,41 @@ function transformESDecorators(context) {
|
|
|
94185
94270
|
factory2.createReturnStatement(initializer)
|
|
94186
94271
|
]);
|
|
94187
94272
|
}
|
|
94273
|
+
if (classInfo) {
|
|
94274
|
+
if (isStatic(node)) {
|
|
94275
|
+
initializer = injectPendingInitializers(
|
|
94276
|
+
classInfo,
|
|
94277
|
+
/*isStatic*/
|
|
94278
|
+
true,
|
|
94279
|
+
initializer
|
|
94280
|
+
);
|
|
94281
|
+
if (extraInitializersName) {
|
|
94282
|
+
classInfo.pendingStaticInitializers ?? (classInfo.pendingStaticInitializers = []);
|
|
94283
|
+
classInfo.pendingStaticInitializers.push(
|
|
94284
|
+
emitHelpers().createRunInitializersHelper(
|
|
94285
|
+
classInfo.classThis ?? factory2.createThis(),
|
|
94286
|
+
extraInitializersName
|
|
94287
|
+
)
|
|
94288
|
+
);
|
|
94289
|
+
}
|
|
94290
|
+
} else {
|
|
94291
|
+
initializer = injectPendingInitializers(
|
|
94292
|
+
classInfo,
|
|
94293
|
+
/*isStatic*/
|
|
94294
|
+
false,
|
|
94295
|
+
initializer
|
|
94296
|
+
);
|
|
94297
|
+
if (extraInitializersName) {
|
|
94298
|
+
classInfo.pendingInstanceInitializers ?? (classInfo.pendingInstanceInitializers = []);
|
|
94299
|
+
classInfo.pendingInstanceInitializers.push(
|
|
94300
|
+
emitHelpers().createRunInitializersHelper(
|
|
94301
|
+
factory2.createThis(),
|
|
94302
|
+
extraInitializersName
|
|
94303
|
+
)
|
|
94304
|
+
);
|
|
94305
|
+
}
|
|
94306
|
+
}
|
|
94307
|
+
}
|
|
94188
94308
|
exitClassElement();
|
|
94189
94309
|
if (hasAccessorModifier(node) && descriptorName) {
|
|
94190
94310
|
const commentRange = getCommentRange(node);
|
|
@@ -94599,19 +94719,41 @@ function transformESDecorators(context) {
|
|
|
94599
94719
|
const expression = visitNode(node.expression, visitorFunc, isExpression);
|
|
94600
94720
|
return factory2.updatePartiallyEmittedExpression(node, expression);
|
|
94601
94721
|
}
|
|
94602
|
-
function
|
|
94603
|
-
if (some(
|
|
94604
|
-
if (
|
|
94605
|
-
|
|
94606
|
-
|
|
94722
|
+
function injectPendingExpressionsCommon(pendingExpressions2, expression) {
|
|
94723
|
+
if (some(pendingExpressions2)) {
|
|
94724
|
+
if (expression) {
|
|
94725
|
+
if (isParenthesizedExpression(expression)) {
|
|
94726
|
+
pendingExpressions2.push(expression.expression);
|
|
94727
|
+
expression = factory2.updateParenthesizedExpression(expression, factory2.inlineExpressions(pendingExpressions2));
|
|
94728
|
+
} else {
|
|
94729
|
+
pendingExpressions2.push(expression);
|
|
94730
|
+
expression = factory2.inlineExpressions(pendingExpressions2);
|
|
94731
|
+
}
|
|
94607
94732
|
} else {
|
|
94608
|
-
|
|
94609
|
-
expression = factory2.inlineExpressions(pendingExpressions);
|
|
94733
|
+
expression = factory2.inlineExpressions(pendingExpressions2);
|
|
94610
94734
|
}
|
|
94611
|
-
pendingExpressions = void 0;
|
|
94612
94735
|
}
|
|
94613
94736
|
return expression;
|
|
94614
94737
|
}
|
|
94738
|
+
function injectPendingExpressions(expression) {
|
|
94739
|
+
const result = injectPendingExpressionsCommon(pendingExpressions, expression);
|
|
94740
|
+
Debug.assertIsDefined(result);
|
|
94741
|
+
if (result !== expression) {
|
|
94742
|
+
pendingExpressions = void 0;
|
|
94743
|
+
}
|
|
94744
|
+
return result;
|
|
94745
|
+
}
|
|
94746
|
+
function injectPendingInitializers(classInfo2, isStatic2, expression) {
|
|
94747
|
+
const result = injectPendingExpressionsCommon(isStatic2 ? classInfo2.pendingStaticInitializers : classInfo2.pendingInstanceInitializers, expression);
|
|
94748
|
+
if (result !== expression) {
|
|
94749
|
+
if (isStatic2) {
|
|
94750
|
+
classInfo2.pendingStaticInitializers = void 0;
|
|
94751
|
+
} else {
|
|
94752
|
+
classInfo2.pendingInstanceInitializers = void 0;
|
|
94753
|
+
}
|
|
94754
|
+
}
|
|
94755
|
+
return result;
|
|
94756
|
+
}
|
|
94615
94757
|
function transformAllDecoratorsOfDeclaration(allDecorators) {
|
|
94616
94758
|
if (!allDecorators) {
|
|
94617
94759
|
return void 0;
|