typescript 5.3.0-dev.20231023 → 5.3.0-dev.20231025
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/lib.es2023.array.d.ts +11 -11
- package/lib/tsc.js +397 -227
- package/lib/tsserver.js +43297 -36992
- package/lib/typescript.d.ts +12 -0
- package/lib/typescript.js +10627 -8526
- package/lib/typingsInstaller.js +24 -5
- package/package.json +3 -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.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231025`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -18747,8 +18747,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18747
18747
|
ensureUseStrict,
|
|
18748
18748
|
liftToBlock,
|
|
18749
18749
|
mergeLexicalEnvironment,
|
|
18750
|
-
|
|
18751
|
-
|
|
18750
|
+
replaceModifiers,
|
|
18751
|
+
replaceDecoratorsAndModifiers,
|
|
18752
|
+
replacePropertyName
|
|
18752
18753
|
};
|
|
18753
18754
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
18754
18755
|
return factory2;
|
|
@@ -22256,7 +22257,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22256
22257
|
}
|
|
22257
22258
|
return statements;
|
|
22258
22259
|
}
|
|
22259
|
-
function
|
|
22260
|
+
function replaceModifiers(node, modifiers) {
|
|
22260
22261
|
let modifierArray;
|
|
22261
22262
|
if (typeof modifiers === "number") {
|
|
22262
22263
|
modifierArray = createModifiersFromModifierFlags(modifiers);
|
|
@@ -22265,9 +22266,27 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22265
22266
|
}
|
|
22266
22267
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node);
|
|
22267
22268
|
}
|
|
22268
|
-
function
|
|
22269
|
+
function replaceDecoratorsAndModifiers(node, modifierArray) {
|
|
22269
22270
|
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
22270
22271
|
}
|
|
22272
|
+
function replacePropertyName(node, name) {
|
|
22273
|
+
switch (node.kind) {
|
|
22274
|
+
case 177 /* GetAccessor */:
|
|
22275
|
+
return updateGetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.type, node.body);
|
|
22276
|
+
case 178 /* SetAccessor */:
|
|
22277
|
+
return updateSetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.body);
|
|
22278
|
+
case 174 /* MethodDeclaration */:
|
|
22279
|
+
return updateMethodDeclaration(node, node.modifiers, node.asteriskToken, name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
22280
|
+
case 173 /* MethodSignature */:
|
|
22281
|
+
return updateMethodSignature(node, node.modifiers, name, node.questionToken, node.typeParameters, node.parameters, node.type);
|
|
22282
|
+
case 172 /* PropertyDeclaration */:
|
|
22283
|
+
return updatePropertyDeclaration(node, node.modifiers, name, node.questionToken ?? node.exclamationToken, node.type, node.initializer);
|
|
22284
|
+
case 171 /* PropertySignature */:
|
|
22285
|
+
return updatePropertySignature(node, node.modifiers, name, node.questionToken, node.type);
|
|
22286
|
+
case 303 /* PropertyAssignment */:
|
|
22287
|
+
return updatePropertyAssignment(node, name, node.initializer);
|
|
22288
|
+
}
|
|
22289
|
+
}
|
|
22271
22290
|
function asNodeArray(array) {
|
|
22272
22291
|
return array ? createNodeArray(array) : void 0;
|
|
22273
22292
|
}
|
|
@@ -42728,10 +42747,10 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
42728
42747
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
42729
42748
|
}
|
|
42730
42749
|
}
|
|
42731
|
-
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName,
|
|
42732
|
-
if (typeof
|
|
42750
|
+
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports2, conditions, mode = 0 /* Exact */) {
|
|
42751
|
+
if (typeof exports2 === "string") {
|
|
42733
42752
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
42734
|
-
combinePaths(packageDirectory,
|
|
42753
|
+
combinePaths(packageDirectory, exports2),
|
|
42735
42754
|
/*currentDirectory*/
|
|
42736
42755
|
void 0
|
|
42737
42756
|
);
|
|
@@ -42751,7 +42770,7 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42751
42770
|
false
|
|
42752
42771
|
);
|
|
42753
42772
|
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
42754
|
-
combinePaths(combinePaths(packageName,
|
|
42773
|
+
combinePaths(combinePaths(packageName, exports2), fragment),
|
|
42755
42774
|
/*currentDirectory*/
|
|
42756
42775
|
void 0
|
|
42757
42776
|
) };
|
|
@@ -42771,23 +42790,23 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42771
42790
|
}
|
|
42772
42791
|
break;
|
|
42773
42792
|
}
|
|
42774
|
-
} else if (Array.isArray(
|
|
42775
|
-
return forEach(
|
|
42776
|
-
} else if (typeof
|
|
42777
|
-
if (allKeysStartWithDot(
|
|
42778
|
-
return forEach(getOwnKeys(
|
|
42793
|
+
} else if (Array.isArray(exports2)) {
|
|
42794
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
|
|
42795
|
+
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
42796
|
+
if (allKeysStartWithDot(exports2)) {
|
|
42797
|
+
return forEach(getOwnKeys(exports2), (k) => {
|
|
42779
42798
|
const subPackageName = getNormalizedAbsolutePath(
|
|
42780
42799
|
combinePaths(packageName, k),
|
|
42781
42800
|
/*currentDirectory*/
|
|
42782
42801
|
void 0
|
|
42783
42802
|
);
|
|
42784
42803
|
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42785
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName,
|
|
42804
|
+
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports2[k], conditions, mode2);
|
|
42786
42805
|
});
|
|
42787
42806
|
} else {
|
|
42788
|
-
for (const key of getOwnKeys(
|
|
42807
|
+
for (const key of getOwnKeys(exports2)) {
|
|
42789
42808
|
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42790
|
-
const subTarget =
|
|
42809
|
+
const subTarget = exports2[key];
|
|
42791
42810
|
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
42792
42811
|
if (result) {
|
|
42793
42812
|
return result;
|
|
@@ -45869,13 +45888,13 @@ function createTypeChecker(host) {
|
|
|
45869
45888
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
45870
45889
|
var _a, _b;
|
|
45871
45890
|
const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
|
|
45872
|
-
const
|
|
45891
|
+
const exports2 = moduleSymbol.exports;
|
|
45873
45892
|
if (localSymbol) {
|
|
45874
|
-
const exportedEqualsSymbol =
|
|
45893
|
+
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
|
|
45875
45894
|
if (exportedEqualsSymbol) {
|
|
45876
45895
|
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
45877
45896
|
} else {
|
|
45878
|
-
const exportedSymbol =
|
|
45897
|
+
const exportedSymbol = exports2 ? find(symbolsToArray(exports2), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
45879
45898
|
const diagnostic = exportedSymbol ? error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
|
|
45880
45899
|
if (localSymbol.declarations) {
|
|
45881
45900
|
addRelatedInfo(diagnostic, ...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName)));
|
|
@@ -46739,19 +46758,19 @@ function createTypeChecker(host) {
|
|
|
46739
46758
|
return symbolsToArray(getExportsOfModule(moduleSymbol));
|
|
46740
46759
|
}
|
|
46741
46760
|
function getExportsAndPropertiesOfModule(moduleSymbol) {
|
|
46742
|
-
const
|
|
46761
|
+
const exports2 = getExportsOfModuleAsArray(moduleSymbol);
|
|
46743
46762
|
const exportEquals = resolveExternalModuleSymbol(moduleSymbol);
|
|
46744
46763
|
if (exportEquals !== moduleSymbol) {
|
|
46745
46764
|
const type = getTypeOfSymbol(exportEquals);
|
|
46746
46765
|
if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
|
|
46747
|
-
addRange(
|
|
46766
|
+
addRange(exports2, getPropertiesOfType(type));
|
|
46748
46767
|
}
|
|
46749
46768
|
}
|
|
46750
|
-
return
|
|
46769
|
+
return exports2;
|
|
46751
46770
|
}
|
|
46752
46771
|
function forEachExportAndPropertyOfModule(moduleSymbol, cb) {
|
|
46753
|
-
const
|
|
46754
|
-
|
|
46772
|
+
const exports2 = getExportsOfModule(moduleSymbol);
|
|
46773
|
+
exports2.forEach((symbol, key) => {
|
|
46755
46774
|
if (!isReservedMemberName(key)) {
|
|
46756
46775
|
cb(symbol, key);
|
|
46757
46776
|
}
|
|
@@ -46794,8 +46813,8 @@ function createTypeChecker(host) {
|
|
|
46794
46813
|
function getExportsOfModule(moduleSymbol) {
|
|
46795
46814
|
const links = getSymbolLinks(moduleSymbol);
|
|
46796
46815
|
if (!links.resolvedExports) {
|
|
46797
|
-
const { exports, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
46798
|
-
links.resolvedExports =
|
|
46816
|
+
const { exports: exports2, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
46817
|
+
links.resolvedExports = exports2;
|
|
46799
46818
|
links.typeOnlyExportStarMap = typeOnlyExportStarMap;
|
|
46800
46819
|
}
|
|
46801
46820
|
return links.resolvedExports;
|
|
@@ -46829,12 +46848,12 @@ function createTypeChecker(host) {
|
|
|
46829
46848
|
let typeOnlyExportStarMap;
|
|
46830
46849
|
const nonTypeOnlyNames = /* @__PURE__ */ new Set();
|
|
46831
46850
|
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
46832
|
-
const
|
|
46851
|
+
const exports2 = visit(moduleSymbol) || emptySymbols;
|
|
46833
46852
|
if (typeOnlyExportStarMap) {
|
|
46834
46853
|
nonTypeOnlyNames.forEach((name) => typeOnlyExportStarMap.delete(name));
|
|
46835
46854
|
}
|
|
46836
46855
|
return {
|
|
46837
|
-
exports,
|
|
46856
|
+
exports: exports2,
|
|
46838
46857
|
typeOnlyExportStarMap
|
|
46839
46858
|
};
|
|
46840
46859
|
function visit(symbol, exportStar, isTypeOnly) {
|
|
@@ -47019,12 +47038,12 @@ function createTypeChecker(host) {
|
|
|
47019
47038
|
if (exportEquals && getSymbolIfSameReference(exportEquals, symbol)) {
|
|
47020
47039
|
return container;
|
|
47021
47040
|
}
|
|
47022
|
-
const
|
|
47023
|
-
const quick =
|
|
47041
|
+
const exports2 = getExportsOfSymbol(container);
|
|
47042
|
+
const quick = exports2.get(symbol.escapedName);
|
|
47024
47043
|
if (quick && getSymbolIfSameReference(quick, symbol)) {
|
|
47025
47044
|
return quick;
|
|
47026
47045
|
}
|
|
47027
|
-
return forEachEntry(
|
|
47046
|
+
return forEachEntry(exports2, (exported) => {
|
|
47028
47047
|
if (getSymbolIfSameReference(exported, symbol)) {
|
|
47029
47048
|
return exported;
|
|
47030
47049
|
}
|
|
@@ -49223,8 +49242,8 @@ function createTypeChecker(host) {
|
|
|
49223
49242
|
context.flags ^= 16777216 /* InInitialEntityName */;
|
|
49224
49243
|
} else {
|
|
49225
49244
|
if (parent && getExportsOfSymbol(parent)) {
|
|
49226
|
-
const
|
|
49227
|
-
forEachEntry(
|
|
49245
|
+
const exports2 = getExportsOfSymbol(parent);
|
|
49246
|
+
forEachEntry(exports2, (ex, name) => {
|
|
49228
49247
|
if (getSymbolIfSameReference(ex, symbol2) && !isLateBoundName(name) && name !== "export=" /* ExportEquals */) {
|
|
49229
49248
|
symbolName2 = unescapeLeadingUnderscores(name);
|
|
49230
49249
|
return true;
|
|
@@ -49848,8 +49867,8 @@ function createTypeChecker(host) {
|
|
|
49848
49867
|
return statements;
|
|
49849
49868
|
}
|
|
49850
49869
|
function mergeExportDeclarations(statements) {
|
|
49851
|
-
const
|
|
49852
|
-
if (length(
|
|
49870
|
+
const exports2 = filter(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49871
|
+
if (length(exports2) > 1) {
|
|
49853
49872
|
const nonExports = filter(statements, (d) => !isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause);
|
|
49854
49873
|
statements = [
|
|
49855
49874
|
...nonExports,
|
|
@@ -49858,7 +49877,7 @@ function createTypeChecker(host) {
|
|
|
49858
49877
|
void 0,
|
|
49859
49878
|
/*isTypeOnly*/
|
|
49860
49879
|
false,
|
|
49861
|
-
factory.createNamedExports(flatMap(
|
|
49880
|
+
factory.createNamedExports(flatMap(exports2, (e) => cast(e.exportClause, isNamedExports).elements)),
|
|
49862
49881
|
/*moduleSpecifier*/
|
|
49863
49882
|
void 0
|
|
49864
49883
|
)
|
|
@@ -49933,11 +49952,11 @@ function createTypeChecker(host) {
|
|
|
49933
49952
|
}
|
|
49934
49953
|
function addExportModifier(node) {
|
|
49935
49954
|
const flags = (getEffectiveModifierFlags(node) | 1 /* Export */) & ~2 /* Ambient */;
|
|
49936
|
-
return factory.
|
|
49955
|
+
return factory.replaceModifiers(node, flags);
|
|
49937
49956
|
}
|
|
49938
49957
|
function removeExportModifier(node) {
|
|
49939
49958
|
const flags = getEffectiveModifierFlags(node) & ~1 /* Export */;
|
|
49940
|
-
return factory.
|
|
49959
|
+
return factory.replaceModifiers(node, flags);
|
|
49941
49960
|
}
|
|
49942
49961
|
function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) {
|
|
49943
49962
|
if (!suppressNewPrivateContext) {
|
|
@@ -50178,7 +50197,7 @@ function createTypeChecker(host) {
|
|
|
50178
50197
|
newModifierFlags |= 1024 /* Default */;
|
|
50179
50198
|
}
|
|
50180
50199
|
if (newModifierFlags) {
|
|
50181
|
-
node = factory.
|
|
50200
|
+
node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
|
|
50182
50201
|
}
|
|
50183
50202
|
}
|
|
50184
50203
|
results.push(node);
|
|
@@ -50235,8 +50254,8 @@ function createTypeChecker(host) {
|
|
|
50235
50254
|
);
|
|
50236
50255
|
}
|
|
50237
50256
|
function getNamespaceMembersForSerialization(symbol) {
|
|
50238
|
-
const
|
|
50239
|
-
return !
|
|
50257
|
+
const exports2 = getExportsOfSymbol(symbol);
|
|
50258
|
+
return !exports2 ? [] : filter(arrayFrom(exports2.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
50240
50259
|
}
|
|
50241
50260
|
function isTypeOnlyNamespace(symbol) {
|
|
50242
50261
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -52038,19 +52057,19 @@ function createTypeChecker(host) {
|
|
|
52038
52057
|
if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) {
|
|
52039
52058
|
return void 0;
|
|
52040
52059
|
}
|
|
52041
|
-
const
|
|
52060
|
+
const exports2 = createSymbolTable();
|
|
52042
52061
|
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
|
|
52043
52062
|
const s2 = getSymbolOfNode(decl);
|
|
52044
52063
|
if ((_a = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a.size) {
|
|
52045
|
-
mergeSymbolTable(
|
|
52064
|
+
mergeSymbolTable(exports2, s2.exports);
|
|
52046
52065
|
}
|
|
52047
52066
|
decl = isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
|
|
52048
52067
|
}
|
|
52049
52068
|
const s = getSymbolOfNode(decl);
|
|
52050
52069
|
if ((_b = s == null ? void 0 : s.exports) == null ? void 0 : _b.size) {
|
|
52051
|
-
mergeSymbolTable(
|
|
52070
|
+
mergeSymbolTable(exports2, s.exports);
|
|
52052
52071
|
}
|
|
52053
|
-
const type = createAnonymousType(symbol,
|
|
52072
|
+
const type = createAnonymousType(symbol, exports2, emptyArray, emptyArray, emptyArray);
|
|
52054
52073
|
type.objectFlags |= 4096 /* JSLiteral */;
|
|
52055
52074
|
return type;
|
|
52056
52075
|
}
|
|
@@ -62732,6 +62751,9 @@ function createTypeChecker(host) {
|
|
|
62732
62751
|
}
|
|
62733
62752
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
62734
62753
|
if (depth >= maxDepth) {
|
|
62754
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
62755
|
+
type = getMappedTargetWithSymbol(type);
|
|
62756
|
+
}
|
|
62735
62757
|
if (type.flags & 2097152 /* Intersection */) {
|
|
62736
62758
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
62737
62759
|
}
|
|
@@ -62740,7 +62762,7 @@ function createTypeChecker(host) {
|
|
|
62740
62762
|
let lastTypeId = 0;
|
|
62741
62763
|
for (let i = 0; i < depth; i++) {
|
|
62742
62764
|
const t = stack[i];
|
|
62743
|
-
if (
|
|
62765
|
+
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
62744
62766
|
if (t.id >= lastTypeId) {
|
|
62745
62767
|
count++;
|
|
62746
62768
|
if (count >= maxDepth) {
|
|
@@ -62753,18 +62775,29 @@ function createTypeChecker(host) {
|
|
|
62753
62775
|
}
|
|
62754
62776
|
return false;
|
|
62755
62777
|
}
|
|
62778
|
+
function getMappedTargetWithSymbol(type) {
|
|
62779
|
+
let target;
|
|
62780
|
+
while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
|
|
62781
|
+
type = target;
|
|
62782
|
+
}
|
|
62783
|
+
return type;
|
|
62784
|
+
}
|
|
62785
|
+
function hasMatchingRecursionIdentity(type, identity2) {
|
|
62786
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
62787
|
+
type = getMappedTargetWithSymbol(type);
|
|
62788
|
+
}
|
|
62789
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
62790
|
+
return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
|
|
62791
|
+
}
|
|
62792
|
+
return getRecursionIdentity(type) === identity2;
|
|
62793
|
+
}
|
|
62756
62794
|
function getRecursionIdentity(type) {
|
|
62757
62795
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
62758
62796
|
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
62759
62797
|
return type.node;
|
|
62760
62798
|
}
|
|
62761
|
-
if (type.symbol) {
|
|
62762
|
-
|
|
62763
|
-
type = getMappedTargetWithSymbol(type);
|
|
62764
|
-
}
|
|
62765
|
-
if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
62766
|
-
return type.symbol;
|
|
62767
|
-
}
|
|
62799
|
+
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
62800
|
+
return type.symbol;
|
|
62768
62801
|
}
|
|
62769
62802
|
if (isTupleType(type)) {
|
|
62770
62803
|
return type.target;
|
|
@@ -62784,13 +62817,6 @@ function createTypeChecker(host) {
|
|
|
62784
62817
|
}
|
|
62785
62818
|
return type;
|
|
62786
62819
|
}
|
|
62787
|
-
function getMappedTargetWithSymbol(type) {
|
|
62788
|
-
let target = type;
|
|
62789
|
-
while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
|
|
62790
|
-
target = getModifiersTypeFromMappedType(target);
|
|
62791
|
-
}
|
|
62792
|
-
return target.symbol ? target : type;
|
|
62793
|
-
}
|
|
62794
62820
|
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
|
62795
62821
|
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
|
62796
62822
|
}
|
|
@@ -69008,8 +69034,8 @@ function createTypeChecker(host) {
|
|
|
69008
69034
|
}
|
|
69009
69035
|
function getJsxType(name, location) {
|
|
69010
69036
|
const namespace = getJsxNamespaceAt(location);
|
|
69011
|
-
const
|
|
69012
|
-
const typeSymbol =
|
|
69037
|
+
const exports2 = namespace && getExportsOfSymbol(namespace);
|
|
69038
|
+
const typeSymbol = exports2 && getSymbol(exports2, name, 788968 /* Type */);
|
|
69013
69039
|
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
|
|
69014
69040
|
}
|
|
69015
69041
|
function getIntrinsicTagSymbol(node) {
|
|
@@ -71833,8 +71859,8 @@ function createTypeChecker(host) {
|
|
|
71833
71859
|
}
|
|
71834
71860
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
71835
71861
|
const namespace = getJsxNamespaceAt(node);
|
|
71836
|
-
const
|
|
71837
|
-
const typeSymbol =
|
|
71862
|
+
const exports2 = namespace && getExportsOfSymbol(namespace);
|
|
71863
|
+
const typeSymbol = exports2 && getSymbol(exports2, JsxNames.Element, 788968 /* Type */);
|
|
71838
71864
|
const returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
|
|
71839
71865
|
const declaration = factory.createFunctionTypeNode(
|
|
71840
71866
|
/*typeParameters*/
|
|
@@ -80541,9 +80567,9 @@ function createTypeChecker(host) {
|
|
|
80541
80567
|
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
80542
80568
|
}
|
|
80543
80569
|
}
|
|
80544
|
-
const
|
|
80545
|
-
if (
|
|
80546
|
-
|
|
80570
|
+
const exports2 = getExportsOfModule(moduleSymbol);
|
|
80571
|
+
if (exports2) {
|
|
80572
|
+
exports2.forEach(({ declarations, flags }, id) => {
|
|
80547
80573
|
if (id === "__export") {
|
|
80548
80574
|
return;
|
|
80549
80575
|
}
|
|
@@ -82399,8 +82425,8 @@ function createTypeChecker(host) {
|
|
|
82399
82425
|
return false;
|
|
82400
82426
|
if (importTarget === file)
|
|
82401
82427
|
return false;
|
|
82402
|
-
const
|
|
82403
|
-
for (const s of arrayFrom(
|
|
82428
|
+
const exports2 = getExportsOfModule(file.symbol);
|
|
82429
|
+
for (const s of arrayFrom(exports2.values())) {
|
|
82404
82430
|
if (s.mergeId) {
|
|
82405
82431
|
const merged = getMergedSymbol(s);
|
|
82406
82432
|
if (merged.declarations) {
|
|
@@ -97995,7 +98021,7 @@ function transformES2015(context) {
|
|
|
97995
98021
|
hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 /* SubtreeFactsMask */ | ancestorFacts;
|
|
97996
98022
|
}
|
|
97997
98023
|
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
|
|
97998
|
-
return (hierarchyFacts & 8192 /*
|
|
98024
|
+
return (hierarchyFacts & 8192 /* ConstructorWithSuperCall */) !== 0 && node.kind === 253 /* ReturnStatement */ && !node.expression;
|
|
97999
98025
|
}
|
|
98000
98026
|
function isOrMayContainReturnCompletion(node) {
|
|
98001
98027
|
return node.transformFlags & 4194304 /* ContainsHoistedDeclarationOrCompletion */ && (isReturnStatement(node) || isIfStatement(node) || isWithStatement(node) || isSwitchStatement(node) || isCaseBlock(node) || isCaseClause(node) || isDefaultClause(node) || isTryStatement(node) || isCatchClause(node) || isLabeledStatement(node) || isIterationStatement(
|
|
@@ -98005,7 +98031,7 @@ function transformES2015(context) {
|
|
|
98005
98031
|
) || isBlock(node));
|
|
98006
98032
|
}
|
|
98007
98033
|
function shouldVisitNode(node) {
|
|
98008
|
-
return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /*
|
|
98034
|
+
return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /* ConstructorWithSuperCall */ && isOrMayContainReturnCompletion(node) || isIterationStatement(
|
|
98009
98035
|
node,
|
|
98010
98036
|
/*lookInLabeledStatements*/
|
|
98011
98037
|
false
|
|
@@ -98038,7 +98064,7 @@ function transformES2015(context) {
|
|
|
98038
98064
|
/*expressionResultIsUnused*/
|
|
98039
98065
|
false
|
|
98040
98066
|
);
|
|
98041
|
-
exitSubtree(ancestorFacts,
|
|
98067
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
98042
98068
|
return result;
|
|
98043
98069
|
}
|
|
98044
98070
|
return visitorWorker(
|
|
@@ -98052,6 +98078,7 @@ function transformES2015(context) {
|
|
|
98052
98078
|
function callExpressionVisitor(node) {
|
|
98053
98079
|
if (node.kind === 108 /* SuperKeyword */) {
|
|
98054
98080
|
return visitSuperKeyword(
|
|
98081
|
+
node,
|
|
98055
98082
|
/*isExpressionOfCall*/
|
|
98056
98083
|
true
|
|
98057
98084
|
);
|
|
@@ -98161,6 +98188,7 @@ function transformES2015(context) {
|
|
|
98161
98188
|
return visitSpreadElement(node);
|
|
98162
98189
|
case 108 /* SuperKeyword */:
|
|
98163
98190
|
return visitSuperKeyword(
|
|
98191
|
+
node,
|
|
98164
98192
|
/*isExpressionOfCall*/
|
|
98165
98193
|
false
|
|
98166
98194
|
);
|
|
@@ -98230,7 +98258,10 @@ function transformES2015(context) {
|
|
|
98230
98258
|
return updated;
|
|
98231
98259
|
}
|
|
98232
98260
|
function returnCapturedThis(node) {
|
|
98233
|
-
return setOriginalNode(factory2.createReturnStatement(
|
|
98261
|
+
return setOriginalNode(factory2.createReturnStatement(createCapturedThis()), node);
|
|
98262
|
+
}
|
|
98263
|
+
function createCapturedThis() {
|
|
98264
|
+
return factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
98234
98265
|
}
|
|
98235
98266
|
function visitReturnStatement(node) {
|
|
98236
98267
|
if (convertedLoopState) {
|
|
@@ -98254,8 +98285,9 @@ function transformES2015(context) {
|
|
|
98254
98285
|
return visitEachChild(node, visitor, context);
|
|
98255
98286
|
}
|
|
98256
98287
|
function visitThisKeyword(node) {
|
|
98288
|
+
hierarchyFacts |= 65536 /* LexicalThis */;
|
|
98257
98289
|
if (hierarchyFacts & 2 /* ArrowFunction */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
|
|
98258
|
-
hierarchyFacts |=
|
|
98290
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
98259
98291
|
}
|
|
98260
98292
|
if (convertedLoopState) {
|
|
98261
98293
|
if (hierarchyFacts & 2 /* ArrowFunction */) {
|
|
@@ -98394,7 +98426,7 @@ function transformES2015(context) {
|
|
|
98394
98426
|
void 0,
|
|
98395
98427
|
/*dotDotDotToken*/
|
|
98396
98428
|
void 0,
|
|
98397
|
-
|
|
98429
|
+
createSyntheticSuper()
|
|
98398
98430
|
)] : [],
|
|
98399
98431
|
/*type*/
|
|
98400
98432
|
void 0,
|
|
@@ -98484,7 +98516,7 @@ function transformES2015(context) {
|
|
|
98484
98516
|
setEmitFlags(constructorFunction, 16 /* CapturesThis */);
|
|
98485
98517
|
}
|
|
98486
98518
|
statements.push(constructorFunction);
|
|
98487
|
-
exitSubtree(ancestorFacts,
|
|
98519
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
98488
98520
|
convertedLoopState = savedConvertedLoopState;
|
|
98489
98521
|
}
|
|
98490
98522
|
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
|
|
@@ -98508,103 +98540,35 @@ function transformES2015(context) {
|
|
|
98508
98540
|
setEmitFlags(block, 3072 /* NoComments */);
|
|
98509
98541
|
return block;
|
|
98510
98542
|
}
|
|
98511
|
-
function transformConstructorBodyWorker(prologueOut, statementsOut, statementsIn, statementOffset, superPath, superPathDepth, constructor, isDerivedClass, hasSynthesizedSuper, isFirstStatement) {
|
|
98512
|
-
let mayReplaceThis = false;
|
|
98513
|
-
const superStatementIndex = superPathDepth < superPath.length ? superPath[superPathDepth] : -1;
|
|
98514
|
-
const leadingStatementsEnd = superStatementIndex >= 0 ? superStatementIndex : statementsIn.length;
|
|
98515
|
-
if (isFirstStatement && superStatementIndex >= 0) {
|
|
98516
|
-
let firstMaterialIndex = statementOffset;
|
|
98517
|
-
while (isFirstStatement && firstMaterialIndex < superStatementIndex) {
|
|
98518
|
-
const statement = constructor.body.statements[firstMaterialIndex];
|
|
98519
|
-
if (!isUninitializedVariableStatement(statement) && !isUsingDeclarationStateVariableStatement(statement))
|
|
98520
|
-
break;
|
|
98521
|
-
firstMaterialIndex++;
|
|
98522
|
-
}
|
|
98523
|
-
isFirstStatement = superStatementIndex === firstMaterialIndex;
|
|
98524
|
-
}
|
|
98525
|
-
addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, leadingStatementsEnd - statementOffset));
|
|
98526
|
-
const superStatement = superStatementIndex >= 0 ? statementsIn[superStatementIndex] : void 0;
|
|
98527
|
-
if (superStatement && isTryStatement(superStatement)) {
|
|
98528
|
-
const tryBlockStatements = [];
|
|
98529
|
-
mayReplaceThis = transformConstructorBodyWorker(
|
|
98530
|
-
prologueOut,
|
|
98531
|
-
tryBlockStatements,
|
|
98532
|
-
superStatement.tryBlock.statements,
|
|
98533
|
-
/*statementOffset*/
|
|
98534
|
-
0,
|
|
98535
|
-
superPath,
|
|
98536
|
-
superPathDepth + 1,
|
|
98537
|
-
constructor,
|
|
98538
|
-
isDerivedClass,
|
|
98539
|
-
hasSynthesizedSuper,
|
|
98540
|
-
isFirstStatement
|
|
98541
|
-
);
|
|
98542
|
-
const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements);
|
|
98543
|
-
setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements);
|
|
98544
|
-
statementsOut.push(factory2.updateTryStatement(
|
|
98545
|
-
superStatement,
|
|
98546
|
-
factory2.updateBlock(superStatement.tryBlock, tryBlockStatements),
|
|
98547
|
-
visitNode(superStatement.catchClause, visitor, isCatchClause),
|
|
98548
|
-
visitNode(superStatement.finallyBlock, visitor, isBlock)
|
|
98549
|
-
));
|
|
98550
|
-
} else {
|
|
98551
|
-
const superCall = superStatement && getSuperCallFromStatement(superStatement);
|
|
98552
|
-
let superCallExpression;
|
|
98553
|
-
if (hasSynthesizedSuper) {
|
|
98554
|
-
superCallExpression = createDefaultSuperCallOrThis();
|
|
98555
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
98556
|
-
} else if (superCall) {
|
|
98557
|
-
superCallExpression = visitSuperCallInBody(superCall);
|
|
98558
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
98559
|
-
}
|
|
98560
|
-
if (isDerivedClass || superCallExpression) {
|
|
98561
|
-
if (superCallExpression && superStatementIndex === statementsIn.length - 1 && !(constructor.body.transformFlags & 16384 /* ContainsLexicalThis */)) {
|
|
98562
|
-
const superCall2 = cast(cast(superCallExpression, isBinaryExpression).left, isCallExpression);
|
|
98563
|
-
const returnStatement = factory2.createReturnStatement(superCallExpression);
|
|
98564
|
-
setCommentRange(returnStatement, getCommentRange(superCall2));
|
|
98565
|
-
setEmitFlags(superCall2, 3072 /* NoComments */);
|
|
98566
|
-
statementsOut.push(returnStatement);
|
|
98567
|
-
return false;
|
|
98568
|
-
} else {
|
|
98569
|
-
if (isFirstStatement) {
|
|
98570
|
-
insertCaptureThisForNode(statementsOut, constructor, superCallExpression || createActualThis());
|
|
98571
|
-
} else {
|
|
98572
|
-
insertCaptureThisForNode(prologueOut, constructor, createActualThis());
|
|
98573
|
-
if (superCallExpression) {
|
|
98574
|
-
addSuperThisCaptureThisForNode(statementsOut, superCallExpression);
|
|
98575
|
-
}
|
|
98576
|
-
}
|
|
98577
|
-
mayReplaceThis = true;
|
|
98578
|
-
}
|
|
98579
|
-
} else {
|
|
98580
|
-
insertCaptureThisForNodeIfNeeded(prologueOut, constructor);
|
|
98581
|
-
}
|
|
98582
|
-
}
|
|
98583
|
-
if (superStatementIndex >= 0) {
|
|
98584
|
-
addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1));
|
|
98585
|
-
}
|
|
98586
|
-
return mayReplaceThis;
|
|
98587
|
-
}
|
|
98588
98543
|
function isUninitializedVariableStatement(node) {
|
|
98589
98544
|
return isVariableStatement(node) && every(node.declarationList.declarations, (decl) => isIdentifier(decl.name) && !decl.initializer);
|
|
98590
98545
|
}
|
|
98591
|
-
function
|
|
98592
|
-
if (
|
|
98593
|
-
return
|
|
98594
|
-
|
|
98595
|
-
if (!
|
|
98596
|
-
return false;
|
|
98597
|
-
const initializer = varDecl.initializer;
|
|
98598
|
-
if (!isObjectLiteralExpression(initializer) || initializer.properties.length !== 3)
|
|
98599
|
-
return false;
|
|
98600
|
-
const [stackProp, errorProp, hasErrorProp] = initializer.properties;
|
|
98601
|
-
if (!isPropertyAssignment(stackProp) || !isIdentifier(stackProp.name) || idText(stackProp.name) !== "stack" || !isArrayLiteralExpression(stackProp.initializer))
|
|
98602
|
-
return false;
|
|
98603
|
-
if (!isPropertyAssignment(errorProp) || !isIdentifier(errorProp.name) || idText(errorProp.name) !== "error" || !isVoidExpression(errorProp.initializer) || !isNumericLiteral(errorProp.initializer.expression))
|
|
98604
|
-
return false;
|
|
98605
|
-
if (!isPropertyAssignment(hasErrorProp) || !isIdentifier(hasErrorProp.name) || idText(hasErrorProp.name) !== "hasError" || hasErrorProp.initializer.kind !== 97 /* FalseKeyword */)
|
|
98546
|
+
function containsSuperCall(node) {
|
|
98547
|
+
if (isSuperCall(node)) {
|
|
98548
|
+
return true;
|
|
98549
|
+
}
|
|
98550
|
+
if (!(node.transformFlags & 134217728 /* ContainsLexicalSuper */)) {
|
|
98606
98551
|
return false;
|
|
98607
|
-
|
|
98552
|
+
}
|
|
98553
|
+
switch (node.kind) {
|
|
98554
|
+
case 219 /* ArrowFunction */:
|
|
98555
|
+
case 218 /* FunctionExpression */:
|
|
98556
|
+
case 262 /* FunctionDeclaration */:
|
|
98557
|
+
case 176 /* Constructor */:
|
|
98558
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
98559
|
+
return false;
|
|
98560
|
+
case 177 /* GetAccessor */:
|
|
98561
|
+
case 178 /* SetAccessor */:
|
|
98562
|
+
case 174 /* MethodDeclaration */:
|
|
98563
|
+
case 172 /* PropertyDeclaration */: {
|
|
98564
|
+
const named = node;
|
|
98565
|
+
if (isComputedPropertyName(named.name)) {
|
|
98566
|
+
return !!forEachChild(named.name, containsSuperCall);
|
|
98567
|
+
}
|
|
98568
|
+
return false;
|
|
98569
|
+
}
|
|
98570
|
+
}
|
|
98571
|
+
return !!forEachChild(node, containsSuperCall);
|
|
98608
98572
|
}
|
|
98609
98573
|
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
|
|
98610
98574
|
const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */;
|
|
@@ -98619,31 +98583,22 @@ function transformES2015(context) {
|
|
|
98619
98583
|
/*statementOffset*/
|
|
98620
98584
|
0
|
|
98621
98585
|
);
|
|
98622
|
-
|
|
98623
|
-
|
|
98624
|
-
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
98586
|
+
if (hasSynthesizedSuper || containsSuperCall(constructor.body)) {
|
|
98587
|
+
hierarchyFacts |= 8192 /* ConstructorWithSuperCall */;
|
|
98625
98588
|
}
|
|
98626
|
-
|
|
98627
|
-
|
|
98628
|
-
statements,
|
|
98629
|
-
constructor.body.statements,
|
|
98630
|
-
standardPrologueEnd,
|
|
98631
|
-
superStatementIndices,
|
|
98632
|
-
/*superPathDepth*/
|
|
98633
|
-
0,
|
|
98634
|
-
constructor,
|
|
98635
|
-
isDerivedClass,
|
|
98636
|
-
hasSynthesizedSuper,
|
|
98637
|
-
/*isFirstStatement*/
|
|
98638
|
-
true
|
|
98639
|
-
// NOTE: this will be recalculated inside of transformConstructorBodyWorker
|
|
98640
|
-
);
|
|
98589
|
+
addRange(statements, visitNodes2(constructor.body.statements, visitor, isStatement, standardPrologueEnd));
|
|
98590
|
+
const mayReplaceThis = isDerivedClass || hierarchyFacts & 8192 /* ConstructorWithSuperCall */;
|
|
98641
98591
|
addDefaultValueAssignmentsIfNeeded2(prologue, constructor);
|
|
98642
98592
|
addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
|
|
98643
98593
|
insertCaptureNewTargetIfNeeded(prologue, constructor);
|
|
98594
|
+
if (mayReplaceThis) {
|
|
98595
|
+
insertCaptureThisForNode(prologue, constructor, createActualThis());
|
|
98596
|
+
} else {
|
|
98597
|
+
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98598
|
+
}
|
|
98644
98599
|
factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
|
|
98645
98600
|
if (mayReplaceThis && !isSufficientlyCoveredByReturnStatements(constructor.body)) {
|
|
98646
|
-
statements.push(factory2.createReturnStatement(
|
|
98601
|
+
statements.push(factory2.createReturnStatement(createCapturedThis()));
|
|
98647
98602
|
}
|
|
98648
98603
|
const body = factory2.createBlock(
|
|
98649
98604
|
setTextRange(
|
|
@@ -98660,6 +98615,230 @@ function transformES2015(context) {
|
|
|
98660
98615
|
true
|
|
98661
98616
|
);
|
|
98662
98617
|
setTextRange(body, constructor.body);
|
|
98618
|
+
return simplifyConstructor(body, constructor.body, hasSynthesizedSuper);
|
|
98619
|
+
}
|
|
98620
|
+
function isCapturedThis(node) {
|
|
98621
|
+
return isGeneratedIdentifier(node) && idText(node) === "_this";
|
|
98622
|
+
}
|
|
98623
|
+
function isSyntheticSuper(node) {
|
|
98624
|
+
return isGeneratedIdentifier(node) && idText(node) === "_super";
|
|
98625
|
+
}
|
|
98626
|
+
function isThisCapturingVariableStatement(node) {
|
|
98627
|
+
return isVariableStatement(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]);
|
|
98628
|
+
}
|
|
98629
|
+
function isThisCapturingVariableDeclaration(node) {
|
|
98630
|
+
return isVariableDeclaration(node) && isCapturedThis(node.name) && !!node.initializer;
|
|
98631
|
+
}
|
|
98632
|
+
function isThisCapturingAssignment(node) {
|
|
98633
|
+
return isAssignmentExpression(
|
|
98634
|
+
node,
|
|
98635
|
+
/*excludeCompoundAssignment*/
|
|
98636
|
+
true
|
|
98637
|
+
) && isCapturedThis(node.left);
|
|
98638
|
+
}
|
|
98639
|
+
function isTransformedSuperCall(node) {
|
|
98640
|
+
return isCallExpression(node) && isPropertyAccessExpression(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier(node.expression.name) && (idText(node.expression.name) === "call" || idText(node.expression.name) === "apply") && node.arguments.length >= 1 && node.arguments[0].kind === 110 /* ThisKeyword */;
|
|
98641
|
+
}
|
|
98642
|
+
function isTransformedSuperCallWithFallback(node) {
|
|
98643
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isTransformedSuperCall(node.left);
|
|
98644
|
+
}
|
|
98645
|
+
function isImplicitSuperCall(node) {
|
|
98646
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && isBinaryExpression(node.left) && node.left.operatorToken.kind === 38 /* ExclamationEqualsEqualsToken */ && isSyntheticSuper(node.left.left) && node.left.right.kind === 106 /* NullKeyword */ && isTransformedSuperCall(node.right) && idText(node.right.expression.name) === "apply";
|
|
98647
|
+
}
|
|
98648
|
+
function isImplicitSuperCallWithFallback(node) {
|
|
98649
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isImplicitSuperCall(node.left);
|
|
98650
|
+
}
|
|
98651
|
+
function isThisCapturingTransformedSuperCallWithFallback(node) {
|
|
98652
|
+
return isThisCapturingAssignment(node) && isTransformedSuperCallWithFallback(node.right);
|
|
98653
|
+
}
|
|
98654
|
+
function isThisCapturingImplicitSuperCallWithFallback(node) {
|
|
98655
|
+
return isThisCapturingAssignment(node) && isImplicitSuperCallWithFallback(node.right);
|
|
98656
|
+
}
|
|
98657
|
+
function isTransformedSuperCallLike(node) {
|
|
98658
|
+
return isTransformedSuperCall(node) || isTransformedSuperCallWithFallback(node) || isThisCapturingTransformedSuperCallWithFallback(node) || isImplicitSuperCall(node) || isImplicitSuperCallWithFallback(node) || isThisCapturingImplicitSuperCallWithFallback(node);
|
|
98659
|
+
}
|
|
98660
|
+
function simplifyConstructorInlineSuperInThisCaptureVariable(body) {
|
|
98661
|
+
for (let i = 0; i < body.statements.length - 1; i++) {
|
|
98662
|
+
const statement = body.statements[i];
|
|
98663
|
+
if (!isThisCapturingVariableStatement(statement)) {
|
|
98664
|
+
continue;
|
|
98665
|
+
}
|
|
98666
|
+
const varDecl = statement.declarationList.declarations[0];
|
|
98667
|
+
if (varDecl.initializer.kind !== 110 /* ThisKeyword */) {
|
|
98668
|
+
continue;
|
|
98669
|
+
}
|
|
98670
|
+
const thisCaptureStatementIndex = i;
|
|
98671
|
+
let superCallIndex = i + 1;
|
|
98672
|
+
while (superCallIndex < body.statements.length) {
|
|
98673
|
+
const statement2 = body.statements[superCallIndex];
|
|
98674
|
+
if (isExpressionStatement(statement2)) {
|
|
98675
|
+
if (isTransformedSuperCallLike(skipOuterExpressions(statement2.expression))) {
|
|
98676
|
+
break;
|
|
98677
|
+
}
|
|
98678
|
+
}
|
|
98679
|
+
if (isUninitializedVariableStatement(statement2)) {
|
|
98680
|
+
superCallIndex++;
|
|
98681
|
+
continue;
|
|
98682
|
+
}
|
|
98683
|
+
return body;
|
|
98684
|
+
}
|
|
98685
|
+
const following = body.statements[superCallIndex];
|
|
98686
|
+
let expression = following.expression;
|
|
98687
|
+
if (isThisCapturingAssignment(expression)) {
|
|
98688
|
+
expression = expression.right;
|
|
98689
|
+
}
|
|
98690
|
+
const newVarDecl = factory2.updateVariableDeclaration(
|
|
98691
|
+
varDecl,
|
|
98692
|
+
varDecl.name,
|
|
98693
|
+
/*exclamationToken*/
|
|
98694
|
+
void 0,
|
|
98695
|
+
/*type*/
|
|
98696
|
+
void 0,
|
|
98697
|
+
expression
|
|
98698
|
+
);
|
|
98699
|
+
const newDeclList = factory2.updateVariableDeclarationList(statement.declarationList, [newVarDecl]);
|
|
98700
|
+
const newVarStatement = factory2.createVariableStatement(statement.modifiers, newDeclList);
|
|
98701
|
+
setOriginalNode(newVarStatement, following);
|
|
98702
|
+
setTextRange(newVarStatement, following);
|
|
98703
|
+
const newStatements = factory2.createNodeArray([
|
|
98704
|
+
...body.statements.slice(0, thisCaptureStatementIndex),
|
|
98705
|
+
// copy statements preceding to `var _this`
|
|
98706
|
+
...body.statements.slice(thisCaptureStatementIndex + 1, superCallIndex),
|
|
98707
|
+
// copy intervening temp variables
|
|
98708
|
+
newVarStatement,
|
|
98709
|
+
...body.statements.slice(superCallIndex + 1)
|
|
98710
|
+
// copy statements following `super.call(this, ...)`
|
|
98711
|
+
]);
|
|
98712
|
+
setTextRange(newStatements, body.statements);
|
|
98713
|
+
return factory2.updateBlock(body, newStatements);
|
|
98714
|
+
}
|
|
98715
|
+
return body;
|
|
98716
|
+
}
|
|
98717
|
+
function simplifyConstructorInlineSuperReturn(body, original) {
|
|
98718
|
+
for (const statement of original.statements) {
|
|
98719
|
+
if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
|
|
98720
|
+
return body;
|
|
98721
|
+
}
|
|
98722
|
+
}
|
|
98723
|
+
const canElideThisCapturingVariable = !(original.transformFlags & 16384 /* ContainsLexicalThis */) && !(hierarchyFacts & 65536 /* LexicalThis */) && !(hierarchyFacts & 131072 /* CapturedLexicalThis */);
|
|
98724
|
+
for (let i = body.statements.length - 1; i > 0; i--) {
|
|
98725
|
+
const statement = body.statements[i];
|
|
98726
|
+
if (isReturnStatement(statement) && statement.expression && isCapturedThis(statement.expression)) {
|
|
98727
|
+
const preceding = body.statements[i - 1];
|
|
98728
|
+
let expression;
|
|
98729
|
+
if (isExpressionStatement(preceding) && isThisCapturingTransformedSuperCallWithFallback(skipOuterExpressions(preceding.expression))) {
|
|
98730
|
+
expression = preceding.expression;
|
|
98731
|
+
} else if (canElideThisCapturingVariable && isThisCapturingVariableStatement(preceding)) {
|
|
98732
|
+
const varDecl = preceding.declarationList.declarations[0];
|
|
98733
|
+
if (isTransformedSuperCallLike(skipOuterExpressions(varDecl.initializer))) {
|
|
98734
|
+
expression = factory2.createAssignment(
|
|
98735
|
+
createCapturedThis(),
|
|
98736
|
+
varDecl.initializer
|
|
98737
|
+
);
|
|
98738
|
+
}
|
|
98739
|
+
}
|
|
98740
|
+
if (!expression) {
|
|
98741
|
+
break;
|
|
98742
|
+
}
|
|
98743
|
+
const newReturnStatement = factory2.createReturnStatement(expression);
|
|
98744
|
+
setOriginalNode(newReturnStatement, preceding);
|
|
98745
|
+
setTextRange(newReturnStatement, preceding);
|
|
98746
|
+
const newStatements = factory2.createNodeArray([
|
|
98747
|
+
...body.statements.slice(0, i - 1),
|
|
98748
|
+
// copy all statements preceding `_super.call(this, ...)`
|
|
98749
|
+
newReturnStatement,
|
|
98750
|
+
...body.statements.slice(i + 1)
|
|
98751
|
+
// copy all statements following `return _this;`
|
|
98752
|
+
]);
|
|
98753
|
+
setTextRange(newStatements, body.statements);
|
|
98754
|
+
return factory2.updateBlock(body, newStatements);
|
|
98755
|
+
}
|
|
98756
|
+
}
|
|
98757
|
+
return body;
|
|
98758
|
+
}
|
|
98759
|
+
function elideUnusedThisCaptureWorker(node) {
|
|
98760
|
+
if (isThisCapturingVariableStatement(node)) {
|
|
98761
|
+
const varDecl = node.declarationList.declarations[0];
|
|
98762
|
+
if (varDecl.initializer.kind === 110 /* ThisKeyword */) {
|
|
98763
|
+
return void 0;
|
|
98764
|
+
}
|
|
98765
|
+
} else if (isThisCapturingAssignment(node)) {
|
|
98766
|
+
return factory2.createPartiallyEmittedExpression(node.right, node);
|
|
98767
|
+
}
|
|
98768
|
+
switch (node.kind) {
|
|
98769
|
+
case 219 /* ArrowFunction */:
|
|
98770
|
+
case 218 /* FunctionExpression */:
|
|
98771
|
+
case 262 /* FunctionDeclaration */:
|
|
98772
|
+
case 176 /* Constructor */:
|
|
98773
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
98774
|
+
return node;
|
|
98775
|
+
case 177 /* GetAccessor */:
|
|
98776
|
+
case 178 /* SetAccessor */:
|
|
98777
|
+
case 174 /* MethodDeclaration */:
|
|
98778
|
+
case 172 /* PropertyDeclaration */: {
|
|
98779
|
+
const named = node;
|
|
98780
|
+
if (isComputedPropertyName(named.name)) {
|
|
98781
|
+
return factory2.replacePropertyName(named, visitEachChild(named.name, elideUnusedThisCaptureWorker, nullTransformationContext));
|
|
98782
|
+
}
|
|
98783
|
+
return node;
|
|
98784
|
+
}
|
|
98785
|
+
}
|
|
98786
|
+
return visitEachChild(node, elideUnusedThisCaptureWorker, nullTransformationContext);
|
|
98787
|
+
}
|
|
98788
|
+
function simplifyConstructorElideUnusedThisCapture(body, original) {
|
|
98789
|
+
if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
|
|
98790
|
+
return body;
|
|
98791
|
+
}
|
|
98792
|
+
for (const statement of original.statements) {
|
|
98793
|
+
if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
|
|
98794
|
+
return body;
|
|
98795
|
+
}
|
|
98796
|
+
}
|
|
98797
|
+
return factory2.updateBlock(body, visitNodes2(body.statements, elideUnusedThisCaptureWorker, isStatement));
|
|
98798
|
+
}
|
|
98799
|
+
function injectSuperPresenceCheckWorker(node) {
|
|
98800
|
+
if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier(node.arguments[1]) && idText(node.arguments[1]) === "arguments") {
|
|
98801
|
+
return factory2.createLogicalAnd(
|
|
98802
|
+
factory2.createStrictInequality(
|
|
98803
|
+
createSyntheticSuper(),
|
|
98804
|
+
factory2.createNull()
|
|
98805
|
+
),
|
|
98806
|
+
node
|
|
98807
|
+
);
|
|
98808
|
+
}
|
|
98809
|
+
switch (node.kind) {
|
|
98810
|
+
case 219 /* ArrowFunction */:
|
|
98811
|
+
case 218 /* FunctionExpression */:
|
|
98812
|
+
case 262 /* FunctionDeclaration */:
|
|
98813
|
+
case 176 /* Constructor */:
|
|
98814
|
+
case 175 /* ClassStaticBlockDeclaration */:
|
|
98815
|
+
return node;
|
|
98816
|
+
case 177 /* GetAccessor */:
|
|
98817
|
+
case 178 /* SetAccessor */:
|
|
98818
|
+
case 174 /* MethodDeclaration */:
|
|
98819
|
+
case 172 /* PropertyDeclaration */: {
|
|
98820
|
+
const named = node;
|
|
98821
|
+
if (isComputedPropertyName(named.name)) {
|
|
98822
|
+
return factory2.replacePropertyName(named, visitEachChild(named.name, injectSuperPresenceCheckWorker, nullTransformationContext));
|
|
98823
|
+
}
|
|
98824
|
+
return node;
|
|
98825
|
+
}
|
|
98826
|
+
}
|
|
98827
|
+
return visitEachChild(node, injectSuperPresenceCheckWorker, nullTransformationContext);
|
|
98828
|
+
}
|
|
98829
|
+
function complicateConstructorInjectSuperPresenceCheck(body) {
|
|
98830
|
+
return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
|
|
98831
|
+
}
|
|
98832
|
+
function simplifyConstructor(body, original, hasSynthesizedSuper) {
|
|
98833
|
+
const inputBody = body;
|
|
98834
|
+
body = simplifyConstructorInlineSuperInThisCaptureVariable(body);
|
|
98835
|
+
body = simplifyConstructorInlineSuperReturn(body, original);
|
|
98836
|
+
if (body !== inputBody) {
|
|
98837
|
+
body = simplifyConstructorElideUnusedThisCapture(body, original);
|
|
98838
|
+
}
|
|
98839
|
+
if (hasSynthesizedSuper) {
|
|
98840
|
+
body = complicateConstructorInjectSuperPresenceCheck(body);
|
|
98841
|
+
}
|
|
98663
98842
|
return body;
|
|
98664
98843
|
}
|
|
98665
98844
|
function isSufficientlyCoveredByReturnStatements(statement) {
|
|
@@ -98685,11 +98864,11 @@ function transformES2015(context) {
|
|
|
98685
98864
|
return factory2.createLogicalOr(
|
|
98686
98865
|
factory2.createLogicalAnd(
|
|
98687
98866
|
factory2.createStrictInequality(
|
|
98688
|
-
|
|
98867
|
+
createSyntheticSuper(),
|
|
98689
98868
|
factory2.createNull()
|
|
98690
98869
|
),
|
|
98691
98870
|
factory2.createFunctionApplyCall(
|
|
98692
|
-
|
|
98871
|
+
createSyntheticSuper(),
|
|
98693
98872
|
createActualThis(),
|
|
98694
98873
|
factory2.createIdentifier("arguments")
|
|
98695
98874
|
)
|
|
@@ -98944,24 +99123,12 @@ function transformES2015(context) {
|
|
|
98944
99123
|
return true;
|
|
98945
99124
|
}
|
|
98946
99125
|
function insertCaptureThisForNodeIfNeeded(statements, node) {
|
|
98947
|
-
if (hierarchyFacts &
|
|
99126
|
+
if (hierarchyFacts & 131072 /* CapturedLexicalThis */ && node.kind !== 219 /* ArrowFunction */) {
|
|
98948
99127
|
insertCaptureThisForNode(statements, node, factory2.createThis());
|
|
98949
99128
|
return true;
|
|
98950
99129
|
}
|
|
98951
99130
|
return false;
|
|
98952
99131
|
}
|
|
98953
|
-
function addSuperThisCaptureThisForNode(statements, superExpression) {
|
|
98954
|
-
enableSubstitutionsForCapturedThis();
|
|
98955
|
-
const assignSuperExpression = factory2.createExpressionStatement(
|
|
98956
|
-
factory2.createBinaryExpression(
|
|
98957
|
-
factory2.createThis(),
|
|
98958
|
-
64 /* EqualsToken */,
|
|
98959
|
-
superExpression
|
|
98960
|
-
)
|
|
98961
|
-
);
|
|
98962
|
-
statements.push(assignSuperExpression);
|
|
98963
|
-
setCommentRange(assignSuperExpression, getOriginalNode(superExpression).parent);
|
|
98964
|
-
}
|
|
98965
99132
|
function insertCaptureThisForNode(statements, node, initializer) {
|
|
98966
99133
|
enableSubstitutionsForCapturedThis();
|
|
98967
99134
|
const captureThisStatement = factory2.createVariableStatement(
|
|
@@ -98969,7 +99136,7 @@ function transformES2015(context) {
|
|
|
98969
99136
|
void 0,
|
|
98970
99137
|
factory2.createVariableDeclarationList([
|
|
98971
99138
|
factory2.createVariableDeclaration(
|
|
98972
|
-
|
|
99139
|
+
createCapturedThis(),
|
|
98973
99140
|
/*exclamationToken*/
|
|
98974
99141
|
void 0,
|
|
98975
99142
|
/*type*/
|
|
@@ -99190,7 +99357,7 @@ function transformES2015(context) {
|
|
|
99190
99357
|
}
|
|
99191
99358
|
function visitArrowFunction(node) {
|
|
99192
99359
|
if (node.transformFlags & 16384 /* ContainsLexicalThis */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
|
|
99193
|
-
hierarchyFacts |=
|
|
99360
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
99194
99361
|
}
|
|
99195
99362
|
const savedConvertedLoopState = convertedLoopState;
|
|
99196
99363
|
convertedLoopState = void 0;
|
|
@@ -99223,7 +99390,7 @@ function transformES2015(context) {
|
|
|
99223
99390
|
const parameters = visitParameterList(node.parameters, visitor, context);
|
|
99224
99391
|
const body = transformFunctionBody(node);
|
|
99225
99392
|
const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
|
|
99226
|
-
exitSubtree(ancestorFacts,
|
|
99393
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
99227
99394
|
convertedLoopState = savedConvertedLoopState;
|
|
99228
99395
|
return factory2.updateFunctionExpression(
|
|
99229
99396
|
node,
|
|
@@ -99246,7 +99413,7 @@ function transformES2015(context) {
|
|
|
99246
99413
|
const parameters = visitParameterList(node.parameters, visitor, context);
|
|
99247
99414
|
const body = transformFunctionBody(node);
|
|
99248
99415
|
const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
|
|
99249
|
-
exitSubtree(ancestorFacts,
|
|
99416
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
99250
99417
|
convertedLoopState = savedConvertedLoopState;
|
|
99251
99418
|
return factory2.updateFunctionDeclaration(
|
|
99252
99419
|
node,
|
|
@@ -99270,7 +99437,7 @@ function transformES2015(context) {
|
|
|
99270
99437
|
if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
99271
99438
|
name = factory2.getGeneratedNameForNode(node);
|
|
99272
99439
|
}
|
|
99273
|
-
exitSubtree(ancestorFacts,
|
|
99440
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
99274
99441
|
convertedLoopState = savedConvertedLoopState;
|
|
99275
99442
|
return setOriginalNode(
|
|
99276
99443
|
setTextRange(
|
|
@@ -100679,7 +100846,7 @@ function transformES2015(context) {
|
|
|
100679
100846
|
} else {
|
|
100680
100847
|
updated = factory2.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body);
|
|
100681
100848
|
}
|
|
100682
|
-
exitSubtree(ancestorFacts,
|
|
100849
|
+
exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
|
|
100683
100850
|
convertedLoopState = savedConvertedLoopState;
|
|
100684
100851
|
return updated;
|
|
100685
100852
|
}
|
|
@@ -100829,13 +100996,6 @@ function transformES2015(context) {
|
|
|
100829
100996
|
)
|
|
100830
100997
|
);
|
|
100831
100998
|
}
|
|
100832
|
-
function visitSuperCallInBody(node) {
|
|
100833
|
-
return visitCallExpressionWithPotentialCapturedThisAssignment(
|
|
100834
|
-
node,
|
|
100835
|
-
/*assignToCapturedThis*/
|
|
100836
|
-
false
|
|
100837
|
-
);
|
|
100838
|
-
}
|
|
100839
100999
|
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
|
|
100840
101000
|
if (node.transformFlags & 32768 /* ContainsRestOrSpread */ || node.expression.kind === 108 /* SuperKeyword */ || isSuperProperty(skipOuterExpressions(node.expression))) {
|
|
100841
101001
|
const { target, thisArg } = factory2.createCallBinding(node.expression, hoistVariableDeclaration);
|
|
@@ -100872,10 +101032,13 @@ function transformES2015(context) {
|
|
|
100872
101032
|
resultingCall,
|
|
100873
101033
|
createActualThis()
|
|
100874
101034
|
);
|
|
100875
|
-
resultingCall = assignToCapturedThis ? factory2.createAssignment(
|
|
101035
|
+
resultingCall = assignToCapturedThis ? factory2.createAssignment(createCapturedThis(), initializer) : initializer;
|
|
100876
101036
|
}
|
|
100877
101037
|
return setOriginalNode(resultingCall, node);
|
|
100878
101038
|
}
|
|
101039
|
+
if (isSuperCall(node)) {
|
|
101040
|
+
hierarchyFacts |= 131072 /* CapturedLexicalThis */;
|
|
101041
|
+
}
|
|
100879
101042
|
return visitEachChild(node, visitor, context);
|
|
100880
101043
|
}
|
|
100881
101044
|
function visitNewExpression(node) {
|
|
@@ -101002,8 +101165,15 @@ function transformES2015(context) {
|
|
|
101002
101165
|
}
|
|
101003
101166
|
return setTextRange(expression, node);
|
|
101004
101167
|
}
|
|
101005
|
-
function
|
|
101006
|
-
return
|
|
101168
|
+
function createSyntheticSuper() {
|
|
101169
|
+
return factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
101170
|
+
}
|
|
101171
|
+
function visitSuperKeyword(node, isExpressionOfCall) {
|
|
101172
|
+
const expression = hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall ? factory2.createPropertyAccessExpression(setOriginalNode(createSyntheticSuper(), node), "prototype") : createSyntheticSuper();
|
|
101173
|
+
setOriginalNode(expression, node);
|
|
101174
|
+
setCommentRange(expression, node);
|
|
101175
|
+
setSourceMapRange(expression, node);
|
|
101176
|
+
return expression;
|
|
101007
101177
|
}
|
|
101008
101178
|
function visitMetaProperty(node) {
|
|
101009
101179
|
if (node.keywordToken === 105 /* NewKeyword */ && node.name.escapedText === "target") {
|
|
@@ -101109,7 +101279,7 @@ function transformES2015(context) {
|
|
|
101109
101279
|
}
|
|
101110
101280
|
function substituteThisKeyword(node) {
|
|
101111
101281
|
if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) {
|
|
101112
|
-
return setTextRange(
|
|
101282
|
+
return setTextRange(createCapturedThis(), node);
|
|
101113
101283
|
}
|
|
101114
101284
|
return node;
|
|
101115
101285
|
}
|
|
@@ -105398,7 +105568,7 @@ function transformSystemModule(context) {
|
|
|
105398
105568
|
const exportStarFunction = factory2.createUniqueName("exportStar");
|
|
105399
105569
|
const m = factory2.createIdentifier("m");
|
|
105400
105570
|
const n = factory2.createIdentifier("n");
|
|
105401
|
-
const
|
|
105571
|
+
const exports2 = factory2.createIdentifier("exports");
|
|
105402
105572
|
let condition = factory2.createStrictInequality(n, factory2.createStringLiteral("default"));
|
|
105403
105573
|
if (localNames) {
|
|
105404
105574
|
condition = factory2.createLogicalAnd(
|
|
@@ -105437,7 +105607,7 @@ function transformSystemModule(context) {
|
|
|
105437
105607
|
void 0,
|
|
105438
105608
|
factory2.createVariableDeclarationList([
|
|
105439
105609
|
factory2.createVariableDeclaration(
|
|
105440
|
-
|
|
105610
|
+
exports2,
|
|
105441
105611
|
/*exclamationToken*/
|
|
105442
105612
|
void 0,
|
|
105443
105613
|
/*type*/
|
|
@@ -105457,7 +105627,7 @@ function transformSystemModule(context) {
|
|
|
105457
105627
|
condition,
|
|
105458
105628
|
factory2.createExpressionStatement(
|
|
105459
105629
|
factory2.createAssignment(
|
|
105460
|
-
factory2.createElementAccessExpression(
|
|
105630
|
+
factory2.createElementAccessExpression(exports2, n),
|
|
105461
105631
|
factory2.createElementAccessExpression(m, n)
|
|
105462
105632
|
)
|
|
105463
105633
|
)
|
|
@@ -105471,7 +105641,7 @@ function transformSystemModule(context) {
|
|
|
105471
105641
|
exportFunction,
|
|
105472
105642
|
/*typeArguments*/
|
|
105473
105643
|
void 0,
|
|
105474
|
-
[
|
|
105644
|
+
[exports2]
|
|
105475
105645
|
)
|
|
105476
105646
|
)
|
|
105477
105647
|
],
|
|
@@ -108207,7 +108377,7 @@ function transformDeclarations(context) {
|
|
|
108207
108377
|
return statement;
|
|
108208
108378
|
}
|
|
108209
108379
|
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
|
|
108210
|
-
return factory2.
|
|
108380
|
+
return factory2.replaceModifiers(statement, modifiers);
|
|
108211
108381
|
}
|
|
108212
108382
|
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
108213
108383
|
const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
|
|
@@ -108338,7 +108508,7 @@ function transformDeclarations(context) {
|
|
|
108338
108508
|
return factory2.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory2.createToken(95 /* ExportKeyword */)], factory2.createVariableDeclarationList([varDecl]));
|
|
108339
108509
|
});
|
|
108340
108510
|
if (!exportMappings.length) {
|
|
108341
|
-
declarations = mapDefined(declarations, (declaration) => factory2.
|
|
108511
|
+
declarations = mapDefined(declarations, (declaration) => factory2.replaceModifiers(declaration, 0 /* None */));
|
|
108342
108512
|
} else {
|
|
108343
108513
|
declarations.push(factory2.createExportDeclaration(
|
|
108344
108514
|
/*modifiers*/
|