typescript 5.2.0-dev.20230530 → 5.2.0-dev.20230601
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 +72 -33
- package/lib/tsserver.js +73 -35
- package/lib/tsserverlibrary.js +73 -35
- package/lib/typescript.js +73 -35
- package/lib/typingsInstaller.js +1 -1
- 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.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230601`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -81691,7 +81691,7 @@ function createTypeChecker(host) {
|
|
|
81691
81691
|
if (requestedExternalEmitHelperNames.has(name))
|
|
81692
81692
|
continue;
|
|
81693
81693
|
requestedExternalEmitHelperNames.add(name);
|
|
81694
|
-
const symbol = getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
81694
|
+
const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
81695
81695
|
if (!symbol) {
|
|
81696
81696
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
81697
81697
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -87813,8 +87813,9 @@ function transformClassFields(context) {
|
|
|
87813
87813
|
let pendingStatements;
|
|
87814
87814
|
let lexicalEnvironment;
|
|
87815
87815
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
87816
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
87816
87817
|
let currentClassContainer;
|
|
87817
|
-
let
|
|
87818
|
+
let currentClassElement;
|
|
87818
87819
|
let shouldSubstituteThisWithClassThis = false;
|
|
87819
87820
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
87820
87821
|
return chainBundle(context, transformSourceFile);
|
|
@@ -87906,13 +87907,18 @@ function transformClassFields(context) {
|
|
|
87906
87907
|
return visitForStatement(node);
|
|
87907
87908
|
case 261 /* FunctionDeclaration */:
|
|
87908
87909
|
case 217 /* FunctionExpression */:
|
|
87910
|
+
return setCurrentClassElementAnd(
|
|
87911
|
+
/*classElement*/
|
|
87912
|
+
void 0,
|
|
87913
|
+
fallbackVisitor,
|
|
87914
|
+
node
|
|
87915
|
+
);
|
|
87909
87916
|
case 175 /* Constructor */:
|
|
87910
87917
|
case 173 /* MethodDeclaration */:
|
|
87911
87918
|
case 176 /* GetAccessor */:
|
|
87912
87919
|
case 177 /* SetAccessor */: {
|
|
87913
|
-
return
|
|
87914
|
-
|
|
87915
|
-
void 0,
|
|
87920
|
+
return setCurrentClassElementAnd(
|
|
87921
|
+
node,
|
|
87916
87922
|
fallbackVisitor,
|
|
87917
87923
|
node
|
|
87918
87924
|
);
|
|
@@ -88001,25 +88007,31 @@ function transformClassFields(context) {
|
|
|
88001
88007
|
function classElementVisitor(node) {
|
|
88002
88008
|
switch (node.kind) {
|
|
88003
88009
|
case 175 /* Constructor */:
|
|
88004
|
-
return
|
|
88010
|
+
return setCurrentClassElementAnd(
|
|
88011
|
+
node,
|
|
88012
|
+
visitConstructorDeclaration,
|
|
88013
|
+
node
|
|
88014
|
+
);
|
|
88005
88015
|
case 176 /* GetAccessor */:
|
|
88006
88016
|
case 177 /* SetAccessor */:
|
|
88007
88017
|
case 173 /* MethodDeclaration */:
|
|
88008
|
-
return
|
|
88009
|
-
|
|
88010
|
-
void 0,
|
|
88018
|
+
return setCurrentClassElementAnd(
|
|
88019
|
+
node,
|
|
88011
88020
|
visitMethodOrAccessorDeclaration,
|
|
88012
88021
|
node
|
|
88013
88022
|
);
|
|
88014
88023
|
case 171 /* PropertyDeclaration */:
|
|
88015
|
-
return
|
|
88016
|
-
|
|
88017
|
-
void 0,
|
|
88024
|
+
return setCurrentClassElementAnd(
|
|
88025
|
+
node,
|
|
88018
88026
|
visitPropertyDeclaration,
|
|
88019
88027
|
node
|
|
88020
88028
|
);
|
|
88021
88029
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
88022
|
-
return
|
|
88030
|
+
return setCurrentClassElementAnd(
|
|
88031
|
+
node,
|
|
88032
|
+
visitClassStaticBlockDeclaration,
|
|
88033
|
+
node
|
|
88034
|
+
);
|
|
88023
88035
|
case 166 /* ComputedPropertyName */:
|
|
88024
88036
|
return visitComputedPropertyName(node);
|
|
88025
88037
|
case 239 /* SemicolonClassElement */:
|
|
@@ -88213,12 +88225,15 @@ function transformClassFields(context) {
|
|
|
88213
88225
|
}
|
|
88214
88226
|
return void 0;
|
|
88215
88227
|
}
|
|
88216
|
-
function
|
|
88217
|
-
|
|
88218
|
-
|
|
88219
|
-
|
|
88220
|
-
|
|
88221
|
-
|
|
88228
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
88229
|
+
if (classElement !== currentClassElement) {
|
|
88230
|
+
const savedCurrentClassElement = currentClassElement;
|
|
88231
|
+
currentClassElement = classElement;
|
|
88232
|
+
const result = visitor2(arg);
|
|
88233
|
+
currentClassElement = savedCurrentClassElement;
|
|
88234
|
+
return result;
|
|
88235
|
+
}
|
|
88236
|
+
return visitor2(arg);
|
|
88222
88237
|
}
|
|
88223
88238
|
function getHoistedFunctionName(node) {
|
|
88224
88239
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -88380,8 +88395,21 @@ function transformClassFields(context) {
|
|
|
88380
88395
|
}
|
|
88381
88396
|
return transformFieldInitializer(node);
|
|
88382
88397
|
}
|
|
88398
|
+
function shouldForceDynamicThis() {
|
|
88399
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
88400
|
+
}
|
|
88401
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
88402
|
+
if (shouldForceDynamicThis()) {
|
|
88403
|
+
const innerExpression = skipOuterExpressions(node);
|
|
88404
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
88405
|
+
noSubstitution.add(innerExpression);
|
|
88406
|
+
}
|
|
88407
|
+
}
|
|
88408
|
+
}
|
|
88383
88409
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
88384
|
-
|
|
88410
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
88411
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
88412
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
88385
88413
|
}
|
|
88386
88414
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
88387
88415
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -88426,7 +88454,7 @@ function transformClassFields(context) {
|
|
|
88426
88454
|
);
|
|
88427
88455
|
}
|
|
88428
88456
|
}
|
|
88429
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
88457
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
88430
88458
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
88431
88459
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
88432
88460
|
return visitInvalidSuperProperty(node);
|
|
@@ -88445,7 +88473,7 @@ function transformClassFields(context) {
|
|
|
88445
88473
|
return visitEachChild(node, visitor, context);
|
|
88446
88474
|
}
|
|
88447
88475
|
function visitElementAccessExpression(node) {
|
|
88448
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
88476
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
88449
88477
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
88450
88478
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
88451
88479
|
return visitInvalidSuperProperty(node);
|
|
@@ -88470,6 +88498,7 @@ function transformClassFields(context) {
|
|
|
88470
88498
|
let info;
|
|
88471
88499
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
88472
88500
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
88501
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
88473
88502
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
88474
88503
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
88475
88504
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -88488,7 +88517,7 @@ function transformClassFields(context) {
|
|
|
88488
88517
|
}
|
|
88489
88518
|
return expression;
|
|
88490
88519
|
}
|
|
88491
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
88520
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
88492
88521
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
88493
88522
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
88494
88523
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -88545,6 +88574,9 @@ function transformClassFields(context) {
|
|
|
88545
88574
|
}
|
|
88546
88575
|
function createCopiableReceiverExpr(receiver) {
|
|
88547
88576
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
88577
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
88578
|
+
noSubstitution.add(clone2);
|
|
88579
|
+
}
|
|
88548
88580
|
if (isSimpleInlineableExpression(receiver)) {
|
|
88549
88581
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
88550
88582
|
}
|
|
@@ -88575,7 +88607,7 @@ function transformClassFields(context) {
|
|
|
88575
88607
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
88576
88608
|
);
|
|
88577
88609
|
}
|
|
88578
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
88610
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
88579
88611
|
const invocation = factory2.createFunctionCallCall(
|
|
88580
88612
|
visitNode(node.expression, visitor, isExpression),
|
|
88581
88613
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -88604,7 +88636,7 @@ function transformClassFields(context) {
|
|
|
88604
88636
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
88605
88637
|
);
|
|
88606
88638
|
}
|
|
88607
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
88639
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
88608
88640
|
const invocation = factory2.createFunctionBindCall(
|
|
88609
88641
|
visitNode(node.tag, visitor, isExpression),
|
|
88610
88642
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -88628,7 +88660,7 @@ function transformClassFields(context) {
|
|
|
88628
88660
|
}
|
|
88629
88661
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
88630
88662
|
startLexicalEnvironment();
|
|
88631
|
-
let statements =
|
|
88663
|
+
let statements = setCurrentClassElementAnd(
|
|
88632
88664
|
node,
|
|
88633
88665
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
88634
88666
|
node.body.statements
|
|
@@ -88690,7 +88722,7 @@ function transformClassFields(context) {
|
|
|
88690
88722
|
node
|
|
88691
88723
|
);
|
|
88692
88724
|
}
|
|
88693
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
88725
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
88694
88726
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
88695
88727
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
88696
88728
|
return factory2.updateBinaryExpression(
|
|
@@ -88785,6 +88817,7 @@ function transformClassFields(context) {
|
|
|
88785
88817
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
88786
88818
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
88787
88819
|
right = visitNode(right, visitor, isExpression);
|
|
88820
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
88788
88821
|
if (isCompoundAssignment(operator)) {
|
|
88789
88822
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
88790
88823
|
receiver = initializeExpression || readExpression;
|
|
@@ -89427,7 +89460,7 @@ function transformClassFields(context) {
|
|
|
89427
89460
|
}
|
|
89428
89461
|
function transformProperty(property, receiver) {
|
|
89429
89462
|
var _a;
|
|
89430
|
-
const
|
|
89463
|
+
const savedCurrentClassElement = currentClassElement;
|
|
89431
89464
|
const transformed = transformPropertyWorker(property, receiver);
|
|
89432
89465
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
89433
89466
|
setOriginalNode(transformed, property);
|
|
@@ -89435,7 +89468,7 @@ function transformClassFields(context) {
|
|
|
89435
89468
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
89436
89469
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
89437
89470
|
}
|
|
89438
|
-
|
|
89471
|
+
currentClassElement = savedCurrentClassElement;
|
|
89439
89472
|
return transformed;
|
|
89440
89473
|
}
|
|
89441
89474
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -89452,7 +89485,7 @@ function transformClassFields(context) {
|
|
|
89452
89485
|
}
|
|
89453
89486
|
const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name;
|
|
89454
89487
|
if (hasStaticModifier(property)) {
|
|
89455
|
-
|
|
89488
|
+
currentClassElement = property;
|
|
89456
89489
|
}
|
|
89457
89490
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
89458
89491
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -89777,7 +89810,7 @@ function transformClassFields(context) {
|
|
|
89777
89810
|
}
|
|
89778
89811
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
89779
89812
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
89780
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
89813
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
89781
89814
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
89782
89815
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
89783
89816
|
return visitInvalidSuperProperty(node);
|
|
@@ -89957,7 +89990,7 @@ function transformClassFields(context) {
|
|
|
89957
89990
|
return node;
|
|
89958
89991
|
}
|
|
89959
89992
|
function substituteThisExpression(node) {
|
|
89960
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
89993
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
89961
89994
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
89962
89995
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
89963
89996
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -90026,6 +90059,12 @@ function isReservedPrivateName(node) {
|
|
|
90026
90059
|
function isPrivateIdentifierInExpression(node) {
|
|
90027
90060
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
90028
90061
|
}
|
|
90062
|
+
function isStaticPropertyDeclaration2(node) {
|
|
90063
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
90064
|
+
}
|
|
90065
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
90066
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
90067
|
+
}
|
|
90029
90068
|
|
|
90030
90069
|
// src/compiler/transformers/typeSerializer.ts
|
|
90031
90070
|
function createRuntimeTypeSerializer(context) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-dev.20230601`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -86342,7 +86342,7 @@ function createTypeChecker(host) {
|
|
|
86342
86342
|
if (requestedExternalEmitHelperNames.has(name))
|
|
86343
86343
|
continue;
|
|
86344
86344
|
requestedExternalEmitHelperNames.add(name);
|
|
86345
|
-
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
86345
|
+
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
86346
86346
|
if (!symbol) {
|
|
86347
86347
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
86348
86348
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -92635,8 +92635,9 @@ function transformClassFields(context) {
|
|
|
92635
92635
|
let pendingStatements;
|
|
92636
92636
|
let lexicalEnvironment;
|
|
92637
92637
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
92638
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
92638
92639
|
let currentClassContainer;
|
|
92639
|
-
let
|
|
92640
|
+
let currentClassElement;
|
|
92640
92641
|
let shouldSubstituteThisWithClassThis = false;
|
|
92641
92642
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
92642
92643
|
return chainBundle(context, transformSourceFile);
|
|
@@ -92728,13 +92729,18 @@ function transformClassFields(context) {
|
|
|
92728
92729
|
return visitForStatement(node);
|
|
92729
92730
|
case 261 /* FunctionDeclaration */:
|
|
92730
92731
|
case 217 /* FunctionExpression */:
|
|
92732
|
+
return setCurrentClassElementAnd(
|
|
92733
|
+
/*classElement*/
|
|
92734
|
+
void 0,
|
|
92735
|
+
fallbackVisitor,
|
|
92736
|
+
node
|
|
92737
|
+
);
|
|
92731
92738
|
case 175 /* Constructor */:
|
|
92732
92739
|
case 173 /* MethodDeclaration */:
|
|
92733
92740
|
case 176 /* GetAccessor */:
|
|
92734
92741
|
case 177 /* SetAccessor */: {
|
|
92735
|
-
return
|
|
92736
|
-
|
|
92737
|
-
void 0,
|
|
92742
|
+
return setCurrentClassElementAnd(
|
|
92743
|
+
node,
|
|
92738
92744
|
fallbackVisitor,
|
|
92739
92745
|
node
|
|
92740
92746
|
);
|
|
@@ -92823,25 +92829,31 @@ function transformClassFields(context) {
|
|
|
92823
92829
|
function classElementVisitor(node) {
|
|
92824
92830
|
switch (node.kind) {
|
|
92825
92831
|
case 175 /* Constructor */:
|
|
92826
|
-
return
|
|
92832
|
+
return setCurrentClassElementAnd(
|
|
92833
|
+
node,
|
|
92834
|
+
visitConstructorDeclaration,
|
|
92835
|
+
node
|
|
92836
|
+
);
|
|
92827
92837
|
case 176 /* GetAccessor */:
|
|
92828
92838
|
case 177 /* SetAccessor */:
|
|
92829
92839
|
case 173 /* MethodDeclaration */:
|
|
92830
|
-
return
|
|
92831
|
-
|
|
92832
|
-
void 0,
|
|
92840
|
+
return setCurrentClassElementAnd(
|
|
92841
|
+
node,
|
|
92833
92842
|
visitMethodOrAccessorDeclaration,
|
|
92834
92843
|
node
|
|
92835
92844
|
);
|
|
92836
92845
|
case 171 /* PropertyDeclaration */:
|
|
92837
|
-
return
|
|
92838
|
-
|
|
92839
|
-
void 0,
|
|
92846
|
+
return setCurrentClassElementAnd(
|
|
92847
|
+
node,
|
|
92840
92848
|
visitPropertyDeclaration,
|
|
92841
92849
|
node
|
|
92842
92850
|
);
|
|
92843
92851
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
92844
|
-
return
|
|
92852
|
+
return setCurrentClassElementAnd(
|
|
92853
|
+
node,
|
|
92854
|
+
visitClassStaticBlockDeclaration,
|
|
92855
|
+
node
|
|
92856
|
+
);
|
|
92845
92857
|
case 166 /* ComputedPropertyName */:
|
|
92846
92858
|
return visitComputedPropertyName(node);
|
|
92847
92859
|
case 239 /* SemicolonClassElement */:
|
|
@@ -93035,12 +93047,15 @@ function transformClassFields(context) {
|
|
|
93035
93047
|
}
|
|
93036
93048
|
return void 0;
|
|
93037
93049
|
}
|
|
93038
|
-
function
|
|
93039
|
-
|
|
93040
|
-
|
|
93041
|
-
|
|
93042
|
-
|
|
93043
|
-
|
|
93050
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
93051
|
+
if (classElement !== currentClassElement) {
|
|
93052
|
+
const savedCurrentClassElement = currentClassElement;
|
|
93053
|
+
currentClassElement = classElement;
|
|
93054
|
+
const result = visitor2(arg);
|
|
93055
|
+
currentClassElement = savedCurrentClassElement;
|
|
93056
|
+
return result;
|
|
93057
|
+
}
|
|
93058
|
+
return visitor2(arg);
|
|
93044
93059
|
}
|
|
93045
93060
|
function getHoistedFunctionName(node) {
|
|
93046
93061
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -93202,8 +93217,21 @@ function transformClassFields(context) {
|
|
|
93202
93217
|
}
|
|
93203
93218
|
return transformFieldInitializer(node);
|
|
93204
93219
|
}
|
|
93220
|
+
function shouldForceDynamicThis() {
|
|
93221
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
93222
|
+
}
|
|
93223
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
93224
|
+
if (shouldForceDynamicThis()) {
|
|
93225
|
+
const innerExpression = skipOuterExpressions(node);
|
|
93226
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
93227
|
+
noSubstitution.add(innerExpression);
|
|
93228
|
+
}
|
|
93229
|
+
}
|
|
93230
|
+
}
|
|
93205
93231
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
93206
|
-
|
|
93232
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
93233
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93234
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
93207
93235
|
}
|
|
93208
93236
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
93209
93237
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -93248,7 +93276,7 @@ function transformClassFields(context) {
|
|
|
93248
93276
|
);
|
|
93249
93277
|
}
|
|
93250
93278
|
}
|
|
93251
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
93279
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93252
93280
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93253
93281
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93254
93282
|
return visitInvalidSuperProperty(node);
|
|
@@ -93267,7 +93295,7 @@ function transformClassFields(context) {
|
|
|
93267
93295
|
return visitEachChild(node, visitor, context);
|
|
93268
93296
|
}
|
|
93269
93297
|
function visitElementAccessExpression(node) {
|
|
93270
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
93298
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93271
93299
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93272
93300
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93273
93301
|
return visitInvalidSuperProperty(node);
|
|
@@ -93292,6 +93320,7 @@ function transformClassFields(context) {
|
|
|
93292
93320
|
let info;
|
|
93293
93321
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
93294
93322
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
93323
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93295
93324
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
93296
93325
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
93297
93326
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -93310,7 +93339,7 @@ function transformClassFields(context) {
|
|
|
93310
93339
|
}
|
|
93311
93340
|
return expression;
|
|
93312
93341
|
}
|
|
93313
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
93342
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93314
93343
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93315
93344
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93316
93345
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -93367,6 +93396,9 @@ function transformClassFields(context) {
|
|
|
93367
93396
|
}
|
|
93368
93397
|
function createCopiableReceiverExpr(receiver) {
|
|
93369
93398
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
93399
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
93400
|
+
noSubstitution.add(clone2);
|
|
93401
|
+
}
|
|
93370
93402
|
if (isSimpleInlineableExpression(receiver)) {
|
|
93371
93403
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
93372
93404
|
}
|
|
@@ -93397,7 +93429,7 @@ function transformClassFields(context) {
|
|
|
93397
93429
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
93398
93430
|
);
|
|
93399
93431
|
}
|
|
93400
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
93432
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
93401
93433
|
const invocation = factory2.createFunctionCallCall(
|
|
93402
93434
|
visitNode(node.expression, visitor, isExpression),
|
|
93403
93435
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -93426,7 +93458,7 @@ function transformClassFields(context) {
|
|
|
93426
93458
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
93427
93459
|
);
|
|
93428
93460
|
}
|
|
93429
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
93461
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
93430
93462
|
const invocation = factory2.createFunctionBindCall(
|
|
93431
93463
|
visitNode(node.tag, visitor, isExpression),
|
|
93432
93464
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -93450,7 +93482,7 @@ function transformClassFields(context) {
|
|
|
93450
93482
|
}
|
|
93451
93483
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
93452
93484
|
startLexicalEnvironment();
|
|
93453
|
-
let statements =
|
|
93485
|
+
let statements = setCurrentClassElementAnd(
|
|
93454
93486
|
node,
|
|
93455
93487
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
93456
93488
|
node.body.statements
|
|
@@ -93512,7 +93544,7 @@ function transformClassFields(context) {
|
|
|
93512
93544
|
node
|
|
93513
93545
|
);
|
|
93514
93546
|
}
|
|
93515
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
93547
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93516
93548
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93517
93549
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93518
93550
|
return factory2.updateBinaryExpression(
|
|
@@ -93607,6 +93639,7 @@ function transformClassFields(context) {
|
|
|
93607
93639
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
93608
93640
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
93609
93641
|
right = visitNode(right, visitor, isExpression);
|
|
93642
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93610
93643
|
if (isCompoundAssignment(operator)) {
|
|
93611
93644
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
93612
93645
|
receiver = initializeExpression || readExpression;
|
|
@@ -94249,7 +94282,7 @@ function transformClassFields(context) {
|
|
|
94249
94282
|
}
|
|
94250
94283
|
function transformProperty(property, receiver) {
|
|
94251
94284
|
var _a;
|
|
94252
|
-
const
|
|
94285
|
+
const savedCurrentClassElement = currentClassElement;
|
|
94253
94286
|
const transformed = transformPropertyWorker(property, receiver);
|
|
94254
94287
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
94255
94288
|
setOriginalNode(transformed, property);
|
|
@@ -94257,7 +94290,7 @@ function transformClassFields(context) {
|
|
|
94257
94290
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
94258
94291
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
94259
94292
|
}
|
|
94260
|
-
|
|
94293
|
+
currentClassElement = savedCurrentClassElement;
|
|
94261
94294
|
return transformed;
|
|
94262
94295
|
}
|
|
94263
94296
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -94274,7 +94307,7 @@ function transformClassFields(context) {
|
|
|
94274
94307
|
}
|
|
94275
94308
|
const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name;
|
|
94276
94309
|
if (hasStaticModifier(property)) {
|
|
94277
|
-
|
|
94310
|
+
currentClassElement = property;
|
|
94278
94311
|
}
|
|
94279
94312
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
94280
94313
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -94599,7 +94632,7 @@ function transformClassFields(context) {
|
|
|
94599
94632
|
}
|
|
94600
94633
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
94601
94634
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
94602
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
94635
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
94603
94636
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
94604
94637
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
94605
94638
|
return visitInvalidSuperProperty(node);
|
|
@@ -94779,7 +94812,7 @@ function transformClassFields(context) {
|
|
|
94779
94812
|
return node;
|
|
94780
94813
|
}
|
|
94781
94814
|
function substituteThisExpression(node) {
|
|
94782
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
94815
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
94783
94816
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
94784
94817
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
94785
94818
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -94848,6 +94881,12 @@ function isReservedPrivateName(node) {
|
|
|
94848
94881
|
function isPrivateIdentifierInExpression(node) {
|
|
94849
94882
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
94850
94883
|
}
|
|
94884
|
+
function isStaticPropertyDeclaration2(node) {
|
|
94885
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
94886
|
+
}
|
|
94887
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
94888
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
94889
|
+
}
|
|
94851
94890
|
|
|
94852
94891
|
// src/compiler/transformers/typeSerializer.ts
|
|
94853
94892
|
function createRuntimeTypeSerializer(context) {
|
|
@@ -153478,8 +153517,7 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
|
|
|
153478
153517
|
instanceTypes,
|
|
153479
153518
|
contextNode,
|
|
153480
153519
|
scriptTarget,
|
|
153481
|
-
/*
|
|
153482
|
-
void 0,
|
|
153520
|
+
1 /* NoTruncation */,
|
|
153483
153521
|
tracker
|
|
153484
153522
|
);
|
|
153485
153523
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230601`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -84132,7 +84132,7 @@ ${lanes.join("\n")}
|
|
|
84132
84132
|
if (requestedExternalEmitHelperNames.has(name))
|
|
84133
84133
|
continue;
|
|
84134
84134
|
requestedExternalEmitHelperNames.add(name);
|
|
84135
|
-
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
84135
|
+
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
84136
84136
|
if (!symbol) {
|
|
84137
84137
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
84138
84138
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -90601,8 +90601,9 @@ ${lanes.join("\n")}
|
|
|
90601
90601
|
let pendingStatements;
|
|
90602
90602
|
let lexicalEnvironment;
|
|
90603
90603
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
90604
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
90604
90605
|
let currentClassContainer;
|
|
90605
|
-
let
|
|
90606
|
+
let currentClassElement;
|
|
90606
90607
|
let shouldSubstituteThisWithClassThis = false;
|
|
90607
90608
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
90608
90609
|
return chainBundle(context, transformSourceFile);
|
|
@@ -90694,13 +90695,18 @@ ${lanes.join("\n")}
|
|
|
90694
90695
|
return visitForStatement(node);
|
|
90695
90696
|
case 261 /* FunctionDeclaration */:
|
|
90696
90697
|
case 217 /* FunctionExpression */:
|
|
90698
|
+
return setCurrentClassElementAnd(
|
|
90699
|
+
/*classElement*/
|
|
90700
|
+
void 0,
|
|
90701
|
+
fallbackVisitor,
|
|
90702
|
+
node
|
|
90703
|
+
);
|
|
90697
90704
|
case 175 /* Constructor */:
|
|
90698
90705
|
case 173 /* MethodDeclaration */:
|
|
90699
90706
|
case 176 /* GetAccessor */:
|
|
90700
90707
|
case 177 /* SetAccessor */: {
|
|
90701
|
-
return
|
|
90702
|
-
|
|
90703
|
-
void 0,
|
|
90708
|
+
return setCurrentClassElementAnd(
|
|
90709
|
+
node,
|
|
90704
90710
|
fallbackVisitor,
|
|
90705
90711
|
node
|
|
90706
90712
|
);
|
|
@@ -90789,25 +90795,31 @@ ${lanes.join("\n")}
|
|
|
90789
90795
|
function classElementVisitor(node) {
|
|
90790
90796
|
switch (node.kind) {
|
|
90791
90797
|
case 175 /* Constructor */:
|
|
90792
|
-
return
|
|
90798
|
+
return setCurrentClassElementAnd(
|
|
90799
|
+
node,
|
|
90800
|
+
visitConstructorDeclaration,
|
|
90801
|
+
node
|
|
90802
|
+
);
|
|
90793
90803
|
case 176 /* GetAccessor */:
|
|
90794
90804
|
case 177 /* SetAccessor */:
|
|
90795
90805
|
case 173 /* MethodDeclaration */:
|
|
90796
|
-
return
|
|
90797
|
-
|
|
90798
|
-
void 0,
|
|
90806
|
+
return setCurrentClassElementAnd(
|
|
90807
|
+
node,
|
|
90799
90808
|
visitMethodOrAccessorDeclaration,
|
|
90800
90809
|
node
|
|
90801
90810
|
);
|
|
90802
90811
|
case 171 /* PropertyDeclaration */:
|
|
90803
|
-
return
|
|
90804
|
-
|
|
90805
|
-
void 0,
|
|
90812
|
+
return setCurrentClassElementAnd(
|
|
90813
|
+
node,
|
|
90806
90814
|
visitPropertyDeclaration,
|
|
90807
90815
|
node
|
|
90808
90816
|
);
|
|
90809
90817
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
90810
|
-
return
|
|
90818
|
+
return setCurrentClassElementAnd(
|
|
90819
|
+
node,
|
|
90820
|
+
visitClassStaticBlockDeclaration,
|
|
90821
|
+
node
|
|
90822
|
+
);
|
|
90811
90823
|
case 166 /* ComputedPropertyName */:
|
|
90812
90824
|
return visitComputedPropertyName(node);
|
|
90813
90825
|
case 239 /* SemicolonClassElement */:
|
|
@@ -91001,12 +91013,15 @@ ${lanes.join("\n")}
|
|
|
91001
91013
|
}
|
|
91002
91014
|
return void 0;
|
|
91003
91015
|
}
|
|
91004
|
-
function
|
|
91005
|
-
|
|
91006
|
-
|
|
91007
|
-
|
|
91008
|
-
|
|
91009
|
-
|
|
91016
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
91017
|
+
if (classElement !== currentClassElement) {
|
|
91018
|
+
const savedCurrentClassElement = currentClassElement;
|
|
91019
|
+
currentClassElement = classElement;
|
|
91020
|
+
const result = visitor2(arg);
|
|
91021
|
+
currentClassElement = savedCurrentClassElement;
|
|
91022
|
+
return result;
|
|
91023
|
+
}
|
|
91024
|
+
return visitor2(arg);
|
|
91010
91025
|
}
|
|
91011
91026
|
function getHoistedFunctionName(node) {
|
|
91012
91027
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -91168,8 +91183,21 @@ ${lanes.join("\n")}
|
|
|
91168
91183
|
}
|
|
91169
91184
|
return transformFieldInitializer(node);
|
|
91170
91185
|
}
|
|
91186
|
+
function shouldForceDynamicThis() {
|
|
91187
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
91188
|
+
}
|
|
91189
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
91190
|
+
if (shouldForceDynamicThis()) {
|
|
91191
|
+
const innerExpression = skipOuterExpressions(node);
|
|
91192
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
91193
|
+
noSubstitution.add(innerExpression);
|
|
91194
|
+
}
|
|
91195
|
+
}
|
|
91196
|
+
}
|
|
91171
91197
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
91172
|
-
|
|
91198
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
91199
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91200
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
91173
91201
|
}
|
|
91174
91202
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
91175
91203
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -91214,7 +91242,7 @@ ${lanes.join("\n")}
|
|
|
91214
91242
|
);
|
|
91215
91243
|
}
|
|
91216
91244
|
}
|
|
91217
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
91245
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91218
91246
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91219
91247
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91220
91248
|
return visitInvalidSuperProperty(node);
|
|
@@ -91233,7 +91261,7 @@ ${lanes.join("\n")}
|
|
|
91233
91261
|
return visitEachChild(node, visitor, context);
|
|
91234
91262
|
}
|
|
91235
91263
|
function visitElementAccessExpression(node) {
|
|
91236
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
91264
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91237
91265
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91238
91266
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91239
91267
|
return visitInvalidSuperProperty(node);
|
|
@@ -91258,6 +91286,7 @@ ${lanes.join("\n")}
|
|
|
91258
91286
|
let info;
|
|
91259
91287
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
91260
91288
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
91289
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91261
91290
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91262
91291
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
91263
91292
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -91276,7 +91305,7 @@ ${lanes.join("\n")}
|
|
|
91276
91305
|
}
|
|
91277
91306
|
return expression;
|
|
91278
91307
|
}
|
|
91279
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
91308
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91280
91309
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91281
91310
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91282
91311
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -91333,6 +91362,9 @@ ${lanes.join("\n")}
|
|
|
91333
91362
|
}
|
|
91334
91363
|
function createCopiableReceiverExpr(receiver) {
|
|
91335
91364
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
91365
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
91366
|
+
noSubstitution.add(clone2);
|
|
91367
|
+
}
|
|
91336
91368
|
if (isSimpleInlineableExpression(receiver)) {
|
|
91337
91369
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
91338
91370
|
}
|
|
@@ -91363,7 +91395,7 @@ ${lanes.join("\n")}
|
|
|
91363
91395
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
91364
91396
|
);
|
|
91365
91397
|
}
|
|
91366
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
91398
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91367
91399
|
const invocation = factory2.createFunctionCallCall(
|
|
91368
91400
|
visitNode(node.expression, visitor, isExpression),
|
|
91369
91401
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91392,7 +91424,7 @@ ${lanes.join("\n")}
|
|
|
91392
91424
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
91393
91425
|
);
|
|
91394
91426
|
}
|
|
91395
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
91427
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91396
91428
|
const invocation = factory2.createFunctionBindCall(
|
|
91397
91429
|
visitNode(node.tag, visitor, isExpression),
|
|
91398
91430
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91416,7 +91448,7 @@ ${lanes.join("\n")}
|
|
|
91416
91448
|
}
|
|
91417
91449
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
91418
91450
|
startLexicalEnvironment();
|
|
91419
|
-
let statements =
|
|
91451
|
+
let statements = setCurrentClassElementAnd(
|
|
91420
91452
|
node,
|
|
91421
91453
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
91422
91454
|
node.body.statements
|
|
@@ -91478,7 +91510,7 @@ ${lanes.join("\n")}
|
|
|
91478
91510
|
node
|
|
91479
91511
|
);
|
|
91480
91512
|
}
|
|
91481
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
91513
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91482
91514
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91483
91515
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91484
91516
|
return factory2.updateBinaryExpression(
|
|
@@ -91573,6 +91605,7 @@ ${lanes.join("\n")}
|
|
|
91573
91605
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
91574
91606
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
91575
91607
|
right = visitNode(right, visitor, isExpression);
|
|
91608
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91576
91609
|
if (isCompoundAssignment(operator)) {
|
|
91577
91610
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91578
91611
|
receiver = initializeExpression || readExpression;
|
|
@@ -92215,7 +92248,7 @@ ${lanes.join("\n")}
|
|
|
92215
92248
|
}
|
|
92216
92249
|
function transformProperty(property, receiver) {
|
|
92217
92250
|
var _a;
|
|
92218
|
-
const
|
|
92251
|
+
const savedCurrentClassElement = currentClassElement;
|
|
92219
92252
|
const transformed = transformPropertyWorker(property, receiver);
|
|
92220
92253
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
92221
92254
|
setOriginalNode(transformed, property);
|
|
@@ -92223,7 +92256,7 @@ ${lanes.join("\n")}
|
|
|
92223
92256
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
92224
92257
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
92225
92258
|
}
|
|
92226
|
-
|
|
92259
|
+
currentClassElement = savedCurrentClassElement;
|
|
92227
92260
|
return transformed;
|
|
92228
92261
|
}
|
|
92229
92262
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -92240,7 +92273,7 @@ ${lanes.join("\n")}
|
|
|
92240
92273
|
}
|
|
92241
92274
|
const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name;
|
|
92242
92275
|
if (hasStaticModifier(property)) {
|
|
92243
|
-
|
|
92276
|
+
currentClassElement = property;
|
|
92244
92277
|
}
|
|
92245
92278
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
92246
92279
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -92565,7 +92598,7 @@ ${lanes.join("\n")}
|
|
|
92565
92598
|
}
|
|
92566
92599
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
92567
92600
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
92568
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
92601
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92569
92602
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
92570
92603
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
92571
92604
|
return visitInvalidSuperProperty(node);
|
|
@@ -92745,7 +92778,7 @@ ${lanes.join("\n")}
|
|
|
92745
92778
|
return node;
|
|
92746
92779
|
}
|
|
92747
92780
|
function substituteThisExpression(node) {
|
|
92748
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92781
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
92749
92782
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
92750
92783
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
92751
92784
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -92814,6 +92847,12 @@ ${lanes.join("\n")}
|
|
|
92814
92847
|
function isPrivateIdentifierInExpression(node) {
|
|
92815
92848
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
92816
92849
|
}
|
|
92850
|
+
function isStaticPropertyDeclaration2(node) {
|
|
92851
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
92852
|
+
}
|
|
92853
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
92854
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
92855
|
+
}
|
|
92817
92856
|
var init_classFields = __esm({
|
|
92818
92857
|
"src/compiler/transformers/classFields.ts"() {
|
|
92819
92858
|
"use strict";
|
|
@@ -152525,8 +152564,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152525
152564
|
instanceTypes,
|
|
152526
152565
|
contextNode,
|
|
152527
152566
|
scriptTarget,
|
|
152528
|
-
/*
|
|
152529
|
-
void 0,
|
|
152567
|
+
1 /* NoTruncation */,
|
|
152530
152568
|
tracker
|
|
152531
152569
|
);
|
|
152532
152570
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
|
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.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230601`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -84132,7 +84132,7 @@ ${lanes.join("\n")}
|
|
|
84132
84132
|
if (requestedExternalEmitHelperNames.has(name))
|
|
84133
84133
|
continue;
|
|
84134
84134
|
requestedExternalEmitHelperNames.add(name);
|
|
84135
|
-
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
84135
|
+
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
84136
84136
|
if (!symbol) {
|
|
84137
84137
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
84138
84138
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -90601,8 +90601,9 @@ ${lanes.join("\n")}
|
|
|
90601
90601
|
let pendingStatements;
|
|
90602
90602
|
let lexicalEnvironment;
|
|
90603
90603
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
90604
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
90604
90605
|
let currentClassContainer;
|
|
90605
|
-
let
|
|
90606
|
+
let currentClassElement;
|
|
90606
90607
|
let shouldSubstituteThisWithClassThis = false;
|
|
90607
90608
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
90608
90609
|
return chainBundle(context, transformSourceFile);
|
|
@@ -90694,13 +90695,18 @@ ${lanes.join("\n")}
|
|
|
90694
90695
|
return visitForStatement(node);
|
|
90695
90696
|
case 261 /* FunctionDeclaration */:
|
|
90696
90697
|
case 217 /* FunctionExpression */:
|
|
90698
|
+
return setCurrentClassElementAnd(
|
|
90699
|
+
/*classElement*/
|
|
90700
|
+
void 0,
|
|
90701
|
+
fallbackVisitor,
|
|
90702
|
+
node
|
|
90703
|
+
);
|
|
90697
90704
|
case 175 /* Constructor */:
|
|
90698
90705
|
case 173 /* MethodDeclaration */:
|
|
90699
90706
|
case 176 /* GetAccessor */:
|
|
90700
90707
|
case 177 /* SetAccessor */: {
|
|
90701
|
-
return
|
|
90702
|
-
|
|
90703
|
-
void 0,
|
|
90708
|
+
return setCurrentClassElementAnd(
|
|
90709
|
+
node,
|
|
90704
90710
|
fallbackVisitor,
|
|
90705
90711
|
node
|
|
90706
90712
|
);
|
|
@@ -90789,25 +90795,31 @@ ${lanes.join("\n")}
|
|
|
90789
90795
|
function classElementVisitor(node) {
|
|
90790
90796
|
switch (node.kind) {
|
|
90791
90797
|
case 175 /* Constructor */:
|
|
90792
|
-
return
|
|
90798
|
+
return setCurrentClassElementAnd(
|
|
90799
|
+
node,
|
|
90800
|
+
visitConstructorDeclaration,
|
|
90801
|
+
node
|
|
90802
|
+
);
|
|
90793
90803
|
case 176 /* GetAccessor */:
|
|
90794
90804
|
case 177 /* SetAccessor */:
|
|
90795
90805
|
case 173 /* MethodDeclaration */:
|
|
90796
|
-
return
|
|
90797
|
-
|
|
90798
|
-
void 0,
|
|
90806
|
+
return setCurrentClassElementAnd(
|
|
90807
|
+
node,
|
|
90799
90808
|
visitMethodOrAccessorDeclaration,
|
|
90800
90809
|
node
|
|
90801
90810
|
);
|
|
90802
90811
|
case 171 /* PropertyDeclaration */:
|
|
90803
|
-
return
|
|
90804
|
-
|
|
90805
|
-
void 0,
|
|
90812
|
+
return setCurrentClassElementAnd(
|
|
90813
|
+
node,
|
|
90806
90814
|
visitPropertyDeclaration,
|
|
90807
90815
|
node
|
|
90808
90816
|
);
|
|
90809
90817
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
90810
|
-
return
|
|
90818
|
+
return setCurrentClassElementAnd(
|
|
90819
|
+
node,
|
|
90820
|
+
visitClassStaticBlockDeclaration,
|
|
90821
|
+
node
|
|
90822
|
+
);
|
|
90811
90823
|
case 166 /* ComputedPropertyName */:
|
|
90812
90824
|
return visitComputedPropertyName(node);
|
|
90813
90825
|
case 239 /* SemicolonClassElement */:
|
|
@@ -91001,12 +91013,15 @@ ${lanes.join("\n")}
|
|
|
91001
91013
|
}
|
|
91002
91014
|
return void 0;
|
|
91003
91015
|
}
|
|
91004
|
-
function
|
|
91005
|
-
|
|
91006
|
-
|
|
91007
|
-
|
|
91008
|
-
|
|
91009
|
-
|
|
91016
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
91017
|
+
if (classElement !== currentClassElement) {
|
|
91018
|
+
const savedCurrentClassElement = currentClassElement;
|
|
91019
|
+
currentClassElement = classElement;
|
|
91020
|
+
const result = visitor2(arg);
|
|
91021
|
+
currentClassElement = savedCurrentClassElement;
|
|
91022
|
+
return result;
|
|
91023
|
+
}
|
|
91024
|
+
return visitor2(arg);
|
|
91010
91025
|
}
|
|
91011
91026
|
function getHoistedFunctionName(node) {
|
|
91012
91027
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -91168,8 +91183,21 @@ ${lanes.join("\n")}
|
|
|
91168
91183
|
}
|
|
91169
91184
|
return transformFieldInitializer(node);
|
|
91170
91185
|
}
|
|
91186
|
+
function shouldForceDynamicThis() {
|
|
91187
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
91188
|
+
}
|
|
91189
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
91190
|
+
if (shouldForceDynamicThis()) {
|
|
91191
|
+
const innerExpression = skipOuterExpressions(node);
|
|
91192
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
91193
|
+
noSubstitution.add(innerExpression);
|
|
91194
|
+
}
|
|
91195
|
+
}
|
|
91196
|
+
}
|
|
91171
91197
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
91172
|
-
|
|
91198
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
91199
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91200
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
91173
91201
|
}
|
|
91174
91202
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
91175
91203
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -91214,7 +91242,7 @@ ${lanes.join("\n")}
|
|
|
91214
91242
|
);
|
|
91215
91243
|
}
|
|
91216
91244
|
}
|
|
91217
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
91245
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91218
91246
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91219
91247
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91220
91248
|
return visitInvalidSuperProperty(node);
|
|
@@ -91233,7 +91261,7 @@ ${lanes.join("\n")}
|
|
|
91233
91261
|
return visitEachChild(node, visitor, context);
|
|
91234
91262
|
}
|
|
91235
91263
|
function visitElementAccessExpression(node) {
|
|
91236
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
91264
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91237
91265
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91238
91266
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91239
91267
|
return visitInvalidSuperProperty(node);
|
|
@@ -91258,6 +91286,7 @@ ${lanes.join("\n")}
|
|
|
91258
91286
|
let info;
|
|
91259
91287
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
91260
91288
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
91289
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91261
91290
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91262
91291
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
91263
91292
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -91276,7 +91305,7 @@ ${lanes.join("\n")}
|
|
|
91276
91305
|
}
|
|
91277
91306
|
return expression;
|
|
91278
91307
|
}
|
|
91279
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
91308
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91280
91309
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91281
91310
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91282
91311
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -91333,6 +91362,9 @@ ${lanes.join("\n")}
|
|
|
91333
91362
|
}
|
|
91334
91363
|
function createCopiableReceiverExpr(receiver) {
|
|
91335
91364
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
91365
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
91366
|
+
noSubstitution.add(clone2);
|
|
91367
|
+
}
|
|
91336
91368
|
if (isSimpleInlineableExpression(receiver)) {
|
|
91337
91369
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
91338
91370
|
}
|
|
@@ -91363,7 +91395,7 @@ ${lanes.join("\n")}
|
|
|
91363
91395
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
91364
91396
|
);
|
|
91365
91397
|
}
|
|
91366
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
91398
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91367
91399
|
const invocation = factory2.createFunctionCallCall(
|
|
91368
91400
|
visitNode(node.expression, visitor, isExpression),
|
|
91369
91401
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91392,7 +91424,7 @@ ${lanes.join("\n")}
|
|
|
91392
91424
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
91393
91425
|
);
|
|
91394
91426
|
}
|
|
91395
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
91427
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91396
91428
|
const invocation = factory2.createFunctionBindCall(
|
|
91397
91429
|
visitNode(node.tag, visitor, isExpression),
|
|
91398
91430
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91416,7 +91448,7 @@ ${lanes.join("\n")}
|
|
|
91416
91448
|
}
|
|
91417
91449
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
91418
91450
|
startLexicalEnvironment();
|
|
91419
|
-
let statements =
|
|
91451
|
+
let statements = setCurrentClassElementAnd(
|
|
91420
91452
|
node,
|
|
91421
91453
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
91422
91454
|
node.body.statements
|
|
@@ -91478,7 +91510,7 @@ ${lanes.join("\n")}
|
|
|
91478
91510
|
node
|
|
91479
91511
|
);
|
|
91480
91512
|
}
|
|
91481
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
91513
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91482
91514
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91483
91515
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91484
91516
|
return factory2.updateBinaryExpression(
|
|
@@ -91573,6 +91605,7 @@ ${lanes.join("\n")}
|
|
|
91573
91605
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
91574
91606
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
91575
91607
|
right = visitNode(right, visitor, isExpression);
|
|
91608
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91576
91609
|
if (isCompoundAssignment(operator)) {
|
|
91577
91610
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91578
91611
|
receiver = initializeExpression || readExpression;
|
|
@@ -92215,7 +92248,7 @@ ${lanes.join("\n")}
|
|
|
92215
92248
|
}
|
|
92216
92249
|
function transformProperty(property, receiver) {
|
|
92217
92250
|
var _a;
|
|
92218
|
-
const
|
|
92251
|
+
const savedCurrentClassElement = currentClassElement;
|
|
92219
92252
|
const transformed = transformPropertyWorker(property, receiver);
|
|
92220
92253
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
92221
92254
|
setOriginalNode(transformed, property);
|
|
@@ -92223,7 +92256,7 @@ ${lanes.join("\n")}
|
|
|
92223
92256
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
92224
92257
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
92225
92258
|
}
|
|
92226
|
-
|
|
92259
|
+
currentClassElement = savedCurrentClassElement;
|
|
92227
92260
|
return transformed;
|
|
92228
92261
|
}
|
|
92229
92262
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -92240,7 +92273,7 @@ ${lanes.join("\n")}
|
|
|
92240
92273
|
}
|
|
92241
92274
|
const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name;
|
|
92242
92275
|
if (hasStaticModifier(property)) {
|
|
92243
|
-
|
|
92276
|
+
currentClassElement = property;
|
|
92244
92277
|
}
|
|
92245
92278
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
92246
92279
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -92565,7 +92598,7 @@ ${lanes.join("\n")}
|
|
|
92565
92598
|
}
|
|
92566
92599
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
92567
92600
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
92568
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
92601
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92569
92602
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
92570
92603
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
92571
92604
|
return visitInvalidSuperProperty(node);
|
|
@@ -92745,7 +92778,7 @@ ${lanes.join("\n")}
|
|
|
92745
92778
|
return node;
|
|
92746
92779
|
}
|
|
92747
92780
|
function substituteThisExpression(node) {
|
|
92748
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92781
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
92749
92782
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
92750
92783
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
92751
92784
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -92814,6 +92847,12 @@ ${lanes.join("\n")}
|
|
|
92814
92847
|
function isPrivateIdentifierInExpression(node) {
|
|
92815
92848
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
92816
92849
|
}
|
|
92850
|
+
function isStaticPropertyDeclaration2(node) {
|
|
92851
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
92852
|
+
}
|
|
92853
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
92854
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
92855
|
+
}
|
|
92817
92856
|
var init_classFields = __esm({
|
|
92818
92857
|
"src/compiler/transformers/classFields.ts"() {
|
|
92819
92858
|
"use strict";
|
|
@@ -152540,8 +152579,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152540
152579
|
instanceTypes,
|
|
152541
152580
|
contextNode,
|
|
152542
152581
|
scriptTarget,
|
|
152543
|
-
/*
|
|
152544
|
-
void 0,
|
|
152582
|
+
1 /* NoTruncation */,
|
|
152545
152583
|
tracker
|
|
152546
152584
|
);
|
|
152547
152585
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230601`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230601",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "4c01b2f9ee6e65ff9a39e836a99b0b4959bce5fb"
|
|
117
117
|
}
|