typescript 5.5.0-dev.20240530 → 5.5.0-dev.20240531
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 +366 -70
- package/lib/typescript.js +366 -98
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2370
2370
|
|
|
2371
2371
|
// src/compiler/corePublic.ts
|
|
2372
2372
|
var versionMajorMinor = "5.5";
|
|
2373
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2373
|
+
var version = `${versionMajorMinor}.0-dev.20240531`;
|
|
2374
2374
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2375
2375
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2376
2376
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4252,6 +4252,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4252
4252
|
);
|
|
4253
4253
|
}
|
|
4254
4254
|
Debug2.formatNodeFlags = formatNodeFlags;
|
|
4255
|
+
function formatNodeCheckFlags(flags) {
|
|
4256
|
+
return formatEnum(
|
|
4257
|
+
flags,
|
|
4258
|
+
NodeCheckFlags,
|
|
4259
|
+
/*isFlags*/
|
|
4260
|
+
true
|
|
4261
|
+
);
|
|
4262
|
+
}
|
|
4263
|
+
Debug2.formatNodeCheckFlags = formatNodeCheckFlags;
|
|
4255
4264
|
function formatModifierFlags(flags) {
|
|
4256
4265
|
return formatEnum(
|
|
4257
4266
|
flags,
|
|
@@ -6544,32 +6553,33 @@ var InternalSymbolName = /* @__PURE__ */ ((InternalSymbolName2) => {
|
|
|
6544
6553
|
InternalSymbolName2["ImportAttributes"] = "__importAttributes";
|
|
6545
6554
|
return InternalSymbolName2;
|
|
6546
6555
|
})(InternalSymbolName || {});
|
|
6547
|
-
var NodeCheckFlags = /* @__PURE__ */ ((
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6556
|
+
var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
|
|
6557
|
+
NodeCheckFlags3[NodeCheckFlags3["None"] = 0] = "None";
|
|
6558
|
+
NodeCheckFlags3[NodeCheckFlags3["TypeChecked"] = 1] = "TypeChecked";
|
|
6559
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalThis"] = 2] = "LexicalThis";
|
|
6560
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureThis"] = 4] = "CaptureThis";
|
|
6561
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureNewTarget"] = 8] = "CaptureNewTarget";
|
|
6562
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperInstance"] = 16] = "SuperInstance";
|
|
6563
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperStatic"] = 32] = "SuperStatic";
|
|
6564
|
+
NodeCheckFlags3[NodeCheckFlags3["ContextChecked"] = 64] = "ContextChecked";
|
|
6565
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
|
|
6566
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
6567
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureArguments"] = 512] = "CaptureArguments";
|
|
6568
|
+
NodeCheckFlags3[NodeCheckFlags3["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
|
|
6569
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
|
|
6570
|
+
NodeCheckFlags3[NodeCheckFlags3["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
|
|
6571
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
6572
|
+
NodeCheckFlags3[NodeCheckFlags3["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
6573
|
+
NodeCheckFlags3[NodeCheckFlags3["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
6574
|
+
NodeCheckFlags3[NodeCheckFlags3["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
6575
|
+
NodeCheckFlags3[NodeCheckFlags3["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
6576
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
6577
|
+
NodeCheckFlags3[NodeCheckFlags3["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
6578
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
6579
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
6580
|
+
NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
6581
|
+
NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
|
|
6582
|
+
return NodeCheckFlags3;
|
|
6573
6583
|
})(NodeCheckFlags || {});
|
|
6574
6584
|
var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
6575
6585
|
TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
|
|
@@ -40337,7 +40347,7 @@ var commandOptionsWithoutBuild = [
|
|
|
40337
40347
|
showInSimplifiedHelpView: false,
|
|
40338
40348
|
category: Diagnostics.Compiler_Diagnostics,
|
|
40339
40349
|
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
40340
|
-
transpileOptionValue:
|
|
40350
|
+
transpileOptionValue: true,
|
|
40341
40351
|
defaultValueDescription: false,
|
|
40342
40352
|
affectsSemanticDiagnostics: true,
|
|
40343
40353
|
affectsBuildInfo: true,
|
|
@@ -52480,10 +52490,22 @@ function createTypeChecker(host) {
|
|
|
52480
52490
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
52481
52491
|
}
|
|
52482
52492
|
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
52493
|
+
var _a;
|
|
52483
52494
|
if (!(symbol.flags & 2097152 /* Alias */)) {
|
|
52484
52495
|
return void 0;
|
|
52485
52496
|
}
|
|
52486
52497
|
const links = getSymbolLinks(symbol);
|
|
52498
|
+
if (links.typeOnlyDeclaration === void 0) {
|
|
52499
|
+
links.typeOnlyDeclaration = false;
|
|
52500
|
+
const resolved = resolveSymbol(symbol);
|
|
52501
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52502
|
+
(_a = symbol.declarations) == null ? void 0 : _a[0],
|
|
52503
|
+
getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
|
|
52504
|
+
resolved,
|
|
52505
|
+
/*overwriteEmpty*/
|
|
52506
|
+
true
|
|
52507
|
+
);
|
|
52508
|
+
}
|
|
52487
52509
|
if (include === void 0) {
|
|
52488
52510
|
return links.typeOnlyDeclaration || void 0;
|
|
52489
52511
|
}
|
|
@@ -56226,18 +56248,108 @@ function createTypeChecker(host) {
|
|
|
56226
56248
|
cancellationToken.throwIfCancellationRequested();
|
|
56227
56249
|
}
|
|
56228
56250
|
let hadError = false;
|
|
56251
|
+
const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
|
|
56229
56252
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
56230
|
-
if (
|
|
56253
|
+
if (!finalizeBoundary()) {
|
|
56231
56254
|
return void 0;
|
|
56232
56255
|
}
|
|
56233
56256
|
context.approximateLength += existing.end - existing.pos;
|
|
56234
56257
|
return transformed;
|
|
56235
56258
|
function visitExistingNodeTreeSymbols(node) {
|
|
56259
|
+
if (hadError) return node;
|
|
56260
|
+
const recover = startRecoveryScope();
|
|
56236
56261
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
56237
56262
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
56238
56263
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
56264
|
+
if (hadError) {
|
|
56265
|
+
if (isTypeNode(node) && !isTypePredicateNode(node)) {
|
|
56266
|
+
recover();
|
|
56267
|
+
return serializeExistingTypeNode(context, node);
|
|
56268
|
+
}
|
|
56269
|
+
return node;
|
|
56270
|
+
}
|
|
56239
56271
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
56240
56272
|
}
|
|
56273
|
+
function createRecoveryBoundary() {
|
|
56274
|
+
let unreportedErrors;
|
|
56275
|
+
const oldTracker = context.tracker;
|
|
56276
|
+
const oldTrackedSymbols = context.trackedSymbols;
|
|
56277
|
+
context.trackedSymbols = [];
|
|
56278
|
+
const oldEncounteredError = context.encounteredError;
|
|
56279
|
+
context.tracker = new SymbolTrackerImpl(context, {
|
|
56280
|
+
...oldTracker.inner,
|
|
56281
|
+
reportCyclicStructureError() {
|
|
56282
|
+
markError(() => oldTracker.reportCyclicStructureError());
|
|
56283
|
+
},
|
|
56284
|
+
reportInaccessibleThisError() {
|
|
56285
|
+
markError(() => oldTracker.reportInaccessibleThisError());
|
|
56286
|
+
},
|
|
56287
|
+
reportInaccessibleUniqueSymbolError() {
|
|
56288
|
+
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
56289
|
+
},
|
|
56290
|
+
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
56291
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
56292
|
+
},
|
|
56293
|
+
reportNonSerializableProperty(name) {
|
|
56294
|
+
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
56295
|
+
},
|
|
56296
|
+
trackSymbol(sym, decl, meaning) {
|
|
56297
|
+
const accessibility = isSymbolAccessible(
|
|
56298
|
+
sym,
|
|
56299
|
+
decl,
|
|
56300
|
+
meaning,
|
|
56301
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
56302
|
+
false
|
|
56303
|
+
);
|
|
56304
|
+
if (accessibility.accessibility !== 0 /* Accessible */) {
|
|
56305
|
+
(context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
|
|
56306
|
+
return true;
|
|
56307
|
+
}
|
|
56308
|
+
return false;
|
|
56309
|
+
},
|
|
56310
|
+
moduleResolverHost: context.tracker.moduleResolverHost
|
|
56311
|
+
}, context.tracker.moduleResolverHost);
|
|
56312
|
+
return {
|
|
56313
|
+
startRecoveryScope: startRecoveryScope2,
|
|
56314
|
+
finalizeBoundary: finalizeBoundary2
|
|
56315
|
+
};
|
|
56316
|
+
function markError(unreportedError) {
|
|
56317
|
+
hadError = true;
|
|
56318
|
+
(unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
|
|
56319
|
+
}
|
|
56320
|
+
function startRecoveryScope2() {
|
|
56321
|
+
var _a;
|
|
56322
|
+
const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
|
|
56323
|
+
const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
|
|
56324
|
+
return () => {
|
|
56325
|
+
hadError = false;
|
|
56326
|
+
if (context.trackedSymbols) {
|
|
56327
|
+
context.trackedSymbols.length = initialTrackedSymbolsTop;
|
|
56328
|
+
}
|
|
56329
|
+
if (unreportedErrors) {
|
|
56330
|
+
unreportedErrors.length = unreportedErrorsTop;
|
|
56331
|
+
}
|
|
56332
|
+
};
|
|
56333
|
+
}
|
|
56334
|
+
function finalizeBoundary2() {
|
|
56335
|
+
context.tracker = oldTracker;
|
|
56336
|
+
const newTrackedSymbols = context.trackedSymbols;
|
|
56337
|
+
context.trackedSymbols = oldTrackedSymbols;
|
|
56338
|
+
context.encounteredError = oldEncounteredError;
|
|
56339
|
+
unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
|
|
56340
|
+
if (hadError) {
|
|
56341
|
+
return false;
|
|
56342
|
+
}
|
|
56343
|
+
newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
|
|
56344
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
56345
|
+
symbol,
|
|
56346
|
+
enclosingDeclaration,
|
|
56347
|
+
meaning
|
|
56348
|
+
)
|
|
56349
|
+
);
|
|
56350
|
+
return true;
|
|
56351
|
+
}
|
|
56352
|
+
}
|
|
56241
56353
|
function onEnterNewScope(node) {
|
|
56242
56354
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56243
56355
|
}
|
|
@@ -56511,13 +56623,39 @@ function createTypeChecker(host) {
|
|
|
56511
56623
|
}
|
|
56512
56624
|
function rewriteModuleSpecifier(parent2, lit) {
|
|
56513
56625
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
56514
|
-
|
|
56515
|
-
|
|
56516
|
-
|
|
56517
|
-
|
|
56518
|
-
|
|
56626
|
+
let name = lit.text;
|
|
56627
|
+
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
56628
|
+
const meaning = parent2.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
|
56629
|
+
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
|
56630
|
+
nodeSymbol,
|
|
56631
|
+
context.enclosingDeclaration,
|
|
56632
|
+
meaning,
|
|
56633
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
56634
|
+
false
|
|
56635
|
+
).accessibility === 0 /* Accessible */ && lookupSymbolChain(
|
|
56636
|
+
nodeSymbol,
|
|
56637
|
+
context,
|
|
56638
|
+
meaning,
|
|
56639
|
+
/*yieldModuleSymbol*/
|
|
56640
|
+
true
|
|
56641
|
+
)[0];
|
|
56642
|
+
if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
|
|
56643
|
+
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
56644
|
+
} else {
|
|
56645
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent2);
|
|
56646
|
+
if (targetFile) {
|
|
56647
|
+
name = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
56519
56648
|
}
|
|
56520
56649
|
}
|
|
56650
|
+
if (name.includes("/node_modules/")) {
|
|
56651
|
+
context.encounteredError = true;
|
|
56652
|
+
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
56653
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
56654
|
+
}
|
|
56655
|
+
}
|
|
56656
|
+
if (name !== lit.text) {
|
|
56657
|
+
return setOriginalNode(factory.createStringLiteral(name), lit);
|
|
56658
|
+
}
|
|
56521
56659
|
}
|
|
56522
56660
|
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
56523
56661
|
}
|
|
@@ -64485,7 +64623,6 @@ function createTypeChecker(host) {
|
|
|
64485
64623
|
return links.resolvedType;
|
|
64486
64624
|
}
|
|
64487
64625
|
function getTemplateLiteralType(texts, types) {
|
|
64488
|
-
var _a, _b;
|
|
64489
64626
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
64490
64627
|
if (unionIndex >= 0) {
|
|
64491
64628
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -64493,9 +64630,6 @@ function createTypeChecker(host) {
|
|
|
64493
64630
|
if (contains(types, wildcardType)) {
|
|
64494
64631
|
return wildcardType;
|
|
64495
64632
|
}
|
|
64496
|
-
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
|
|
64497
|
-
return types[0];
|
|
64498
|
-
}
|
|
64499
64633
|
const newTypes = [];
|
|
64500
64634
|
const newTexts = [];
|
|
64501
64635
|
let text = texts[0];
|
|
@@ -73985,9 +74119,6 @@ function createTypeChecker(host) {
|
|
|
73985
74119
|
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
73986
74120
|
return markJsxAliasReferenced(location);
|
|
73987
74121
|
}
|
|
73988
|
-
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
73989
|
-
return markAsyncFunctionAliasReferenced(location);
|
|
73990
|
-
}
|
|
73991
74122
|
if (isImportEqualsDeclaration(location)) {
|
|
73992
74123
|
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
73993
74124
|
return markImportEqualsAliasReferenced(location);
|
|
@@ -73997,6 +74128,9 @@ function createTypeChecker(host) {
|
|
|
73997
74128
|
if (isExportSpecifier(location)) {
|
|
73998
74129
|
return markExportSpecifierAliasReferenced(location);
|
|
73999
74130
|
}
|
|
74131
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
74132
|
+
markAsyncFunctionAliasReferenced(location);
|
|
74133
|
+
}
|
|
74000
74134
|
if (!compilerOptions.emitDecoratorMetadata) {
|
|
74001
74135
|
return;
|
|
74002
74136
|
}
|
|
@@ -74334,18 +74468,12 @@ function createTypeChecker(host) {
|
|
|
74334
74468
|
}
|
|
74335
74469
|
return type;
|
|
74336
74470
|
}
|
|
74337
|
-
function
|
|
74338
|
-
if (isThisInTypeQuery(node))
|
|
74339
|
-
return checkThisExpression(node);
|
|
74340
|
-
}
|
|
74341
|
-
const symbol = getResolvedSymbol(node);
|
|
74342
|
-
if (symbol === unknownSymbol) {
|
|
74343
|
-
return errorType;
|
|
74344
|
-
}
|
|
74471
|
+
function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
|
|
74472
|
+
if (isThisInTypeQuery(node)) return;
|
|
74345
74473
|
if (symbol === argumentsSymbol) {
|
|
74346
74474
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
74347
74475
|
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
74348
|
-
return
|
|
74476
|
+
return;
|
|
74349
74477
|
}
|
|
74350
74478
|
let container = getContainingFunction(node);
|
|
74351
74479
|
if (container) {
|
|
@@ -74364,17 +74492,14 @@ function createTypeChecker(host) {
|
|
|
74364
74492
|
}
|
|
74365
74493
|
}
|
|
74366
74494
|
}
|
|
74367
|
-
return
|
|
74368
|
-
}
|
|
74369
|
-
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
74370
|
-
markLinkedReferences(node, 1 /* Identifier */);
|
|
74495
|
+
return;
|
|
74371
74496
|
}
|
|
74372
74497
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
74373
74498
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
74374
74499
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
74375
74500
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
74376
74501
|
}
|
|
74377
|
-
|
|
74502
|
+
const declaration = localOrExportSymbol.valueDeclaration;
|
|
74378
74503
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
74379
74504
|
if (isClassLike(declaration) && declaration.name !== node) {
|
|
74380
74505
|
let container = getThisContainer(
|
|
@@ -74401,6 +74526,27 @@ function createTypeChecker(host) {
|
|
|
74401
74526
|
}
|
|
74402
74527
|
}
|
|
74403
74528
|
checkNestedBlockScopedBinding(node, symbol);
|
|
74529
|
+
}
|
|
74530
|
+
function checkIdentifier(node, checkMode) {
|
|
74531
|
+
if (isThisInTypeQuery(node)) {
|
|
74532
|
+
return checkThisExpression(node);
|
|
74533
|
+
}
|
|
74534
|
+
const symbol = getResolvedSymbol(node);
|
|
74535
|
+
if (symbol === unknownSymbol) {
|
|
74536
|
+
return errorType;
|
|
74537
|
+
}
|
|
74538
|
+
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
|
74539
|
+
if (symbol === argumentsSymbol) {
|
|
74540
|
+
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
74541
|
+
return errorType;
|
|
74542
|
+
}
|
|
74543
|
+
return getTypeOfSymbol(symbol);
|
|
74544
|
+
}
|
|
74545
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
74546
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
74547
|
+
}
|
|
74548
|
+
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
74549
|
+
let declaration = localOrExportSymbol.valueDeclaration;
|
|
74404
74550
|
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
74405
74551
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
74406
74552
|
if (assignmentKind) {
|
|
@@ -89411,7 +89557,6 @@ function createTypeChecker(host) {
|
|
|
89411
89557
|
if (links.isDeclarationWithCollidingName === void 0) {
|
|
89412
89558
|
const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
|
|
89413
89559
|
if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
|
|
89414
|
-
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
89415
89560
|
if (resolveName(
|
|
89416
89561
|
container.parent,
|
|
89417
89562
|
symbol.escapedName,
|
|
@@ -89422,8 +89567,8 @@ function createTypeChecker(host) {
|
|
|
89422
89567
|
false
|
|
89423
89568
|
)) {
|
|
89424
89569
|
links.isDeclarationWithCollidingName = true;
|
|
89425
|
-
} else if (
|
|
89426
|
-
const isDeclaredInLoop =
|
|
89570
|
+
} else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
|
|
89571
|
+
const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
|
|
89427
89572
|
const inLoopInitializer = isIterationStatement(
|
|
89428
89573
|
container,
|
|
89429
89574
|
/*lookInLabeledStatements*/
|
|
@@ -89505,6 +89650,9 @@ function createTypeChecker(host) {
|
|
|
89505
89650
|
if (!symbol) {
|
|
89506
89651
|
return false;
|
|
89507
89652
|
}
|
|
89653
|
+
const container = getSourceFileOfNode(symbol.valueDeclaration);
|
|
89654
|
+
const fileSymbol = container && getSymbolOfDeclaration(container);
|
|
89655
|
+
void resolveExternalModuleSymbol(fileSymbol);
|
|
89508
89656
|
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
89509
89657
|
if (target === unknownSymbol) {
|
|
89510
89658
|
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -89603,6 +89751,108 @@ function createTypeChecker(host) {
|
|
|
89603
89751
|
if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
|
|
89604
89752
|
return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
|
|
89605
89753
|
}
|
|
89754
|
+
function hasNodeCheckFlag(node, flag) {
|
|
89755
|
+
calculateNodeCheckFlagWorker(node, flag);
|
|
89756
|
+
return !!(getNodeCheckFlags(node) & flag);
|
|
89757
|
+
}
|
|
89758
|
+
function calculateNodeCheckFlagWorker(node, flag) {
|
|
89759
|
+
if (!compilerOptions.noCheck) {
|
|
89760
|
+
return;
|
|
89761
|
+
}
|
|
89762
|
+
const links = getNodeLinks(node);
|
|
89763
|
+
if (links.calculatedFlags & flag) {
|
|
89764
|
+
return;
|
|
89765
|
+
}
|
|
89766
|
+
switch (flag) {
|
|
89767
|
+
case 16 /* SuperInstance */:
|
|
89768
|
+
case 32 /* SuperStatic */:
|
|
89769
|
+
return checkSingleSuperExpression(node);
|
|
89770
|
+
case 128 /* MethodWithSuperPropertyAccessInAsync */:
|
|
89771
|
+
case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
|
|
89772
|
+
case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
|
|
89773
|
+
return checkChildSuperExpressions(node);
|
|
89774
|
+
case 512 /* CaptureArguments */:
|
|
89775
|
+
case 8192 /* ContainsCapturedBlockScopeBinding */:
|
|
89776
|
+
case 65536 /* NeedsLoopOutParameter */:
|
|
89777
|
+
case 262144 /* ContainsConstructorReference */:
|
|
89778
|
+
return checkChildIdentifiers(node);
|
|
89779
|
+
case 536870912 /* ConstructorReference */:
|
|
89780
|
+
return checkSingleIdentifier(node);
|
|
89781
|
+
case 4096 /* LoopWithCapturedBlockScopedBinding */:
|
|
89782
|
+
case 32768 /* BlockScopedBindingInLoop */:
|
|
89783
|
+
case 16384 /* CapturedBlockScopedBinding */:
|
|
89784
|
+
return checkContainingBlockScopeBindingUses(node);
|
|
89785
|
+
default:
|
|
89786
|
+
return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
|
|
89787
|
+
}
|
|
89788
|
+
function forEachNodeRecursively(root, cb) {
|
|
89789
|
+
const rootResult = cb(root, root.parent);
|
|
89790
|
+
if (rootResult === "skip") return void 0;
|
|
89791
|
+
if (rootResult) return rootResult;
|
|
89792
|
+
return forEachChildRecursively(root, cb);
|
|
89793
|
+
}
|
|
89794
|
+
function checkSuperExpressions(node2) {
|
|
89795
|
+
const links2 = getNodeLinks(node2);
|
|
89796
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
89797
|
+
links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
89798
|
+
checkSingleSuperExpression(node2);
|
|
89799
|
+
return void 0;
|
|
89800
|
+
}
|
|
89801
|
+
function checkChildSuperExpressions(node2) {
|
|
89802
|
+
forEachNodeRecursively(node2, checkSuperExpressions);
|
|
89803
|
+
}
|
|
89804
|
+
function checkSingleSuperExpression(node2) {
|
|
89805
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
89806
|
+
nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
|
|
89807
|
+
if (node2.kind === 108 /* SuperKeyword */) {
|
|
89808
|
+
checkSuperExpression(node2);
|
|
89809
|
+
}
|
|
89810
|
+
}
|
|
89811
|
+
function checkIdentifiers(node2) {
|
|
89812
|
+
const links2 = getNodeLinks(node2);
|
|
89813
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
89814
|
+
links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
|
|
89815
|
+
checkSingleIdentifier(node2);
|
|
89816
|
+
return void 0;
|
|
89817
|
+
}
|
|
89818
|
+
function checkChildIdentifiers(node2) {
|
|
89819
|
+
forEachNodeRecursively(node2, checkIdentifiers);
|
|
89820
|
+
}
|
|
89821
|
+
function checkSingleIdentifier(node2) {
|
|
89822
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
89823
|
+
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
89824
|
+
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
89825
|
+
const s = getSymbolAtLocation(
|
|
89826
|
+
node2,
|
|
89827
|
+
/*ignoreErrors*/
|
|
89828
|
+
true
|
|
89829
|
+
);
|
|
89830
|
+
if (s && s !== unknownSymbol) {
|
|
89831
|
+
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
89832
|
+
}
|
|
89833
|
+
}
|
|
89834
|
+
}
|
|
89835
|
+
function checkBlockScopeBindings(node2) {
|
|
89836
|
+
const links2 = getNodeLinks(node2);
|
|
89837
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
89838
|
+
links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
|
|
89839
|
+
checkSingleBlockScopeBinding(node2);
|
|
89840
|
+
return void 0;
|
|
89841
|
+
}
|
|
89842
|
+
function checkContainingBlockScopeBindingUses(node2) {
|
|
89843
|
+
const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
|
|
89844
|
+
forEachNodeRecursively(scope, checkBlockScopeBindings);
|
|
89845
|
+
}
|
|
89846
|
+
function checkSingleBlockScopeBinding(node2) {
|
|
89847
|
+
checkSingleIdentifier(node2);
|
|
89848
|
+
if (isComputedPropertyName(node2)) {
|
|
89849
|
+
checkComputedPropertyName(node2);
|
|
89850
|
+
}
|
|
89851
|
+
if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
|
|
89852
|
+
setNodeLinksForPrivateIdentifierScope(node2.parent);
|
|
89853
|
+
}
|
|
89854
|
+
}
|
|
89855
|
+
}
|
|
89606
89856
|
function getEnumMemberValue(node) {
|
|
89607
89857
|
computeEnumMemberValues(node.parent);
|
|
89608
89858
|
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
@@ -89623,7 +89873,15 @@ function createTypeChecker(host) {
|
|
|
89623
89873
|
if (node.kind === 306 /* EnumMember */) {
|
|
89624
89874
|
return getEnumMemberValue(node).value;
|
|
89625
89875
|
}
|
|
89626
|
-
|
|
89876
|
+
if (!getNodeLinks(node).resolvedSymbol) {
|
|
89877
|
+
void checkExpressionCached(node);
|
|
89878
|
+
}
|
|
89879
|
+
const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
|
|
89880
|
+
node,
|
|
89881
|
+
111551 /* Value */,
|
|
89882
|
+
/*ignoreErrors*/
|
|
89883
|
+
true
|
|
89884
|
+
) : void 0);
|
|
89627
89885
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
89628
89886
|
const member = symbol.valueDeclaration;
|
|
89629
89887
|
if (isEnumConst(member.parent)) {
|
|
@@ -89974,9 +90232,10 @@ function createTypeChecker(host) {
|
|
|
89974
90232
|
const node = getParseTreeNode(nodeIn);
|
|
89975
90233
|
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
89976
90234
|
},
|
|
89977
|
-
|
|
90235
|
+
hasNodeCheckFlag: (nodeIn, flag) => {
|
|
89978
90236
|
const node = getParseTreeNode(nodeIn);
|
|
89979
|
-
|
|
90237
|
+
if (!node) return false;
|
|
90238
|
+
return hasNodeCheckFlag(node, flag);
|
|
89980
90239
|
},
|
|
89981
90240
|
isTopLevelValueImportEqualsWithEntityName,
|
|
89982
90241
|
isDeclarationVisible,
|
|
@@ -89999,6 +90258,10 @@ function createTypeChecker(host) {
|
|
|
89999
90258
|
return node ? getEnumMemberValue(node) : void 0;
|
|
90000
90259
|
},
|
|
90001
90260
|
collectLinkedAliases,
|
|
90261
|
+
markLinkedReferences: (nodeIn) => {
|
|
90262
|
+
const node = getParseTreeNode(nodeIn);
|
|
90263
|
+
return node && markLinkedReferences(node, 0 /* Unspecified */);
|
|
90264
|
+
},
|
|
90002
90265
|
getReferencedValueDeclaration,
|
|
90003
90266
|
getReferencedValueDeclarations,
|
|
90004
90267
|
getTypeReferenceSerializationKind,
|
|
@@ -97987,7 +98250,7 @@ function transformClassFields(context) {
|
|
|
97987
98250
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
97988
98251
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
97989
98252
|
containsInstancePrivateElements = true;
|
|
97990
|
-
if (resolver.
|
|
98253
|
+
if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
|
|
97991
98254
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
97992
98255
|
}
|
|
97993
98256
|
} else if (isPropertyDeclaration(member)) {
|
|
@@ -98094,7 +98357,7 @@ function transformClassFields(context) {
|
|
|
98094
98357
|
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
98095
98358
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
98096
98359
|
}
|
|
98097
|
-
const isClassWithConstructorReference = resolver.
|
|
98360
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
98098
98361
|
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
98099
98362
|
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
98100
98363
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -98156,15 +98419,14 @@ function transformClassFields(context) {
|
|
|
98156
98419
|
var _a, _b, _c;
|
|
98157
98420
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
98158
98421
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
98159
|
-
const
|
|
98160
|
-
const
|
|
98422
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
98423
|
+
const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
98161
98424
|
let temp;
|
|
98162
98425
|
function createClassTempVar() {
|
|
98163
98426
|
var _a2;
|
|
98164
98427
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
98165
98428
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
98166
98429
|
}
|
|
98167
|
-
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
98168
98430
|
const temp2 = factory2.createTempVariable(
|
|
98169
98431
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
98170
98432
|
/*reservedInNestedScopes*/
|
|
@@ -98732,7 +98994,7 @@ function transformClassFields(context) {
|
|
|
98732
98994
|
const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
98733
98995
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
98734
98996
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
98735
|
-
if (resolver.
|
|
98997
|
+
if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
|
|
98736
98998
|
addBlockScopedVariable(generatedName);
|
|
98737
98999
|
} else {
|
|
98738
99000
|
hoistVariableDeclaration(generatedName);
|
|
@@ -98886,7 +99148,7 @@ function transformClassFields(context) {
|
|
|
98886
99148
|
prefix,
|
|
98887
99149
|
suffix
|
|
98888
99150
|
);
|
|
98889
|
-
if (resolver.
|
|
99151
|
+
if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
|
|
98890
99152
|
addBlockScopedVariable(identifier);
|
|
98891
99153
|
} else {
|
|
98892
99154
|
hoistVariableDeclaration(identifier);
|
|
@@ -99125,7 +99387,7 @@ function transformClassFields(context) {
|
|
|
99125
99387
|
}
|
|
99126
99388
|
function trySubstituteClassAlias(node) {
|
|
99127
99389
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
99128
|
-
if (resolver.
|
|
99390
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
99129
99391
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
99130
99392
|
if (declaration) {
|
|
99131
99393
|
const classAlias = classAliases[declaration.id];
|
|
@@ -99992,7 +100254,7 @@ function transformLegacyDecorators(context) {
|
|
|
99992
100254
|
}
|
|
99993
100255
|
}
|
|
99994
100256
|
function getClassAliasIfNeeded(node) {
|
|
99995
|
-
if (resolver.
|
|
100257
|
+
if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
|
|
99996
100258
|
enableSubstitutionForClassAliases();
|
|
99997
100259
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
99998
100260
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -100025,7 +100287,7 @@ function transformLegacyDecorators(context) {
|
|
|
100025
100287
|
}
|
|
100026
100288
|
function trySubstituteClassAlias(node) {
|
|
100027
100289
|
if (classAliases) {
|
|
100028
|
-
if (resolver.
|
|
100290
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
100029
100291
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
100030
100292
|
if (declaration) {
|
|
100031
100293
|
const classAlias = classAliases[declaration.id];
|
|
@@ -102334,7 +102596,7 @@ function transformES2017(context) {
|
|
|
102334
102596
|
hasSuperElementAccess = false;
|
|
102335
102597
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
102336
102598
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
102337
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
102599
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
102338
102600
|
if (emitSuperHelpers) {
|
|
102339
102601
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
102340
102602
|
if (capturedSuperProperties.size) {
|
|
@@ -102345,9 +102607,9 @@ function transformES2017(context) {
|
|
|
102345
102607
|
updated = factory2.updateBlock(updated, statements);
|
|
102346
102608
|
}
|
|
102347
102609
|
if (hasSuperElementAccess) {
|
|
102348
|
-
if (resolver.
|
|
102610
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
102349
102611
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
102350
|
-
} else if (resolver.
|
|
102612
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
102351
102613
|
addEmitHelper(updated, asyncSuperHelper);
|
|
102352
102614
|
}
|
|
102353
102615
|
}
|
|
@@ -102414,7 +102676,7 @@ function transformES2017(context) {
|
|
|
102414
102676
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
102415
102677
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
102416
102678
|
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
102417
|
-
const hasLexicalArguments =
|
|
102679
|
+
const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
|
|
102418
102680
|
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
102419
102681
|
if (captureLexicalArguments) {
|
|
102420
102682
|
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
@@ -102469,7 +102731,7 @@ function transformES2017(context) {
|
|
|
102469
102731
|
)
|
|
102470
102732
|
)
|
|
102471
102733
|
);
|
|
102472
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
102734
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
102473
102735
|
if (emitSuperHelpers) {
|
|
102474
102736
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
102475
102737
|
if (capturedSuperProperties.size) {
|
|
@@ -102488,9 +102750,9 @@ function transformES2017(context) {
|
|
|
102488
102750
|
);
|
|
102489
102751
|
setTextRange(block, node.body);
|
|
102490
102752
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
102491
|
-
if (resolver.
|
|
102753
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
102492
102754
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
102493
|
-
} else if (resolver.
|
|
102755
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
102494
102756
|
addEmitHelper(block, asyncSuperHelper);
|
|
102495
102757
|
}
|
|
102496
102758
|
}
|
|
@@ -102549,7 +102811,7 @@ function transformES2017(context) {
|
|
|
102549
102811
|
}
|
|
102550
102812
|
function onEmitNode(hint, node, emitCallback) {
|
|
102551
102813
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
102552
|
-
const superContainerFlags = resolver.
|
|
102814
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
102553
102815
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
102554
102816
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
102555
102817
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -102653,7 +102915,7 @@ function transformES2017(context) {
|
|
|
102653
102915
|
}
|
|
102654
102916
|
}
|
|
102655
102917
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
102656
|
-
const hasBinding =
|
|
102918
|
+
const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
102657
102919
|
const accessors = [];
|
|
102658
102920
|
names.forEach((_, key) => {
|
|
102659
102921
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -103748,7 +104010,7 @@ function transformES2018(context) {
|
|
|
103748
104010
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
103749
104011
|
)
|
|
103750
104012
|
);
|
|
103751
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
104013
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
103752
104014
|
if (emitSuperHelpers) {
|
|
103753
104015
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
103754
104016
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -103758,9 +104020,9 @@ function transformES2018(context) {
|
|
|
103758
104020
|
outerStatements.push(returnStatement);
|
|
103759
104021
|
const block = factory2.updateBlock(node.body, outerStatements);
|
|
103760
104022
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
103761
|
-
if (resolver.
|
|
104023
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
103762
104024
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
103763
|
-
} else if (resolver.
|
|
104025
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
103764
104026
|
addEmitHelper(block, asyncSuperHelper);
|
|
103765
104027
|
}
|
|
103766
104028
|
}
|
|
@@ -103893,7 +104155,7 @@ function transformES2018(context) {
|
|
|
103893
104155
|
}
|
|
103894
104156
|
function onEmitNode(hint, node, emitCallback) {
|
|
103895
104157
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
103896
|
-
const superContainerFlags = resolver.
|
|
104158
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
103897
104159
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
103898
104160
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
103899
104161
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -107598,9 +107860,8 @@ function transformES2015(context) {
|
|
|
107598
107860
|
return createRange(pos, end);
|
|
107599
107861
|
}
|
|
107600
107862
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
107601
|
-
const
|
|
107602
|
-
const
|
|
107603
|
-
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
107863
|
+
const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
|
|
107864
|
+
const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
107604
107865
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
107605
107866
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
107606
107867
|
return emitExplicitInitializer;
|
|
@@ -108051,7 +108312,7 @@ function transformES2015(context) {
|
|
|
108051
108312
|
return factory2.inlineExpressions(expressions);
|
|
108052
108313
|
}
|
|
108053
108314
|
function shouldConvertPartOfIterationStatement(node) {
|
|
108054
|
-
return
|
|
108315
|
+
return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
|
|
108055
108316
|
}
|
|
108056
108317
|
function shouldConvertInitializerOfForStatement(node) {
|
|
108057
108318
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -108066,7 +108327,7 @@ function transformES2015(context) {
|
|
|
108066
108327
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
108067
108328
|
}
|
|
108068
108329
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
108069
|
-
return
|
|
108330
|
+
return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
|
|
108070
108331
|
}
|
|
108071
108332
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
108072
108333
|
if (!state.hoistedLocalVariables) {
|
|
@@ -108615,11 +108876,11 @@ function transformES2015(context) {
|
|
|
108615
108876
|
void 0,
|
|
108616
108877
|
name
|
|
108617
108878
|
));
|
|
108618
|
-
const
|
|
108619
|
-
if (
|
|
108879
|
+
const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
|
|
108880
|
+
if (needsOutParam || hasCapturedBindingsInForHead) {
|
|
108620
108881
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
108621
108882
|
let flags = 0 /* None */;
|
|
108622
|
-
if (
|
|
108883
|
+
if (needsOutParam) {
|
|
108623
108884
|
flags |= 1 /* Body */;
|
|
108624
108885
|
}
|
|
108625
108886
|
if (isForStatement(container)) {
|
|
@@ -117653,6 +117914,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117653
117914
|
emitSkipped = true;
|
|
117654
117915
|
return;
|
|
117655
117916
|
}
|
|
117917
|
+
if (compilerOptions.noCheck) {
|
|
117918
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(markLinkedReferences);
|
|
117919
|
+
}
|
|
117656
117920
|
const transform2 = transformNodes(
|
|
117657
117921
|
resolver,
|
|
117658
117922
|
host,
|
|
@@ -117787,6 +118051,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117787
118051
|
}
|
|
117788
118052
|
forEachChild(node, collectLinkedAliases);
|
|
117789
118053
|
}
|
|
118054
|
+
function markLinkedReferences(file) {
|
|
118055
|
+
forEachChildRecursively(file, (n) => {
|
|
118056
|
+
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
|
|
118057
|
+
if (isImportDeclaration(n)) return "skip";
|
|
118058
|
+
resolver.markLinkedReferences(n);
|
|
118059
|
+
});
|
|
118060
|
+
}
|
|
117790
118061
|
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) {
|
|
117791
118062
|
const sourceFileOrBundle = transform2.transformed[0];
|
|
117792
118063
|
const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
|
|
@@ -117918,10 +118189,11 @@ var notImplementedResolver = {
|
|
|
117918
118189
|
isValueAliasDeclaration: notImplemented,
|
|
117919
118190
|
isReferencedAliasDeclaration: notImplemented,
|
|
117920
118191
|
isTopLevelValueImportEqualsWithEntityName: notImplemented,
|
|
117921
|
-
|
|
118192
|
+
hasNodeCheckFlag: notImplemented,
|
|
117922
118193
|
isDeclarationVisible: notImplemented,
|
|
117923
118194
|
isLateBound: (_node) => false,
|
|
117924
118195
|
collectLinkedAliases: notImplemented,
|
|
118196
|
+
markLinkedReferences: notImplemented,
|
|
117925
118197
|
isImplementationOfOverload: notImplemented,
|
|
117926
118198
|
requiresAddingImplicitUndefined: notImplemented,
|
|
117927
118199
|
isExpandoFunctionDeclaration: notImplemented,
|
|
@@ -126057,9 +126329,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126057
126329
|
if (options.noEmit) {
|
|
126058
126330
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
|
126059
126331
|
}
|
|
126060
|
-
if (!options.emitDeclarationOnly) {
|
|
126061
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
|
126062
|
-
}
|
|
126063
126332
|
}
|
|
126064
126333
|
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
|
|
126065
126334
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|
|
@@ -141185,7 +141454,6 @@ function transpileWorker(input, transpileOptions, declaration) {
|
|
|
141185
141454
|
options.declaration = true;
|
|
141186
141455
|
options.emitDeclarationOnly = true;
|
|
141187
141456
|
options.isolatedDeclarations = true;
|
|
141188
|
-
options.noCheck = true;
|
|
141189
141457
|
} else {
|
|
141190
141458
|
options.declaration = false;
|
|
141191
141459
|
}
|
|
@@ -143863,7 +144131,7 @@ function getExistingLocals(sourceFile, statements, checker) {
|
|
|
143863
144131
|
for (const statement of statements) {
|
|
143864
144132
|
forEachReference(statement, checker, (s) => {
|
|
143865
144133
|
const symbol = skipAlias(s, checker);
|
|
143866
|
-
if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration) === sourceFile) {
|
|
144134
|
+
if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration).path === sourceFile.path) {
|
|
143867
144135
|
existingLocals.add(symbol);
|
|
143868
144136
|
}
|
|
143869
144137
|
});
|