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/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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240531`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1518,6 +1518,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1518
1518
|
);
|
|
1519
1519
|
}
|
|
1520
1520
|
Debug2.formatNodeFlags = formatNodeFlags;
|
|
1521
|
+
function formatNodeCheckFlags(flags) {
|
|
1522
|
+
return formatEnum(
|
|
1523
|
+
flags,
|
|
1524
|
+
NodeCheckFlags,
|
|
1525
|
+
/*isFlags*/
|
|
1526
|
+
true
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
Debug2.formatNodeCheckFlags = formatNodeCheckFlags;
|
|
1521
1530
|
function formatModifierFlags(flags) {
|
|
1522
1531
|
return formatEnum(
|
|
1523
1532
|
flags,
|
|
@@ -3530,6 +3539,34 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags2) => {
|
|
|
3530
3539
|
SymbolFlags2[SymbolFlags2["LateBindingContainer"] = 6256] = "LateBindingContainer";
|
|
3531
3540
|
return SymbolFlags2;
|
|
3532
3541
|
})(SymbolFlags || {});
|
|
3542
|
+
var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
|
|
3543
|
+
NodeCheckFlags3[NodeCheckFlags3["None"] = 0] = "None";
|
|
3544
|
+
NodeCheckFlags3[NodeCheckFlags3["TypeChecked"] = 1] = "TypeChecked";
|
|
3545
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalThis"] = 2] = "LexicalThis";
|
|
3546
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureThis"] = 4] = "CaptureThis";
|
|
3547
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureNewTarget"] = 8] = "CaptureNewTarget";
|
|
3548
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperInstance"] = 16] = "SuperInstance";
|
|
3549
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperStatic"] = 32] = "SuperStatic";
|
|
3550
|
+
NodeCheckFlags3[NodeCheckFlags3["ContextChecked"] = 64] = "ContextChecked";
|
|
3551
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
|
|
3552
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
3553
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureArguments"] = 512] = "CaptureArguments";
|
|
3554
|
+
NodeCheckFlags3[NodeCheckFlags3["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
|
|
3555
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
|
|
3556
|
+
NodeCheckFlags3[NodeCheckFlags3["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
|
|
3557
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
3558
|
+
NodeCheckFlags3[NodeCheckFlags3["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
3559
|
+
NodeCheckFlags3[NodeCheckFlags3["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
3560
|
+
NodeCheckFlags3[NodeCheckFlags3["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
3561
|
+
NodeCheckFlags3[NodeCheckFlags3["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
3562
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
3563
|
+
NodeCheckFlags3[NodeCheckFlags3["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
3564
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
3565
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
3566
|
+
NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
3567
|
+
NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
|
|
3568
|
+
return NodeCheckFlags3;
|
|
3569
|
+
})(NodeCheckFlags || {});
|
|
3533
3570
|
var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
3534
3571
|
TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
|
|
3535
3572
|
TypeFlags2[TypeFlags2["Unknown"] = 2] = "Unknown";
|
|
@@ -35891,7 +35928,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35891
35928
|
showInSimplifiedHelpView: false,
|
|
35892
35929
|
category: Diagnostics.Compiler_Diagnostics,
|
|
35893
35930
|
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
35894
|
-
transpileOptionValue:
|
|
35931
|
+
transpileOptionValue: true,
|
|
35895
35932
|
defaultValueDescription: false,
|
|
35896
35933
|
affectsSemanticDiagnostics: true,
|
|
35897
35934
|
affectsBuildInfo: true,
|
|
@@ -47685,10 +47722,22 @@ function createTypeChecker(host) {
|
|
|
47685
47722
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
47686
47723
|
}
|
|
47687
47724
|
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
47725
|
+
var _a;
|
|
47688
47726
|
if (!(symbol.flags & 2097152 /* Alias */)) {
|
|
47689
47727
|
return void 0;
|
|
47690
47728
|
}
|
|
47691
47729
|
const links = getSymbolLinks(symbol);
|
|
47730
|
+
if (links.typeOnlyDeclaration === void 0) {
|
|
47731
|
+
links.typeOnlyDeclaration = false;
|
|
47732
|
+
const resolved = resolveSymbol(symbol);
|
|
47733
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47734
|
+
(_a = symbol.declarations) == null ? void 0 : _a[0],
|
|
47735
|
+
getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
|
|
47736
|
+
resolved,
|
|
47737
|
+
/*overwriteEmpty*/
|
|
47738
|
+
true
|
|
47739
|
+
);
|
|
47740
|
+
}
|
|
47692
47741
|
if (include === void 0) {
|
|
47693
47742
|
return links.typeOnlyDeclaration || void 0;
|
|
47694
47743
|
}
|
|
@@ -51431,18 +51480,108 @@ function createTypeChecker(host) {
|
|
|
51431
51480
|
cancellationToken.throwIfCancellationRequested();
|
|
51432
51481
|
}
|
|
51433
51482
|
let hadError = false;
|
|
51483
|
+
const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
|
|
51434
51484
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51435
|
-
if (
|
|
51485
|
+
if (!finalizeBoundary()) {
|
|
51436
51486
|
return void 0;
|
|
51437
51487
|
}
|
|
51438
51488
|
context.approximateLength += existing.end - existing.pos;
|
|
51439
51489
|
return transformed;
|
|
51440
51490
|
function visitExistingNodeTreeSymbols(node) {
|
|
51491
|
+
if (hadError) return node;
|
|
51492
|
+
const recover = startRecoveryScope();
|
|
51441
51493
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
51442
51494
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
51443
51495
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
51496
|
+
if (hadError) {
|
|
51497
|
+
if (isTypeNode(node) && !isTypePredicateNode(node)) {
|
|
51498
|
+
recover();
|
|
51499
|
+
return serializeExistingTypeNode(context, node);
|
|
51500
|
+
}
|
|
51501
|
+
return node;
|
|
51502
|
+
}
|
|
51444
51503
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
51445
51504
|
}
|
|
51505
|
+
function createRecoveryBoundary() {
|
|
51506
|
+
let unreportedErrors;
|
|
51507
|
+
const oldTracker = context.tracker;
|
|
51508
|
+
const oldTrackedSymbols = context.trackedSymbols;
|
|
51509
|
+
context.trackedSymbols = [];
|
|
51510
|
+
const oldEncounteredError = context.encounteredError;
|
|
51511
|
+
context.tracker = new SymbolTrackerImpl(context, {
|
|
51512
|
+
...oldTracker.inner,
|
|
51513
|
+
reportCyclicStructureError() {
|
|
51514
|
+
markError(() => oldTracker.reportCyclicStructureError());
|
|
51515
|
+
},
|
|
51516
|
+
reportInaccessibleThisError() {
|
|
51517
|
+
markError(() => oldTracker.reportInaccessibleThisError());
|
|
51518
|
+
},
|
|
51519
|
+
reportInaccessibleUniqueSymbolError() {
|
|
51520
|
+
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
51521
|
+
},
|
|
51522
|
+
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
51523
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
51524
|
+
},
|
|
51525
|
+
reportNonSerializableProperty(name) {
|
|
51526
|
+
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
51527
|
+
},
|
|
51528
|
+
trackSymbol(sym, decl, meaning) {
|
|
51529
|
+
const accessibility = isSymbolAccessible(
|
|
51530
|
+
sym,
|
|
51531
|
+
decl,
|
|
51532
|
+
meaning,
|
|
51533
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51534
|
+
false
|
|
51535
|
+
);
|
|
51536
|
+
if (accessibility.accessibility !== 0 /* Accessible */) {
|
|
51537
|
+
(context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
|
|
51538
|
+
return true;
|
|
51539
|
+
}
|
|
51540
|
+
return false;
|
|
51541
|
+
},
|
|
51542
|
+
moduleResolverHost: context.tracker.moduleResolverHost
|
|
51543
|
+
}, context.tracker.moduleResolverHost);
|
|
51544
|
+
return {
|
|
51545
|
+
startRecoveryScope: startRecoveryScope2,
|
|
51546
|
+
finalizeBoundary: finalizeBoundary2
|
|
51547
|
+
};
|
|
51548
|
+
function markError(unreportedError) {
|
|
51549
|
+
hadError = true;
|
|
51550
|
+
(unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
|
|
51551
|
+
}
|
|
51552
|
+
function startRecoveryScope2() {
|
|
51553
|
+
var _a;
|
|
51554
|
+
const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
|
|
51555
|
+
const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
|
|
51556
|
+
return () => {
|
|
51557
|
+
hadError = false;
|
|
51558
|
+
if (context.trackedSymbols) {
|
|
51559
|
+
context.trackedSymbols.length = initialTrackedSymbolsTop;
|
|
51560
|
+
}
|
|
51561
|
+
if (unreportedErrors) {
|
|
51562
|
+
unreportedErrors.length = unreportedErrorsTop;
|
|
51563
|
+
}
|
|
51564
|
+
};
|
|
51565
|
+
}
|
|
51566
|
+
function finalizeBoundary2() {
|
|
51567
|
+
context.tracker = oldTracker;
|
|
51568
|
+
const newTrackedSymbols = context.trackedSymbols;
|
|
51569
|
+
context.trackedSymbols = oldTrackedSymbols;
|
|
51570
|
+
context.encounteredError = oldEncounteredError;
|
|
51571
|
+
unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
|
|
51572
|
+
if (hadError) {
|
|
51573
|
+
return false;
|
|
51574
|
+
}
|
|
51575
|
+
newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
|
|
51576
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
51577
|
+
symbol,
|
|
51578
|
+
enclosingDeclaration,
|
|
51579
|
+
meaning
|
|
51580
|
+
)
|
|
51581
|
+
);
|
|
51582
|
+
return true;
|
|
51583
|
+
}
|
|
51584
|
+
}
|
|
51446
51585
|
function onEnterNewScope(node) {
|
|
51447
51586
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
51448
51587
|
}
|
|
@@ -51716,13 +51855,39 @@ function createTypeChecker(host) {
|
|
|
51716
51855
|
}
|
|
51717
51856
|
function rewriteModuleSpecifier(parent, lit) {
|
|
51718
51857
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
51719
|
-
|
|
51720
|
-
|
|
51721
|
-
|
|
51722
|
-
|
|
51723
|
-
|
|
51858
|
+
let name = lit.text;
|
|
51859
|
+
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
51860
|
+
const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
|
51861
|
+
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
|
51862
|
+
nodeSymbol,
|
|
51863
|
+
context.enclosingDeclaration,
|
|
51864
|
+
meaning,
|
|
51865
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51866
|
+
false
|
|
51867
|
+
).accessibility === 0 /* Accessible */ && lookupSymbolChain(
|
|
51868
|
+
nodeSymbol,
|
|
51869
|
+
context,
|
|
51870
|
+
meaning,
|
|
51871
|
+
/*yieldModuleSymbol*/
|
|
51872
|
+
true
|
|
51873
|
+
)[0];
|
|
51874
|
+
if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
|
|
51875
|
+
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
51876
|
+
} else {
|
|
51877
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
51878
|
+
if (targetFile) {
|
|
51879
|
+
name = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
51724
51880
|
}
|
|
51725
51881
|
}
|
|
51882
|
+
if (name.includes("/node_modules/")) {
|
|
51883
|
+
context.encounteredError = true;
|
|
51884
|
+
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
51885
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
51886
|
+
}
|
|
51887
|
+
}
|
|
51888
|
+
if (name !== lit.text) {
|
|
51889
|
+
return setOriginalNode(factory.createStringLiteral(name), lit);
|
|
51890
|
+
}
|
|
51726
51891
|
}
|
|
51727
51892
|
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
51728
51893
|
}
|
|
@@ -59690,7 +59855,6 @@ function createTypeChecker(host) {
|
|
|
59690
59855
|
return links.resolvedType;
|
|
59691
59856
|
}
|
|
59692
59857
|
function getTemplateLiteralType(texts, types) {
|
|
59693
|
-
var _a, _b;
|
|
59694
59858
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
59695
59859
|
if (unionIndex >= 0) {
|
|
59696
59860
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -59698,9 +59862,6 @@ function createTypeChecker(host) {
|
|
|
59698
59862
|
if (contains(types, wildcardType)) {
|
|
59699
59863
|
return wildcardType;
|
|
59700
59864
|
}
|
|
59701
|
-
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)) {
|
|
59702
|
-
return types[0];
|
|
59703
|
-
}
|
|
59704
59865
|
const newTypes = [];
|
|
59705
59866
|
const newTexts = [];
|
|
59706
59867
|
let text = texts[0];
|
|
@@ -69190,9 +69351,6 @@ function createTypeChecker(host) {
|
|
|
69190
69351
|
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
69191
69352
|
return markJsxAliasReferenced(location);
|
|
69192
69353
|
}
|
|
69193
|
-
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69194
|
-
return markAsyncFunctionAliasReferenced(location);
|
|
69195
|
-
}
|
|
69196
69354
|
if (isImportEqualsDeclaration(location)) {
|
|
69197
69355
|
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
69198
69356
|
return markImportEqualsAliasReferenced(location);
|
|
@@ -69202,6 +69360,9 @@ function createTypeChecker(host) {
|
|
|
69202
69360
|
if (isExportSpecifier(location)) {
|
|
69203
69361
|
return markExportSpecifierAliasReferenced(location);
|
|
69204
69362
|
}
|
|
69363
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69364
|
+
markAsyncFunctionAliasReferenced(location);
|
|
69365
|
+
}
|
|
69205
69366
|
if (!compilerOptions.emitDecoratorMetadata) {
|
|
69206
69367
|
return;
|
|
69207
69368
|
}
|
|
@@ -69539,18 +69700,12 @@ function createTypeChecker(host) {
|
|
|
69539
69700
|
}
|
|
69540
69701
|
return type;
|
|
69541
69702
|
}
|
|
69542
|
-
function
|
|
69543
|
-
if (isThisInTypeQuery(node))
|
|
69544
|
-
return checkThisExpression(node);
|
|
69545
|
-
}
|
|
69546
|
-
const symbol = getResolvedSymbol(node);
|
|
69547
|
-
if (symbol === unknownSymbol) {
|
|
69548
|
-
return errorType;
|
|
69549
|
-
}
|
|
69703
|
+
function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
|
|
69704
|
+
if (isThisInTypeQuery(node)) return;
|
|
69550
69705
|
if (symbol === argumentsSymbol) {
|
|
69551
69706
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69552
69707
|
error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
69553
|
-
return
|
|
69708
|
+
return;
|
|
69554
69709
|
}
|
|
69555
69710
|
let container = getContainingFunction(node);
|
|
69556
69711
|
if (container) {
|
|
@@ -69569,17 +69724,14 @@ function createTypeChecker(host) {
|
|
|
69569
69724
|
}
|
|
69570
69725
|
}
|
|
69571
69726
|
}
|
|
69572
|
-
return
|
|
69573
|
-
}
|
|
69574
|
-
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69575
|
-
markLinkedReferences(node, 1 /* Identifier */);
|
|
69727
|
+
return;
|
|
69576
69728
|
}
|
|
69577
69729
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69578
69730
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
69579
69731
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
69580
69732
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
69581
69733
|
}
|
|
69582
|
-
|
|
69734
|
+
const declaration = localOrExportSymbol.valueDeclaration;
|
|
69583
69735
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
69584
69736
|
if (isClassLike(declaration) && declaration.name !== node) {
|
|
69585
69737
|
let container = getThisContainer(
|
|
@@ -69606,6 +69758,27 @@ function createTypeChecker(host) {
|
|
|
69606
69758
|
}
|
|
69607
69759
|
}
|
|
69608
69760
|
checkNestedBlockScopedBinding(node, symbol);
|
|
69761
|
+
}
|
|
69762
|
+
function checkIdentifier(node, checkMode) {
|
|
69763
|
+
if (isThisInTypeQuery(node)) {
|
|
69764
|
+
return checkThisExpression(node);
|
|
69765
|
+
}
|
|
69766
|
+
const symbol = getResolvedSymbol(node);
|
|
69767
|
+
if (symbol === unknownSymbol) {
|
|
69768
|
+
return errorType;
|
|
69769
|
+
}
|
|
69770
|
+
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
|
69771
|
+
if (symbol === argumentsSymbol) {
|
|
69772
|
+
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69773
|
+
return errorType;
|
|
69774
|
+
}
|
|
69775
|
+
return getTypeOfSymbol(symbol);
|
|
69776
|
+
}
|
|
69777
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69778
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
69779
|
+
}
|
|
69780
|
+
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69781
|
+
let declaration = localOrExportSymbol.valueDeclaration;
|
|
69609
69782
|
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
69610
69783
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
69611
69784
|
if (assignmentKind) {
|
|
@@ -84616,7 +84789,6 @@ function createTypeChecker(host) {
|
|
|
84616
84789
|
if (links.isDeclarationWithCollidingName === void 0) {
|
|
84617
84790
|
const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
|
|
84618
84791
|
if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
|
|
84619
|
-
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
84620
84792
|
if (resolveName(
|
|
84621
84793
|
container.parent,
|
|
84622
84794
|
symbol.escapedName,
|
|
@@ -84627,8 +84799,8 @@ function createTypeChecker(host) {
|
|
|
84627
84799
|
false
|
|
84628
84800
|
)) {
|
|
84629
84801
|
links.isDeclarationWithCollidingName = true;
|
|
84630
|
-
} else if (
|
|
84631
|
-
const isDeclaredInLoop =
|
|
84802
|
+
} else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
|
|
84803
|
+
const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
|
|
84632
84804
|
const inLoopInitializer = isIterationStatement(
|
|
84633
84805
|
container,
|
|
84634
84806
|
/*lookInLabeledStatements*/
|
|
@@ -84710,6 +84882,9 @@ function createTypeChecker(host) {
|
|
|
84710
84882
|
if (!symbol) {
|
|
84711
84883
|
return false;
|
|
84712
84884
|
}
|
|
84885
|
+
const container = getSourceFileOfNode(symbol.valueDeclaration);
|
|
84886
|
+
const fileSymbol = container && getSymbolOfDeclaration(container);
|
|
84887
|
+
void resolveExternalModuleSymbol(fileSymbol);
|
|
84713
84888
|
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
84714
84889
|
if (target === unknownSymbol) {
|
|
84715
84890
|
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -84808,6 +84983,108 @@ function createTypeChecker(host) {
|
|
|
84808
84983
|
if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
|
|
84809
84984
|
return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
|
|
84810
84985
|
}
|
|
84986
|
+
function hasNodeCheckFlag(node, flag) {
|
|
84987
|
+
calculateNodeCheckFlagWorker(node, flag);
|
|
84988
|
+
return !!(getNodeCheckFlags(node) & flag);
|
|
84989
|
+
}
|
|
84990
|
+
function calculateNodeCheckFlagWorker(node, flag) {
|
|
84991
|
+
if (!compilerOptions.noCheck) {
|
|
84992
|
+
return;
|
|
84993
|
+
}
|
|
84994
|
+
const links = getNodeLinks(node);
|
|
84995
|
+
if (links.calculatedFlags & flag) {
|
|
84996
|
+
return;
|
|
84997
|
+
}
|
|
84998
|
+
switch (flag) {
|
|
84999
|
+
case 16 /* SuperInstance */:
|
|
85000
|
+
case 32 /* SuperStatic */:
|
|
85001
|
+
return checkSingleSuperExpression(node);
|
|
85002
|
+
case 128 /* MethodWithSuperPropertyAccessInAsync */:
|
|
85003
|
+
case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
|
|
85004
|
+
case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
|
|
85005
|
+
return checkChildSuperExpressions(node);
|
|
85006
|
+
case 512 /* CaptureArguments */:
|
|
85007
|
+
case 8192 /* ContainsCapturedBlockScopeBinding */:
|
|
85008
|
+
case 65536 /* NeedsLoopOutParameter */:
|
|
85009
|
+
case 262144 /* ContainsConstructorReference */:
|
|
85010
|
+
return checkChildIdentifiers(node);
|
|
85011
|
+
case 536870912 /* ConstructorReference */:
|
|
85012
|
+
return checkSingleIdentifier(node);
|
|
85013
|
+
case 4096 /* LoopWithCapturedBlockScopedBinding */:
|
|
85014
|
+
case 32768 /* BlockScopedBindingInLoop */:
|
|
85015
|
+
case 16384 /* CapturedBlockScopedBinding */:
|
|
85016
|
+
return checkContainingBlockScopeBindingUses(node);
|
|
85017
|
+
default:
|
|
85018
|
+
return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
|
|
85019
|
+
}
|
|
85020
|
+
function forEachNodeRecursively(root, cb) {
|
|
85021
|
+
const rootResult = cb(root, root.parent);
|
|
85022
|
+
if (rootResult === "skip") return void 0;
|
|
85023
|
+
if (rootResult) return rootResult;
|
|
85024
|
+
return forEachChildRecursively(root, cb);
|
|
85025
|
+
}
|
|
85026
|
+
function checkSuperExpressions(node2) {
|
|
85027
|
+
const links2 = getNodeLinks(node2);
|
|
85028
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85029
|
+
links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
85030
|
+
checkSingleSuperExpression(node2);
|
|
85031
|
+
return void 0;
|
|
85032
|
+
}
|
|
85033
|
+
function checkChildSuperExpressions(node2) {
|
|
85034
|
+
forEachNodeRecursively(node2, checkSuperExpressions);
|
|
85035
|
+
}
|
|
85036
|
+
function checkSingleSuperExpression(node2) {
|
|
85037
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85038
|
+
nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
|
|
85039
|
+
if (node2.kind === 108 /* SuperKeyword */) {
|
|
85040
|
+
checkSuperExpression(node2);
|
|
85041
|
+
}
|
|
85042
|
+
}
|
|
85043
|
+
function checkIdentifiers(node2) {
|
|
85044
|
+
const links2 = getNodeLinks(node2);
|
|
85045
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85046
|
+
links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
|
|
85047
|
+
checkSingleIdentifier(node2);
|
|
85048
|
+
return void 0;
|
|
85049
|
+
}
|
|
85050
|
+
function checkChildIdentifiers(node2) {
|
|
85051
|
+
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85052
|
+
}
|
|
85053
|
+
function checkSingleIdentifier(node2) {
|
|
85054
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85055
|
+
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85056
|
+
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85057
|
+
const s = getSymbolAtLocation(
|
|
85058
|
+
node2,
|
|
85059
|
+
/*ignoreErrors*/
|
|
85060
|
+
true
|
|
85061
|
+
);
|
|
85062
|
+
if (s && s !== unknownSymbol) {
|
|
85063
|
+
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85064
|
+
}
|
|
85065
|
+
}
|
|
85066
|
+
}
|
|
85067
|
+
function checkBlockScopeBindings(node2) {
|
|
85068
|
+
const links2 = getNodeLinks(node2);
|
|
85069
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85070
|
+
links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
|
|
85071
|
+
checkSingleBlockScopeBinding(node2);
|
|
85072
|
+
return void 0;
|
|
85073
|
+
}
|
|
85074
|
+
function checkContainingBlockScopeBindingUses(node2) {
|
|
85075
|
+
const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
|
|
85076
|
+
forEachNodeRecursively(scope, checkBlockScopeBindings);
|
|
85077
|
+
}
|
|
85078
|
+
function checkSingleBlockScopeBinding(node2) {
|
|
85079
|
+
checkSingleIdentifier(node2);
|
|
85080
|
+
if (isComputedPropertyName(node2)) {
|
|
85081
|
+
checkComputedPropertyName(node2);
|
|
85082
|
+
}
|
|
85083
|
+
if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
|
|
85084
|
+
setNodeLinksForPrivateIdentifierScope(node2.parent);
|
|
85085
|
+
}
|
|
85086
|
+
}
|
|
85087
|
+
}
|
|
84811
85088
|
function getEnumMemberValue(node) {
|
|
84812
85089
|
computeEnumMemberValues(node.parent);
|
|
84813
85090
|
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
@@ -84828,7 +85105,15 @@ function createTypeChecker(host) {
|
|
|
84828
85105
|
if (node.kind === 306 /* EnumMember */) {
|
|
84829
85106
|
return getEnumMemberValue(node).value;
|
|
84830
85107
|
}
|
|
84831
|
-
|
|
85108
|
+
if (!getNodeLinks(node).resolvedSymbol) {
|
|
85109
|
+
void checkExpressionCached(node);
|
|
85110
|
+
}
|
|
85111
|
+
const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
|
|
85112
|
+
node,
|
|
85113
|
+
111551 /* Value */,
|
|
85114
|
+
/*ignoreErrors*/
|
|
85115
|
+
true
|
|
85116
|
+
) : void 0);
|
|
84832
85117
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
84833
85118
|
const member = symbol.valueDeclaration;
|
|
84834
85119
|
if (isEnumConst(member.parent)) {
|
|
@@ -85179,9 +85464,10 @@ function createTypeChecker(host) {
|
|
|
85179
85464
|
const node = getParseTreeNode(nodeIn);
|
|
85180
85465
|
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85181
85466
|
},
|
|
85182
|
-
|
|
85467
|
+
hasNodeCheckFlag: (nodeIn, flag) => {
|
|
85183
85468
|
const node = getParseTreeNode(nodeIn);
|
|
85184
|
-
|
|
85469
|
+
if (!node) return false;
|
|
85470
|
+
return hasNodeCheckFlag(node, flag);
|
|
85185
85471
|
},
|
|
85186
85472
|
isTopLevelValueImportEqualsWithEntityName,
|
|
85187
85473
|
isDeclarationVisible,
|
|
@@ -85204,6 +85490,10 @@ function createTypeChecker(host) {
|
|
|
85204
85490
|
return node ? getEnumMemberValue(node) : void 0;
|
|
85205
85491
|
},
|
|
85206
85492
|
collectLinkedAliases,
|
|
85493
|
+
markLinkedReferences: (nodeIn) => {
|
|
85494
|
+
const node = getParseTreeNode(nodeIn);
|
|
85495
|
+
return node && markLinkedReferences(node, 0 /* Unspecified */);
|
|
85496
|
+
},
|
|
85207
85497
|
getReferencedValueDeclaration,
|
|
85208
85498
|
getReferencedValueDeclarations,
|
|
85209
85499
|
getTypeReferenceSerializationKind,
|
|
@@ -93010,7 +93300,7 @@ function transformClassFields(context) {
|
|
|
93010
93300
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
93011
93301
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
93012
93302
|
containsInstancePrivateElements = true;
|
|
93013
|
-
if (resolver.
|
|
93303
|
+
if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
|
|
93014
93304
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
93015
93305
|
}
|
|
93016
93306
|
} else if (isPropertyDeclaration(member)) {
|
|
@@ -93117,7 +93407,7 @@ function transformClassFields(context) {
|
|
|
93117
93407
|
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
93118
93408
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
93119
93409
|
}
|
|
93120
|
-
const isClassWithConstructorReference = resolver.
|
|
93410
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93121
93411
|
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93122
93412
|
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93123
93413
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -93179,15 +93469,14 @@ function transformClassFields(context) {
|
|
|
93179
93469
|
var _a, _b, _c;
|
|
93180
93470
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
93181
93471
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
93182
|
-
const
|
|
93183
|
-
const
|
|
93472
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93473
|
+
const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
93184
93474
|
let temp;
|
|
93185
93475
|
function createClassTempVar() {
|
|
93186
93476
|
var _a2;
|
|
93187
93477
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
93188
93478
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
93189
93479
|
}
|
|
93190
|
-
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
93191
93480
|
const temp2 = factory2.createTempVariable(
|
|
93192
93481
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
93193
93482
|
/*reservedInNestedScopes*/
|
|
@@ -93755,7 +94044,7 @@ function transformClassFields(context) {
|
|
|
93755
94044
|
const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
93756
94045
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
93757
94046
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
93758
|
-
if (resolver.
|
|
94047
|
+
if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93759
94048
|
addBlockScopedVariable(generatedName);
|
|
93760
94049
|
} else {
|
|
93761
94050
|
hoistVariableDeclaration(generatedName);
|
|
@@ -93909,7 +94198,7 @@ function transformClassFields(context) {
|
|
|
93909
94198
|
prefix,
|
|
93910
94199
|
suffix
|
|
93911
94200
|
);
|
|
93912
|
-
if (resolver.
|
|
94201
|
+
if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93913
94202
|
addBlockScopedVariable(identifier);
|
|
93914
94203
|
} else {
|
|
93915
94204
|
hoistVariableDeclaration(identifier);
|
|
@@ -94148,7 +94437,7 @@ function transformClassFields(context) {
|
|
|
94148
94437
|
}
|
|
94149
94438
|
function trySubstituteClassAlias(node) {
|
|
94150
94439
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
94151
|
-
if (resolver.
|
|
94440
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
94152
94441
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
94153
94442
|
if (declaration) {
|
|
94154
94443
|
const classAlias = classAliases[declaration.id];
|
|
@@ -95015,7 +95304,7 @@ function transformLegacyDecorators(context) {
|
|
|
95015
95304
|
}
|
|
95016
95305
|
}
|
|
95017
95306
|
function getClassAliasIfNeeded(node) {
|
|
95018
|
-
if (resolver.
|
|
95307
|
+
if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
|
|
95019
95308
|
enableSubstitutionForClassAliases();
|
|
95020
95309
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
95021
95310
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -95048,7 +95337,7 @@ function transformLegacyDecorators(context) {
|
|
|
95048
95337
|
}
|
|
95049
95338
|
function trySubstituteClassAlias(node) {
|
|
95050
95339
|
if (classAliases) {
|
|
95051
|
-
if (resolver.
|
|
95340
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
95052
95341
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95053
95342
|
if (declaration) {
|
|
95054
95343
|
const classAlias = classAliases[declaration.id];
|
|
@@ -97357,7 +97646,7 @@ function transformES2017(context) {
|
|
|
97357
97646
|
hasSuperElementAccess = false;
|
|
97358
97647
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
97359
97648
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
97360
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97649
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
97361
97650
|
if (emitSuperHelpers) {
|
|
97362
97651
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97363
97652
|
if (capturedSuperProperties.size) {
|
|
@@ -97368,9 +97657,9 @@ function transformES2017(context) {
|
|
|
97368
97657
|
updated = factory2.updateBlock(updated, statements);
|
|
97369
97658
|
}
|
|
97370
97659
|
if (hasSuperElementAccess) {
|
|
97371
|
-
if (resolver.
|
|
97660
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97372
97661
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
97373
|
-
} else if (resolver.
|
|
97662
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97374
97663
|
addEmitHelper(updated, asyncSuperHelper);
|
|
97375
97664
|
}
|
|
97376
97665
|
}
|
|
@@ -97437,7 +97726,7 @@ function transformES2017(context) {
|
|
|
97437
97726
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
97438
97727
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
97439
97728
|
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97440
|
-
const hasLexicalArguments =
|
|
97729
|
+
const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
|
|
97441
97730
|
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
97442
97731
|
if (captureLexicalArguments) {
|
|
97443
97732
|
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
@@ -97492,7 +97781,7 @@ function transformES2017(context) {
|
|
|
97492
97781
|
)
|
|
97493
97782
|
)
|
|
97494
97783
|
);
|
|
97495
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97784
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
97496
97785
|
if (emitSuperHelpers) {
|
|
97497
97786
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97498
97787
|
if (capturedSuperProperties.size) {
|
|
@@ -97511,9 +97800,9 @@ function transformES2017(context) {
|
|
|
97511
97800
|
);
|
|
97512
97801
|
setTextRange(block, node.body);
|
|
97513
97802
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
97514
|
-
if (resolver.
|
|
97803
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97515
97804
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
97516
|
-
} else if (resolver.
|
|
97805
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97517
97806
|
addEmitHelper(block, asyncSuperHelper);
|
|
97518
97807
|
}
|
|
97519
97808
|
}
|
|
@@ -97572,7 +97861,7 @@ function transformES2017(context) {
|
|
|
97572
97861
|
}
|
|
97573
97862
|
function onEmitNode(hint, node, emitCallback) {
|
|
97574
97863
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
97575
|
-
const superContainerFlags = resolver.
|
|
97864
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
97576
97865
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
97577
97866
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
97578
97867
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -97676,7 +97965,7 @@ function transformES2017(context) {
|
|
|
97676
97965
|
}
|
|
97677
97966
|
}
|
|
97678
97967
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
97679
|
-
const hasBinding =
|
|
97968
|
+
const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
97680
97969
|
const accessors = [];
|
|
97681
97970
|
names.forEach((_, key) => {
|
|
97682
97971
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -98771,7 +99060,7 @@ function transformES2018(context) {
|
|
|
98771
99060
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
98772
99061
|
)
|
|
98773
99062
|
);
|
|
98774
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
99063
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
98775
99064
|
if (emitSuperHelpers) {
|
|
98776
99065
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98777
99066
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -98781,9 +99070,9 @@ function transformES2018(context) {
|
|
|
98781
99070
|
outerStatements.push(returnStatement);
|
|
98782
99071
|
const block = factory2.updateBlock(node.body, outerStatements);
|
|
98783
99072
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98784
|
-
if (resolver.
|
|
99073
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
98785
99074
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
98786
|
-
} else if (resolver.
|
|
99075
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
98787
99076
|
addEmitHelper(block, asyncSuperHelper);
|
|
98788
99077
|
}
|
|
98789
99078
|
}
|
|
@@ -98916,7 +99205,7 @@ function transformES2018(context) {
|
|
|
98916
99205
|
}
|
|
98917
99206
|
function onEmitNode(hint, node, emitCallback) {
|
|
98918
99207
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98919
|
-
const superContainerFlags = resolver.
|
|
99208
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
98920
99209
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98921
99210
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98922
99211
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -102621,9 +102910,8 @@ function transformES2015(context) {
|
|
|
102621
102910
|
return createRange(pos, end);
|
|
102622
102911
|
}
|
|
102623
102912
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
102624
|
-
const
|
|
102625
|
-
const
|
|
102626
|
-
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
102913
|
+
const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
|
|
102914
|
+
const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
102627
102915
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
102628
102916
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
102629
102917
|
return emitExplicitInitializer;
|
|
@@ -103074,7 +103362,7 @@ function transformES2015(context) {
|
|
|
103074
103362
|
return factory2.inlineExpressions(expressions);
|
|
103075
103363
|
}
|
|
103076
103364
|
function shouldConvertPartOfIterationStatement(node) {
|
|
103077
|
-
return
|
|
103365
|
+
return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
|
|
103078
103366
|
}
|
|
103079
103367
|
function shouldConvertInitializerOfForStatement(node) {
|
|
103080
103368
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -103089,7 +103377,7 @@ function transformES2015(context) {
|
|
|
103089
103377
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
103090
103378
|
}
|
|
103091
103379
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
103092
|
-
return
|
|
103380
|
+
return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
|
|
103093
103381
|
}
|
|
103094
103382
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
103095
103383
|
if (!state.hoistedLocalVariables) {
|
|
@@ -103638,11 +103926,11 @@ function transformES2015(context) {
|
|
|
103638
103926
|
void 0,
|
|
103639
103927
|
name
|
|
103640
103928
|
));
|
|
103641
|
-
const
|
|
103642
|
-
if (
|
|
103929
|
+
const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
|
|
103930
|
+
if (needsOutParam || hasCapturedBindingsInForHead) {
|
|
103643
103931
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
103644
103932
|
let flags = 0 /* None */;
|
|
103645
|
-
if (
|
|
103933
|
+
if (needsOutParam) {
|
|
103646
103934
|
flags |= 1 /* Body */;
|
|
103647
103935
|
}
|
|
103648
103936
|
if (isForStatement(container)) {
|
|
@@ -112665,6 +112953,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112665
112953
|
emitSkipped = true;
|
|
112666
112954
|
return;
|
|
112667
112955
|
}
|
|
112956
|
+
if (compilerOptions.noCheck) {
|
|
112957
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(markLinkedReferences);
|
|
112958
|
+
}
|
|
112668
112959
|
const transform = transformNodes(
|
|
112669
112960
|
resolver,
|
|
112670
112961
|
host,
|
|
@@ -112799,6 +113090,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112799
113090
|
}
|
|
112800
113091
|
forEachChild(node, collectLinkedAliases);
|
|
112801
113092
|
}
|
|
113093
|
+
function markLinkedReferences(file) {
|
|
113094
|
+
forEachChildRecursively(file, (n) => {
|
|
113095
|
+
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
|
|
113096
|
+
if (isImportDeclaration(n)) return "skip";
|
|
113097
|
+
resolver.markLinkedReferences(n);
|
|
113098
|
+
});
|
|
113099
|
+
}
|
|
112802
113100
|
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
112803
113101
|
const sourceFileOrBundle = transform.transformed[0];
|
|
112804
113102
|
const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
|
|
@@ -112930,10 +113228,11 @@ var notImplementedResolver = {
|
|
|
112930
113228
|
isValueAliasDeclaration: notImplemented,
|
|
112931
113229
|
isReferencedAliasDeclaration: notImplemented,
|
|
112932
113230
|
isTopLevelValueImportEqualsWithEntityName: notImplemented,
|
|
112933
|
-
|
|
113231
|
+
hasNodeCheckFlag: notImplemented,
|
|
112934
113232
|
isDeclarationVisible: notImplemented,
|
|
112935
113233
|
isLateBound: (_node) => false,
|
|
112936
113234
|
collectLinkedAliases: notImplemented,
|
|
113235
|
+
markLinkedReferences: notImplemented,
|
|
112937
113236
|
isImplementationOfOverload: notImplemented,
|
|
112938
113237
|
requiresAddingImplicitUndefined: notImplemented,
|
|
112939
113238
|
isExpandoFunctionDeclaration: notImplemented,
|
|
@@ -121023,9 +121322,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121023
121322
|
if (options.noEmit) {
|
|
121024
121323
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
|
121025
121324
|
}
|
|
121026
|
-
if (!options.emitDeclarationOnly) {
|
|
121027
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
|
121028
|
-
}
|
|
121029
121325
|
}
|
|
121030
121326
|
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
|
|
121031
121327
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|