typescript 5.5.0-dev.20240530 → 5.5.0-dev.20240601
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 +529 -143
- package/lib/typescript.js +551 -190
- 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.20240601`;
|
|
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";
|
|
@@ -9758,7 +9795,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9758
9795
|
pos++;
|
|
9759
9796
|
let regExpFlags = 0 /* None */;
|
|
9760
9797
|
while (true) {
|
|
9761
|
-
const ch =
|
|
9798
|
+
const ch = charCodeChecked(pos);
|
|
9762
9799
|
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
9763
9800
|
break;
|
|
9764
9801
|
}
|
|
@@ -11009,10 +11046,10 @@ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit
|
|
|
11009
11046
|
var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
|
|
11010
11047
|
var valuesOfNonBinaryUnicodeProperties = {
|
|
11011
11048
|
General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
|
|
11012
|
-
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "
|
|
11013
|
-
Script_Extensions:
|
|
11014
|
-
// Currently empty
|
|
11049
|
+
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
|
|
11050
|
+
Script_Extensions: void 0
|
|
11015
11051
|
};
|
|
11052
|
+
valuesOfNonBinaryUnicodeProperties.Script_Extensions = valuesOfNonBinaryUnicodeProperties.Script;
|
|
11016
11053
|
|
|
11017
11054
|
// src/compiler/utilitiesPublic.ts
|
|
11018
11055
|
function isExternalModuleNameRelative(moduleName) {
|
|
@@ -13602,6 +13639,26 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
13602
13639
|
const pos2 = skipTrivia(sourceFile.text, node.tagName.pos);
|
|
13603
13640
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
13604
13641
|
}
|
|
13642
|
+
case 176 /* Constructor */: {
|
|
13643
|
+
const constructorDeclaration = node;
|
|
13644
|
+
const start = skipTrivia(sourceFile.text, constructorDeclaration.pos);
|
|
13645
|
+
const scanner = createScanner(
|
|
13646
|
+
sourceFile.languageVersion,
|
|
13647
|
+
/*skipTrivia*/
|
|
13648
|
+
true,
|
|
13649
|
+
sourceFile.languageVariant,
|
|
13650
|
+
sourceFile.text,
|
|
13651
|
+
/*onError*/
|
|
13652
|
+
void 0,
|
|
13653
|
+
start
|
|
13654
|
+
);
|
|
13655
|
+
let token = scanner.scan();
|
|
13656
|
+
while (token !== 137 /* ConstructorKeyword */ && token !== 1 /* EndOfFileToken */) {
|
|
13657
|
+
token = scanner.scan();
|
|
13658
|
+
}
|
|
13659
|
+
const end = scanner.getTokenEnd();
|
|
13660
|
+
return createTextSpanFromBounds(start, end);
|
|
13661
|
+
}
|
|
13605
13662
|
}
|
|
13606
13663
|
if (errorNode === void 0) {
|
|
13607
13664
|
return getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -18261,7 +18318,15 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
|
18261
18318
|
return { pos, end };
|
|
18262
18319
|
}
|
|
18263
18320
|
function skipTypeChecking(sourceFile, options, host) {
|
|
18264
|
-
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
|
|
18321
|
+
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnsotics(sourceFile, options);
|
|
18322
|
+
}
|
|
18323
|
+
function canIncludeBindAndCheckDiagnsotics(sourceFile, options) {
|
|
18324
|
+
if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
|
|
18325
|
+
if (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */) return true;
|
|
18326
|
+
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
18327
|
+
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
18328
|
+
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
18329
|
+
return isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */;
|
|
18265
18330
|
}
|
|
18266
18331
|
function isJsonEqual(a, b) {
|
|
18267
18332
|
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
|
|
@@ -35891,7 +35956,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35891
35956
|
showInSimplifiedHelpView: false,
|
|
35892
35957
|
category: Diagnostics.Compiler_Diagnostics,
|
|
35893
35958
|
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
35894
|
-
transpileOptionValue:
|
|
35959
|
+
transpileOptionValue: true,
|
|
35895
35960
|
defaultValueDescription: false,
|
|
35896
35961
|
affectsSemanticDiagnostics: true,
|
|
35897
35962
|
affectsBuildInfo: true,
|
|
@@ -45337,6 +45402,7 @@ function createTypeChecker(host) {
|
|
|
45337
45402
|
getImmediateAliasedSymbol,
|
|
45338
45403
|
getAliasedSymbol: resolveAlias,
|
|
45339
45404
|
getEmitResolver,
|
|
45405
|
+
requiresAddingImplicitUndefined,
|
|
45340
45406
|
getExportsOfModule: getExportsOfModuleAsArray,
|
|
45341
45407
|
getExportsAndPropertiesOfModule,
|
|
45342
45408
|
forEachExportAndPropertyOfModule,
|
|
@@ -47685,10 +47751,22 @@ function createTypeChecker(host) {
|
|
|
47685
47751
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
47686
47752
|
}
|
|
47687
47753
|
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
47754
|
+
var _a;
|
|
47688
47755
|
if (!(symbol.flags & 2097152 /* Alias */)) {
|
|
47689
47756
|
return void 0;
|
|
47690
47757
|
}
|
|
47691
47758
|
const links = getSymbolLinks(symbol);
|
|
47759
|
+
if (links.typeOnlyDeclaration === void 0) {
|
|
47760
|
+
links.typeOnlyDeclaration = false;
|
|
47761
|
+
const resolved = resolveSymbol(symbol);
|
|
47762
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47763
|
+
(_a = symbol.declarations) == null ? void 0 : _a[0],
|
|
47764
|
+
getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
|
|
47765
|
+
resolved,
|
|
47766
|
+
/*overwriteEmpty*/
|
|
47767
|
+
true
|
|
47768
|
+
);
|
|
47769
|
+
}
|
|
47692
47770
|
if (include === void 0) {
|
|
47693
47771
|
return links.typeOnlyDeclaration || void 0;
|
|
47694
47772
|
}
|
|
@@ -49206,7 +49284,7 @@ function createTypeChecker(host) {
|
|
|
49206
49284
|
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
49207
49285
|
}
|
|
49208
49286
|
function setTextRange2(context, range, location) {
|
|
49209
|
-
if (!nodeIsSynthesized(range)
|
|
49287
|
+
if (!nodeIsSynthesized(range) || !(range.flags & 16 /* Synthesized */) || !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(range))) {
|
|
49210
49288
|
range = factory.cloneNode(range);
|
|
49211
49289
|
}
|
|
49212
49290
|
if (range === location) return range;
|
|
@@ -50145,7 +50223,8 @@ function createTypeChecker(host) {
|
|
|
50145
50223
|
const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
|
|
50146
50224
|
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
|
50147
50225
|
typeElements.push(
|
|
50148
|
-
|
|
50226
|
+
setCommentRange2(
|
|
50227
|
+
context,
|
|
50149
50228
|
signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
|
50150
50229
|
getterDeclaration
|
|
50151
50230
|
)
|
|
@@ -50153,7 +50232,8 @@ function createTypeChecker(host) {
|
|
|
50153
50232
|
const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
|
|
50154
50233
|
const setterSignature = getSignatureFromDeclaration(setterDeclaration);
|
|
50155
50234
|
typeElements.push(
|
|
50156
|
-
|
|
50235
|
+
setCommentRange2(
|
|
50236
|
+
context,
|
|
50157
50237
|
signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
|
50158
50238
|
setterDeclaration
|
|
50159
50239
|
)
|
|
@@ -50211,11 +50291,17 @@ function createTypeChecker(host) {
|
|
|
50211
50291
|
setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
|
|
50212
50292
|
}
|
|
50213
50293
|
} else if (propertySymbol.valueDeclaration) {
|
|
50214
|
-
|
|
50294
|
+
setCommentRange2(context, node, propertySymbol.valueDeclaration);
|
|
50215
50295
|
}
|
|
50216
50296
|
return node;
|
|
50217
50297
|
}
|
|
50218
50298
|
}
|
|
50299
|
+
function setCommentRange2(context, node, range) {
|
|
50300
|
+
if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(range)) {
|
|
50301
|
+
return setCommentRange(node, range);
|
|
50302
|
+
}
|
|
50303
|
+
return node;
|
|
50304
|
+
}
|
|
50219
50305
|
function mapToTypeNodes(types, context, isBareList) {
|
|
50220
50306
|
if (some(types)) {
|
|
50221
50307
|
if (checkTruncationLength(context)) {
|
|
@@ -50991,7 +51077,7 @@ function createTypeChecker(host) {
|
|
|
50991
51077
|
return false;
|
|
50992
51078
|
}
|
|
50993
51079
|
function typeParameterToName(type, context) {
|
|
50994
|
-
var _a, _b;
|
|
51080
|
+
var _a, _b, _c, _d;
|
|
50995
51081
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
50996
51082
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
50997
51083
|
if (cached) {
|
|
@@ -51008,11 +51094,15 @@ function createTypeChecker(host) {
|
|
|
51008
51094
|
if (!(result.kind & 80 /* Identifier */)) {
|
|
51009
51095
|
return factory.createIdentifier("(Missing type parameter)");
|
|
51010
51096
|
}
|
|
51097
|
+
const decl = (_b = (_a = type.symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
51098
|
+
if (decl && isTypeParameterDeclaration(decl)) {
|
|
51099
|
+
result = setTextRange2(context, result, decl.name);
|
|
51100
|
+
}
|
|
51011
51101
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51012
51102
|
const rawtext = result.escapedText;
|
|
51013
|
-
let i = ((
|
|
51103
|
+
let i = ((_c = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _c.get(rawtext)) || 0;
|
|
51014
51104
|
let text = rawtext;
|
|
51015
|
-
while (((
|
|
51105
|
+
while (((_d = context.typeParameterNamesByText) == null ? void 0 : _d.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
51016
51106
|
i++;
|
|
51017
51107
|
text = `${rawtext}_${i}`;
|
|
51018
51108
|
}
|
|
@@ -51431,21 +51521,136 @@ function createTypeChecker(host) {
|
|
|
51431
51521
|
cancellationToken.throwIfCancellationRequested();
|
|
51432
51522
|
}
|
|
51433
51523
|
let hadError = false;
|
|
51524
|
+
const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
|
|
51434
51525
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51435
|
-
if (
|
|
51526
|
+
if (!finalizeBoundary()) {
|
|
51436
51527
|
return void 0;
|
|
51437
51528
|
}
|
|
51438
51529
|
context.approximateLength += existing.end - existing.pos;
|
|
51439
51530
|
return transformed;
|
|
51440
51531
|
function visitExistingNodeTreeSymbols(node) {
|
|
51532
|
+
if (hadError) return node;
|
|
51533
|
+
const recover = startRecoveryScope();
|
|
51441
51534
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
51442
51535
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
51443
51536
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
51444
|
-
|
|
51537
|
+
if (hadError) {
|
|
51538
|
+
if (isTypeNode(node) && !isTypePredicateNode(node)) {
|
|
51539
|
+
recover();
|
|
51540
|
+
return serializeExistingTypeNode(context, node);
|
|
51541
|
+
}
|
|
51542
|
+
return node;
|
|
51543
|
+
}
|
|
51544
|
+
return result ? setTextRange2(context, result, node) : void 0;
|
|
51545
|
+
}
|
|
51546
|
+
function createRecoveryBoundary() {
|
|
51547
|
+
let unreportedErrors;
|
|
51548
|
+
const oldTracker = context.tracker;
|
|
51549
|
+
const oldTrackedSymbols = context.trackedSymbols;
|
|
51550
|
+
context.trackedSymbols = [];
|
|
51551
|
+
const oldEncounteredError = context.encounteredError;
|
|
51552
|
+
context.tracker = new SymbolTrackerImpl(context, {
|
|
51553
|
+
...oldTracker.inner,
|
|
51554
|
+
reportCyclicStructureError() {
|
|
51555
|
+
markError(() => oldTracker.reportCyclicStructureError());
|
|
51556
|
+
},
|
|
51557
|
+
reportInaccessibleThisError() {
|
|
51558
|
+
markError(() => oldTracker.reportInaccessibleThisError());
|
|
51559
|
+
},
|
|
51560
|
+
reportInaccessibleUniqueSymbolError() {
|
|
51561
|
+
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
51562
|
+
},
|
|
51563
|
+
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
51564
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
51565
|
+
},
|
|
51566
|
+
reportNonSerializableProperty(name) {
|
|
51567
|
+
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
51568
|
+
},
|
|
51569
|
+
trackSymbol(sym, decl, meaning) {
|
|
51570
|
+
const accessibility = isSymbolAccessible(
|
|
51571
|
+
sym,
|
|
51572
|
+
decl,
|
|
51573
|
+
meaning,
|
|
51574
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51575
|
+
false
|
|
51576
|
+
);
|
|
51577
|
+
if (accessibility.accessibility !== 0 /* Accessible */) {
|
|
51578
|
+
(context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
|
|
51579
|
+
return true;
|
|
51580
|
+
}
|
|
51581
|
+
return false;
|
|
51582
|
+
},
|
|
51583
|
+
moduleResolverHost: context.tracker.moduleResolverHost
|
|
51584
|
+
}, context.tracker.moduleResolverHost);
|
|
51585
|
+
return {
|
|
51586
|
+
startRecoveryScope: startRecoveryScope2,
|
|
51587
|
+
finalizeBoundary: finalizeBoundary2
|
|
51588
|
+
};
|
|
51589
|
+
function markError(unreportedError) {
|
|
51590
|
+
hadError = true;
|
|
51591
|
+
(unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
|
|
51592
|
+
}
|
|
51593
|
+
function startRecoveryScope2() {
|
|
51594
|
+
var _a;
|
|
51595
|
+
const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
|
|
51596
|
+
const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
|
|
51597
|
+
return () => {
|
|
51598
|
+
hadError = false;
|
|
51599
|
+
if (context.trackedSymbols) {
|
|
51600
|
+
context.trackedSymbols.length = initialTrackedSymbolsTop;
|
|
51601
|
+
}
|
|
51602
|
+
if (unreportedErrors) {
|
|
51603
|
+
unreportedErrors.length = unreportedErrorsTop;
|
|
51604
|
+
}
|
|
51605
|
+
};
|
|
51606
|
+
}
|
|
51607
|
+
function finalizeBoundary2() {
|
|
51608
|
+
context.tracker = oldTracker;
|
|
51609
|
+
const newTrackedSymbols = context.trackedSymbols;
|
|
51610
|
+
context.trackedSymbols = oldTrackedSymbols;
|
|
51611
|
+
context.encounteredError = oldEncounteredError;
|
|
51612
|
+
unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
|
|
51613
|
+
if (hadError) {
|
|
51614
|
+
return false;
|
|
51615
|
+
}
|
|
51616
|
+
newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
|
|
51617
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
51618
|
+
symbol,
|
|
51619
|
+
enclosingDeclaration,
|
|
51620
|
+
meaning
|
|
51621
|
+
)
|
|
51622
|
+
);
|
|
51623
|
+
return true;
|
|
51624
|
+
}
|
|
51445
51625
|
}
|
|
51446
51626
|
function onEnterNewScope(node) {
|
|
51447
51627
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
51448
51628
|
}
|
|
51629
|
+
function tryVisitTypeReference(node) {
|
|
51630
|
+
if (canReuseTypeNode(context, node)) {
|
|
51631
|
+
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
51632
|
+
const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51633
|
+
if (!introducesError) {
|
|
51634
|
+
const updated = factory.updateTypeReferenceNode(
|
|
51635
|
+
node,
|
|
51636
|
+
newName,
|
|
51637
|
+
typeArguments
|
|
51638
|
+
);
|
|
51639
|
+
return setTextRange2(context, updated, node);
|
|
51640
|
+
} else {
|
|
51641
|
+
const serializedName = serializeTypeName(
|
|
51642
|
+
context,
|
|
51643
|
+
node.typeName,
|
|
51644
|
+
/*isTypeOf*/
|
|
51645
|
+
false,
|
|
51646
|
+
typeArguments
|
|
51647
|
+
);
|
|
51648
|
+
if (serializedName) {
|
|
51649
|
+
return setTextRange2(context, serializedName, node.typeName);
|
|
51650
|
+
}
|
|
51651
|
+
}
|
|
51652
|
+
}
|
|
51653
|
+
}
|
|
51449
51654
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
51450
51655
|
if (isJSDocTypeExpression(node)) {
|
|
51451
51656
|
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
|
|
@@ -51542,7 +51747,8 @@ function createTypeChecker(host) {
|
|
|
51542
51747
|
if (canReuseTypeNode(context, node)) {
|
|
51543
51748
|
return node;
|
|
51544
51749
|
}
|
|
51545
|
-
|
|
51750
|
+
hadError = true;
|
|
51751
|
+
return node;
|
|
51546
51752
|
}
|
|
51547
51753
|
if (isTypeParameterDeclaration(node)) {
|
|
51548
51754
|
return factory.updateTypeParameterDeclaration(
|
|
@@ -51553,31 +51759,21 @@ function createTypeChecker(host) {
|
|
|
51553
51759
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
51554
51760
|
);
|
|
51555
51761
|
}
|
|
51762
|
+
if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
|
|
51763
|
+
const objectType = tryVisitTypeReference(node.objectType);
|
|
51764
|
+
if (!objectType) {
|
|
51765
|
+
hadError = true;
|
|
51766
|
+
return node;
|
|
51767
|
+
}
|
|
51768
|
+
return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51769
|
+
}
|
|
51556
51770
|
if (isTypeReferenceNode(node)) {
|
|
51557
|
-
|
|
51558
|
-
|
|
51559
|
-
|
|
51560
|
-
if (!introducesError) {
|
|
51561
|
-
const updated = factory.updateTypeReferenceNode(
|
|
51562
|
-
node,
|
|
51563
|
-
newName,
|
|
51564
|
-
typeArguments
|
|
51565
|
-
);
|
|
51566
|
-
return setTextRange2(context, updated, node);
|
|
51567
|
-
} else {
|
|
51568
|
-
const serializedName = serializeTypeName(
|
|
51569
|
-
context,
|
|
51570
|
-
node.typeName,
|
|
51571
|
-
/*isTypeOf*/
|
|
51572
|
-
false,
|
|
51573
|
-
typeArguments
|
|
51574
|
-
);
|
|
51575
|
-
if (serializedName) {
|
|
51576
|
-
return setTextRange2(context, serializedName, node.typeName);
|
|
51577
|
-
}
|
|
51578
|
-
}
|
|
51771
|
+
const result = tryVisitTypeReference(node);
|
|
51772
|
+
if (result) {
|
|
51773
|
+
return result;
|
|
51579
51774
|
}
|
|
51580
|
-
|
|
51775
|
+
hadError = true;
|
|
51776
|
+
return node;
|
|
51581
51777
|
}
|
|
51582
51778
|
if (isLiteralImportTypeNode(node)) {
|
|
51583
51779
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -51601,12 +51797,7 @@ function createTypeChecker(host) {
|
|
|
51601
51797
|
}
|
|
51602
51798
|
}
|
|
51603
51799
|
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
51604
|
-
let visited =
|
|
51605
|
-
node,
|
|
51606
|
-
visitExistingNodeTreeSymbols,
|
|
51607
|
-
/*context*/
|
|
51608
|
-
void 0
|
|
51609
|
-
);
|
|
51800
|
+
let visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51610
51801
|
if (visited === node) {
|
|
51611
51802
|
visited = setTextRange2(context, factory.cloneNode(node), node);
|
|
51612
51803
|
}
|
|
@@ -51628,7 +51819,8 @@ function createTypeChecker(host) {
|
|
|
51628
51819
|
if (serializedName) {
|
|
51629
51820
|
return setTextRange2(context, serializedName, node.exprName);
|
|
51630
51821
|
}
|
|
51631
|
-
|
|
51822
|
+
hadError = true;
|
|
51823
|
+
return node;
|
|
51632
51824
|
}
|
|
51633
51825
|
return factory.updateTypeQueryNode(
|
|
51634
51826
|
node,
|
|
@@ -51666,12 +51858,7 @@ function createTypeChecker(host) {
|
|
|
51666
51858
|
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51667
51859
|
}
|
|
51668
51860
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51669
|
-
const visited =
|
|
51670
|
-
node,
|
|
51671
|
-
visitExistingNodeTreeSymbols,
|
|
51672
|
-
/*context*/
|
|
51673
|
-
void 0
|
|
51674
|
-
);
|
|
51861
|
+
const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51675
51862
|
const clone = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
|
|
51676
51863
|
const flags = getEmitFlags(clone);
|
|
51677
51864
|
setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
@@ -51697,17 +51884,46 @@ function createTypeChecker(host) {
|
|
|
51697
51884
|
falseType2
|
|
51698
51885
|
);
|
|
51699
51886
|
}
|
|
51700
|
-
if (isTypeOperatorNode(node)
|
|
51701
|
-
if (
|
|
51702
|
-
|
|
51887
|
+
if (isTypeOperatorNode(node)) {
|
|
51888
|
+
if (node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
|
|
51889
|
+
if (!canReuseTypeNode(context, node)) {
|
|
51890
|
+
hadError = true;
|
|
51891
|
+
return node;
|
|
51892
|
+
}
|
|
51893
|
+
} else if (node.operator === 143 /* KeyOfKeyword */) {
|
|
51894
|
+
if (isTypeReferenceNode(node.type)) {
|
|
51895
|
+
const type = tryVisitTypeReference(node.type);
|
|
51896
|
+
if (!type) {
|
|
51897
|
+
hadError = true;
|
|
51898
|
+
return node;
|
|
51899
|
+
}
|
|
51900
|
+
return factory.updateTypeOperatorNode(node, type);
|
|
51901
|
+
}
|
|
51703
51902
|
}
|
|
51704
51903
|
}
|
|
51705
|
-
return
|
|
51706
|
-
|
|
51707
|
-
|
|
51708
|
-
|
|
51709
|
-
|
|
51710
|
-
|
|
51904
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51905
|
+
function visitEachChild2(node2, visitor) {
|
|
51906
|
+
const nonlocalNode = !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(node2);
|
|
51907
|
+
return visitEachChild(
|
|
51908
|
+
node2,
|
|
51909
|
+
visitor,
|
|
51910
|
+
/*context*/
|
|
51911
|
+
void 0,
|
|
51912
|
+
nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
|
|
51913
|
+
);
|
|
51914
|
+
}
|
|
51915
|
+
function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count) {
|
|
51916
|
+
let result = visitNodes2(nodes, visitor, test, start, count);
|
|
51917
|
+
if (result) {
|
|
51918
|
+
if (result.pos !== -1 || result.end !== -1) {
|
|
51919
|
+
if (result === nodes) {
|
|
51920
|
+
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
51921
|
+
}
|
|
51922
|
+
setTextRangePosEnd(result, -1, -1);
|
|
51923
|
+
}
|
|
51924
|
+
}
|
|
51925
|
+
return result;
|
|
51926
|
+
}
|
|
51711
51927
|
function getEffectiveDotDotDotForParameter(p) {
|
|
51712
51928
|
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
|
|
51713
51929
|
}
|
|
@@ -51716,13 +51932,39 @@ function createTypeChecker(host) {
|
|
|
51716
51932
|
}
|
|
51717
51933
|
function rewriteModuleSpecifier(parent, lit) {
|
|
51718
51934
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
51719
|
-
|
|
51720
|
-
|
|
51721
|
-
|
|
51722
|
-
|
|
51723
|
-
|
|
51935
|
+
let name = lit.text;
|
|
51936
|
+
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
51937
|
+
const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
|
51938
|
+
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
|
51939
|
+
nodeSymbol,
|
|
51940
|
+
context.enclosingDeclaration,
|
|
51941
|
+
meaning,
|
|
51942
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51943
|
+
false
|
|
51944
|
+
).accessibility === 0 /* Accessible */ && lookupSymbolChain(
|
|
51945
|
+
nodeSymbol,
|
|
51946
|
+
context,
|
|
51947
|
+
meaning,
|
|
51948
|
+
/*yieldModuleSymbol*/
|
|
51949
|
+
true
|
|
51950
|
+
)[0];
|
|
51951
|
+
if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
|
|
51952
|
+
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
51953
|
+
} else {
|
|
51954
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
51955
|
+
if (targetFile) {
|
|
51956
|
+
name = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
51957
|
+
}
|
|
51958
|
+
}
|
|
51959
|
+
if (name.includes("/node_modules/")) {
|
|
51960
|
+
context.encounteredError = true;
|
|
51961
|
+
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
51962
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
51724
51963
|
}
|
|
51725
51964
|
}
|
|
51965
|
+
if (name !== lit.text) {
|
|
51966
|
+
return setOriginalNode(factory.createStringLiteral(name), lit);
|
|
51967
|
+
}
|
|
51726
51968
|
}
|
|
51727
51969
|
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
51728
51970
|
}
|
|
@@ -56747,7 +56989,16 @@ function createTypeChecker(host) {
|
|
|
56747
56989
|
}
|
|
56748
56990
|
}
|
|
56749
56991
|
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56750
|
-
|
|
56992
|
+
if (type === thisArgument) {
|
|
56993
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56994
|
+
type,
|
|
56995
|
+
thisArgument,
|
|
56996
|
+
/*needApparentType*/
|
|
56997
|
+
true
|
|
56998
|
+
));
|
|
56999
|
+
}
|
|
57000
|
+
const key = `I${getTypeId(type)},${getTypeId(thisArgument)}`;
|
|
57001
|
+
return getCachedType(key) ?? setCachedType(key, getTypeWithThisArgument(
|
|
56751
57002
|
type,
|
|
56752
57003
|
thisArgument,
|
|
56753
57004
|
/*needApparentType*/
|
|
@@ -59690,7 +59941,6 @@ function createTypeChecker(host) {
|
|
|
59690
59941
|
return links.resolvedType;
|
|
59691
59942
|
}
|
|
59692
59943
|
function getTemplateLiteralType(texts, types) {
|
|
59693
|
-
var _a, _b;
|
|
59694
59944
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
59695
59945
|
if (unionIndex >= 0) {
|
|
59696
59946
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -59698,9 +59948,6 @@ function createTypeChecker(host) {
|
|
|
59698
59948
|
if (contains(types, wildcardType)) {
|
|
59699
59949
|
return wildcardType;
|
|
59700
59950
|
}
|
|
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
59951
|
const newTypes = [];
|
|
59705
59952
|
const newTexts = [];
|
|
59706
59953
|
let text = texts[0];
|
|
@@ -69125,6 +69372,9 @@ function createTypeChecker(host) {
|
|
|
69125
69372
|
return contextualType && !isGenericType(contextualType);
|
|
69126
69373
|
}
|
|
69127
69374
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
69375
|
+
if (isNoInferType(type)) {
|
|
69376
|
+
type = type.baseType;
|
|
69377
|
+
}
|
|
69128
69378
|
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
69129
69379
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
69130
69380
|
}
|
|
@@ -69190,9 +69440,6 @@ function createTypeChecker(host) {
|
|
|
69190
69440
|
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
69191
69441
|
return markJsxAliasReferenced(location);
|
|
69192
69442
|
}
|
|
69193
|
-
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69194
|
-
return markAsyncFunctionAliasReferenced(location);
|
|
69195
|
-
}
|
|
69196
69443
|
if (isImportEqualsDeclaration(location)) {
|
|
69197
69444
|
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
69198
69445
|
return markImportEqualsAliasReferenced(location);
|
|
@@ -69202,6 +69449,9 @@ function createTypeChecker(host) {
|
|
|
69202
69449
|
if (isExportSpecifier(location)) {
|
|
69203
69450
|
return markExportSpecifierAliasReferenced(location);
|
|
69204
69451
|
}
|
|
69452
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69453
|
+
markAsyncFunctionAliasReferenced(location);
|
|
69454
|
+
}
|
|
69205
69455
|
if (!compilerOptions.emitDecoratorMetadata) {
|
|
69206
69456
|
return;
|
|
69207
69457
|
}
|
|
@@ -69539,18 +69789,12 @@ function createTypeChecker(host) {
|
|
|
69539
69789
|
}
|
|
69540
69790
|
return type;
|
|
69541
69791
|
}
|
|
69542
|
-
function
|
|
69543
|
-
if (isThisInTypeQuery(node))
|
|
69544
|
-
return checkThisExpression(node);
|
|
69545
|
-
}
|
|
69546
|
-
const symbol = getResolvedSymbol(node);
|
|
69547
|
-
if (symbol === unknownSymbol) {
|
|
69548
|
-
return errorType;
|
|
69549
|
-
}
|
|
69792
|
+
function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
|
|
69793
|
+
if (isThisInTypeQuery(node)) return;
|
|
69550
69794
|
if (symbol === argumentsSymbol) {
|
|
69551
69795
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69552
69796
|
error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
69553
|
-
return
|
|
69797
|
+
return;
|
|
69554
69798
|
}
|
|
69555
69799
|
let container = getContainingFunction(node);
|
|
69556
69800
|
if (container) {
|
|
@@ -69569,17 +69813,14 @@ function createTypeChecker(host) {
|
|
|
69569
69813
|
}
|
|
69570
69814
|
}
|
|
69571
69815
|
}
|
|
69572
|
-
return
|
|
69573
|
-
}
|
|
69574
|
-
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69575
|
-
markLinkedReferences(node, 1 /* Identifier */);
|
|
69816
|
+
return;
|
|
69576
69817
|
}
|
|
69577
69818
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69578
69819
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
69579
69820
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
69580
69821
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
69581
69822
|
}
|
|
69582
|
-
|
|
69823
|
+
const declaration = localOrExportSymbol.valueDeclaration;
|
|
69583
69824
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
69584
69825
|
if (isClassLike(declaration) && declaration.name !== node) {
|
|
69585
69826
|
let container = getThisContainer(
|
|
@@ -69606,6 +69847,27 @@ function createTypeChecker(host) {
|
|
|
69606
69847
|
}
|
|
69607
69848
|
}
|
|
69608
69849
|
checkNestedBlockScopedBinding(node, symbol);
|
|
69850
|
+
}
|
|
69851
|
+
function checkIdentifier(node, checkMode) {
|
|
69852
|
+
if (isThisInTypeQuery(node)) {
|
|
69853
|
+
return checkThisExpression(node);
|
|
69854
|
+
}
|
|
69855
|
+
const symbol = getResolvedSymbol(node);
|
|
69856
|
+
if (symbol === unknownSymbol) {
|
|
69857
|
+
return errorType;
|
|
69858
|
+
}
|
|
69859
|
+
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
|
69860
|
+
if (symbol === argumentsSymbol) {
|
|
69861
|
+
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69862
|
+
return errorType;
|
|
69863
|
+
}
|
|
69864
|
+
return getTypeOfSymbol(symbol);
|
|
69865
|
+
}
|
|
69866
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69867
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
69868
|
+
}
|
|
69869
|
+
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69870
|
+
let declaration = localOrExportSymbol.valueDeclaration;
|
|
69609
69871
|
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
69610
69872
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
69611
69873
|
if (assignmentKind) {
|
|
@@ -84616,7 +84878,6 @@ function createTypeChecker(host) {
|
|
|
84616
84878
|
if (links.isDeclarationWithCollidingName === void 0) {
|
|
84617
84879
|
const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
|
|
84618
84880
|
if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
|
|
84619
|
-
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
84620
84881
|
if (resolveName(
|
|
84621
84882
|
container.parent,
|
|
84622
84883
|
symbol.escapedName,
|
|
@@ -84627,8 +84888,8 @@ function createTypeChecker(host) {
|
|
|
84627
84888
|
false
|
|
84628
84889
|
)) {
|
|
84629
84890
|
links.isDeclarationWithCollidingName = true;
|
|
84630
|
-
} else if (
|
|
84631
|
-
const isDeclaredInLoop =
|
|
84891
|
+
} else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
|
|
84892
|
+
const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
|
|
84632
84893
|
const inLoopInitializer = isIterationStatement(
|
|
84633
84894
|
container,
|
|
84634
84895
|
/*lookInLabeledStatements*/
|
|
@@ -84710,6 +84971,9 @@ function createTypeChecker(host) {
|
|
|
84710
84971
|
if (!symbol) {
|
|
84711
84972
|
return false;
|
|
84712
84973
|
}
|
|
84974
|
+
const container = getSourceFileOfNode(symbol.valueDeclaration);
|
|
84975
|
+
const fileSymbol = container && getSymbolOfDeclaration(container);
|
|
84976
|
+
void resolveExternalModuleSymbol(fileSymbol);
|
|
84713
84977
|
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
84714
84978
|
if (target === unknownSymbol) {
|
|
84715
84979
|
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -84808,6 +85072,108 @@ function createTypeChecker(host) {
|
|
|
84808
85072
|
if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
|
|
84809
85073
|
return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
|
|
84810
85074
|
}
|
|
85075
|
+
function hasNodeCheckFlag(node, flag) {
|
|
85076
|
+
calculateNodeCheckFlagWorker(node, flag);
|
|
85077
|
+
return !!(getNodeCheckFlags(node) & flag);
|
|
85078
|
+
}
|
|
85079
|
+
function calculateNodeCheckFlagWorker(node, flag) {
|
|
85080
|
+
if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnsotics(getSourceFileOfNode(node), compilerOptions)) {
|
|
85081
|
+
return;
|
|
85082
|
+
}
|
|
85083
|
+
const links = getNodeLinks(node);
|
|
85084
|
+
if (links.calculatedFlags & flag) {
|
|
85085
|
+
return;
|
|
85086
|
+
}
|
|
85087
|
+
switch (flag) {
|
|
85088
|
+
case 16 /* SuperInstance */:
|
|
85089
|
+
case 32 /* SuperStatic */:
|
|
85090
|
+
return checkSingleSuperExpression(node);
|
|
85091
|
+
case 128 /* MethodWithSuperPropertyAccessInAsync */:
|
|
85092
|
+
case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
|
|
85093
|
+
case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
|
|
85094
|
+
return checkChildSuperExpressions(node);
|
|
85095
|
+
case 512 /* CaptureArguments */:
|
|
85096
|
+
case 8192 /* ContainsCapturedBlockScopeBinding */:
|
|
85097
|
+
case 65536 /* NeedsLoopOutParameter */:
|
|
85098
|
+
case 262144 /* ContainsConstructorReference */:
|
|
85099
|
+
return checkChildIdentifiers(node);
|
|
85100
|
+
case 536870912 /* ConstructorReference */:
|
|
85101
|
+
return checkSingleIdentifier(node);
|
|
85102
|
+
case 4096 /* LoopWithCapturedBlockScopedBinding */:
|
|
85103
|
+
case 32768 /* BlockScopedBindingInLoop */:
|
|
85104
|
+
case 16384 /* CapturedBlockScopedBinding */:
|
|
85105
|
+
return checkContainingBlockScopeBindingUses(node);
|
|
85106
|
+
default:
|
|
85107
|
+
return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
|
|
85108
|
+
}
|
|
85109
|
+
function forEachNodeRecursively(root, cb) {
|
|
85110
|
+
const rootResult = cb(root, root.parent);
|
|
85111
|
+
if (rootResult === "skip") return void 0;
|
|
85112
|
+
if (rootResult) return rootResult;
|
|
85113
|
+
return forEachChildRecursively(root, cb);
|
|
85114
|
+
}
|
|
85115
|
+
function checkSuperExpressions(node2) {
|
|
85116
|
+
const links2 = getNodeLinks(node2);
|
|
85117
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85118
|
+
links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
85119
|
+
checkSingleSuperExpression(node2);
|
|
85120
|
+
return void 0;
|
|
85121
|
+
}
|
|
85122
|
+
function checkChildSuperExpressions(node2) {
|
|
85123
|
+
forEachNodeRecursively(node2, checkSuperExpressions);
|
|
85124
|
+
}
|
|
85125
|
+
function checkSingleSuperExpression(node2) {
|
|
85126
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85127
|
+
nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
|
|
85128
|
+
if (node2.kind === 108 /* SuperKeyword */) {
|
|
85129
|
+
checkSuperExpression(node2);
|
|
85130
|
+
}
|
|
85131
|
+
}
|
|
85132
|
+
function checkIdentifiers(node2) {
|
|
85133
|
+
const links2 = getNodeLinks(node2);
|
|
85134
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85135
|
+
links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
|
|
85136
|
+
checkSingleIdentifier(node2);
|
|
85137
|
+
return void 0;
|
|
85138
|
+
}
|
|
85139
|
+
function checkChildIdentifiers(node2) {
|
|
85140
|
+
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85141
|
+
}
|
|
85142
|
+
function checkSingleIdentifier(node2) {
|
|
85143
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85144
|
+
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85145
|
+
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85146
|
+
const s = getSymbolAtLocation(
|
|
85147
|
+
node2,
|
|
85148
|
+
/*ignoreErrors*/
|
|
85149
|
+
true
|
|
85150
|
+
);
|
|
85151
|
+
if (s && s !== unknownSymbol) {
|
|
85152
|
+
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85153
|
+
}
|
|
85154
|
+
}
|
|
85155
|
+
}
|
|
85156
|
+
function checkBlockScopeBindings(node2) {
|
|
85157
|
+
const links2 = getNodeLinks(node2);
|
|
85158
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85159
|
+
links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
|
|
85160
|
+
checkSingleBlockScopeBinding(node2);
|
|
85161
|
+
return void 0;
|
|
85162
|
+
}
|
|
85163
|
+
function checkContainingBlockScopeBindingUses(node2) {
|
|
85164
|
+
const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
|
|
85165
|
+
forEachNodeRecursively(scope, checkBlockScopeBindings);
|
|
85166
|
+
}
|
|
85167
|
+
function checkSingleBlockScopeBinding(node2) {
|
|
85168
|
+
checkSingleIdentifier(node2);
|
|
85169
|
+
if (isComputedPropertyName(node2)) {
|
|
85170
|
+
checkComputedPropertyName(node2);
|
|
85171
|
+
}
|
|
85172
|
+
if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
|
|
85173
|
+
setNodeLinksForPrivateIdentifierScope(node2.parent);
|
|
85174
|
+
}
|
|
85175
|
+
}
|
|
85176
|
+
}
|
|
84811
85177
|
function getEnumMemberValue(node) {
|
|
84812
85178
|
computeEnumMemberValues(node.parent);
|
|
84813
85179
|
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
@@ -84828,7 +85194,15 @@ function createTypeChecker(host) {
|
|
|
84828
85194
|
if (node.kind === 306 /* EnumMember */) {
|
|
84829
85195
|
return getEnumMemberValue(node).value;
|
|
84830
85196
|
}
|
|
84831
|
-
|
|
85197
|
+
if (!getNodeLinks(node).resolvedSymbol) {
|
|
85198
|
+
void checkExpressionCached(node);
|
|
85199
|
+
}
|
|
85200
|
+
const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
|
|
85201
|
+
node,
|
|
85202
|
+
111551 /* Value */,
|
|
85203
|
+
/*ignoreErrors*/
|
|
85204
|
+
true
|
|
85205
|
+
) : void 0);
|
|
84832
85206
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
84833
85207
|
const member = symbol.valueDeclaration;
|
|
84834
85208
|
if (isEnumConst(member.parent)) {
|
|
@@ -85179,9 +85553,10 @@ function createTypeChecker(host) {
|
|
|
85179
85553
|
const node = getParseTreeNode(nodeIn);
|
|
85180
85554
|
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85181
85555
|
},
|
|
85182
|
-
|
|
85556
|
+
hasNodeCheckFlag: (nodeIn, flag) => {
|
|
85183
85557
|
const node = getParseTreeNode(nodeIn);
|
|
85184
|
-
|
|
85558
|
+
if (!node) return false;
|
|
85559
|
+
return hasNodeCheckFlag(node, flag);
|
|
85185
85560
|
},
|
|
85186
85561
|
isTopLevelValueImportEqualsWithEntityName,
|
|
85187
85562
|
isDeclarationVisible,
|
|
@@ -85204,6 +85579,10 @@ function createTypeChecker(host) {
|
|
|
85204
85579
|
return node ? getEnumMemberValue(node) : void 0;
|
|
85205
85580
|
},
|
|
85206
85581
|
collectLinkedAliases,
|
|
85582
|
+
markLinkedReferences: (nodeIn) => {
|
|
85583
|
+
const node = getParseTreeNode(nodeIn);
|
|
85584
|
+
return node && markLinkedReferences(node, 0 /* Unspecified */);
|
|
85585
|
+
},
|
|
85207
85586
|
getReferencedValueDeclaration,
|
|
85208
85587
|
getReferencedValueDeclarations,
|
|
85209
85588
|
getTypeReferenceSerializationKind,
|
|
@@ -86341,7 +86720,6 @@ function createTypeChecker(host) {
|
|
|
86341
86720
|
return true;
|
|
86342
86721
|
}
|
|
86343
86722
|
}
|
|
86344
|
-
return false;
|
|
86345
86723
|
}
|
|
86346
86724
|
}
|
|
86347
86725
|
if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
|
|
@@ -93010,7 +93388,7 @@ function transformClassFields(context) {
|
|
|
93010
93388
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
93011
93389
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
93012
93390
|
containsInstancePrivateElements = true;
|
|
93013
|
-
if (resolver.
|
|
93391
|
+
if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
|
|
93014
93392
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
93015
93393
|
}
|
|
93016
93394
|
} else if (isPropertyDeclaration(member)) {
|
|
@@ -93117,7 +93495,7 @@ function transformClassFields(context) {
|
|
|
93117
93495
|
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
93118
93496
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
93119
93497
|
}
|
|
93120
|
-
const isClassWithConstructorReference = resolver.
|
|
93498
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93121
93499
|
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93122
93500
|
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93123
93501
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -93179,15 +93557,14 @@ function transformClassFields(context) {
|
|
|
93179
93557
|
var _a, _b, _c;
|
|
93180
93558
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
93181
93559
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
93182
|
-
const
|
|
93183
|
-
const
|
|
93560
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93561
|
+
const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
93184
93562
|
let temp;
|
|
93185
93563
|
function createClassTempVar() {
|
|
93186
93564
|
var _a2;
|
|
93187
93565
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
93188
93566
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
93189
93567
|
}
|
|
93190
|
-
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
93191
93568
|
const temp2 = factory2.createTempVariable(
|
|
93192
93569
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
93193
93570
|
/*reservedInNestedScopes*/
|
|
@@ -93755,7 +94132,7 @@ function transformClassFields(context) {
|
|
|
93755
94132
|
const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
93756
94133
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
93757
94134
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
93758
|
-
if (resolver.
|
|
94135
|
+
if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93759
94136
|
addBlockScopedVariable(generatedName);
|
|
93760
94137
|
} else {
|
|
93761
94138
|
hoistVariableDeclaration(generatedName);
|
|
@@ -93909,7 +94286,7 @@ function transformClassFields(context) {
|
|
|
93909
94286
|
prefix,
|
|
93910
94287
|
suffix
|
|
93911
94288
|
);
|
|
93912
|
-
if (resolver.
|
|
94289
|
+
if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93913
94290
|
addBlockScopedVariable(identifier);
|
|
93914
94291
|
} else {
|
|
93915
94292
|
hoistVariableDeclaration(identifier);
|
|
@@ -94148,7 +94525,7 @@ function transformClassFields(context) {
|
|
|
94148
94525
|
}
|
|
94149
94526
|
function trySubstituteClassAlias(node) {
|
|
94150
94527
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
94151
|
-
if (resolver.
|
|
94528
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
94152
94529
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
94153
94530
|
if (declaration) {
|
|
94154
94531
|
const classAlias = classAliases[declaration.id];
|
|
@@ -95015,7 +95392,7 @@ function transformLegacyDecorators(context) {
|
|
|
95015
95392
|
}
|
|
95016
95393
|
}
|
|
95017
95394
|
function getClassAliasIfNeeded(node) {
|
|
95018
|
-
if (resolver.
|
|
95395
|
+
if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
|
|
95019
95396
|
enableSubstitutionForClassAliases();
|
|
95020
95397
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
95021
95398
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -95048,7 +95425,7 @@ function transformLegacyDecorators(context) {
|
|
|
95048
95425
|
}
|
|
95049
95426
|
function trySubstituteClassAlias(node) {
|
|
95050
95427
|
if (classAliases) {
|
|
95051
|
-
if (resolver.
|
|
95428
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
95052
95429
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95053
95430
|
if (declaration) {
|
|
95054
95431
|
const classAlias = classAliases[declaration.id];
|
|
@@ -97357,7 +97734,7 @@ function transformES2017(context) {
|
|
|
97357
97734
|
hasSuperElementAccess = false;
|
|
97358
97735
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
97359
97736
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
97360
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97737
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
97361
97738
|
if (emitSuperHelpers) {
|
|
97362
97739
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97363
97740
|
if (capturedSuperProperties.size) {
|
|
@@ -97368,9 +97745,9 @@ function transformES2017(context) {
|
|
|
97368
97745
|
updated = factory2.updateBlock(updated, statements);
|
|
97369
97746
|
}
|
|
97370
97747
|
if (hasSuperElementAccess) {
|
|
97371
|
-
if (resolver.
|
|
97748
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97372
97749
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
97373
|
-
} else if (resolver.
|
|
97750
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97374
97751
|
addEmitHelper(updated, asyncSuperHelper);
|
|
97375
97752
|
}
|
|
97376
97753
|
}
|
|
@@ -97437,7 +97814,7 @@ function transformES2017(context) {
|
|
|
97437
97814
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
97438
97815
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
97439
97816
|
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97440
|
-
const hasLexicalArguments =
|
|
97817
|
+
const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
|
|
97441
97818
|
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
97442
97819
|
if (captureLexicalArguments) {
|
|
97443
97820
|
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
@@ -97492,7 +97869,7 @@ function transformES2017(context) {
|
|
|
97492
97869
|
)
|
|
97493
97870
|
)
|
|
97494
97871
|
);
|
|
97495
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97872
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
97496
97873
|
if (emitSuperHelpers) {
|
|
97497
97874
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97498
97875
|
if (capturedSuperProperties.size) {
|
|
@@ -97511,9 +97888,9 @@ function transformES2017(context) {
|
|
|
97511
97888
|
);
|
|
97512
97889
|
setTextRange(block, node.body);
|
|
97513
97890
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
97514
|
-
if (resolver.
|
|
97891
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97515
97892
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
97516
|
-
} else if (resolver.
|
|
97893
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97517
97894
|
addEmitHelper(block, asyncSuperHelper);
|
|
97518
97895
|
}
|
|
97519
97896
|
}
|
|
@@ -97572,7 +97949,7 @@ function transformES2017(context) {
|
|
|
97572
97949
|
}
|
|
97573
97950
|
function onEmitNode(hint, node, emitCallback) {
|
|
97574
97951
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
97575
|
-
const superContainerFlags = resolver.
|
|
97952
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
97576
97953
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
97577
97954
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
97578
97955
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -97676,7 +98053,7 @@ function transformES2017(context) {
|
|
|
97676
98053
|
}
|
|
97677
98054
|
}
|
|
97678
98055
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
97679
|
-
const hasBinding =
|
|
98056
|
+
const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
97680
98057
|
const accessors = [];
|
|
97681
98058
|
names.forEach((_, key) => {
|
|
97682
98059
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -98771,7 +99148,7 @@ function transformES2018(context) {
|
|
|
98771
99148
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
98772
99149
|
)
|
|
98773
99150
|
);
|
|
98774
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
99151
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
98775
99152
|
if (emitSuperHelpers) {
|
|
98776
99153
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98777
99154
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -98781,9 +99158,9 @@ function transformES2018(context) {
|
|
|
98781
99158
|
outerStatements.push(returnStatement);
|
|
98782
99159
|
const block = factory2.updateBlock(node.body, outerStatements);
|
|
98783
99160
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98784
|
-
if (resolver.
|
|
99161
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
98785
99162
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
98786
|
-
} else if (resolver.
|
|
99163
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
98787
99164
|
addEmitHelper(block, asyncSuperHelper);
|
|
98788
99165
|
}
|
|
98789
99166
|
}
|
|
@@ -98916,7 +99293,7 @@ function transformES2018(context) {
|
|
|
98916
99293
|
}
|
|
98917
99294
|
function onEmitNode(hint, node, emitCallback) {
|
|
98918
99295
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98919
|
-
const superContainerFlags = resolver.
|
|
99296
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
98920
99297
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98921
99298
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98922
99299
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99547,10 +99924,10 @@ function transformESNext(context) {
|
|
|
99547
99924
|
function visitForOfStatement(node) {
|
|
99548
99925
|
if (isUsingVariableDeclarationList(node.initializer)) {
|
|
99549
99926
|
const forInitializer = node.initializer;
|
|
99550
|
-
|
|
99551
|
-
|
|
99552
|
-
|
|
99553
|
-
|
|
99927
|
+
const forDecl = firstOrUndefined(forInitializer.declarations) || factory2.createVariableDeclaration(factory2.createTempVariable(
|
|
99928
|
+
/*recordTempVariable*/
|
|
99929
|
+
void 0
|
|
99930
|
+
));
|
|
99554
99931
|
const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */;
|
|
99555
99932
|
const temp = factory2.getGeneratedNameForNode(forDecl.name);
|
|
99556
99933
|
const usingVar = factory2.updateVariableDeclaration(
|
|
@@ -102621,9 +102998,8 @@ function transformES2015(context) {
|
|
|
102621
102998
|
return createRange(pos, end);
|
|
102622
102999
|
}
|
|
102623
103000
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
102624
|
-
const
|
|
102625
|
-
const
|
|
102626
|
-
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
103001
|
+
const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
|
|
103002
|
+
const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
102627
103003
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
102628
103004
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
102629
103005
|
return emitExplicitInitializer;
|
|
@@ -103074,7 +103450,7 @@ function transformES2015(context) {
|
|
|
103074
103450
|
return factory2.inlineExpressions(expressions);
|
|
103075
103451
|
}
|
|
103076
103452
|
function shouldConvertPartOfIterationStatement(node) {
|
|
103077
|
-
return
|
|
103453
|
+
return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
|
|
103078
103454
|
}
|
|
103079
103455
|
function shouldConvertInitializerOfForStatement(node) {
|
|
103080
103456
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -103089,7 +103465,7 @@ function transformES2015(context) {
|
|
|
103089
103465
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
103090
103466
|
}
|
|
103091
103467
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
103092
|
-
return
|
|
103468
|
+
return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
|
|
103093
103469
|
}
|
|
103094
103470
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
103095
103471
|
if (!state.hoistedLocalVariables) {
|
|
@@ -103638,11 +104014,11 @@ function transformES2015(context) {
|
|
|
103638
104014
|
void 0,
|
|
103639
104015
|
name
|
|
103640
104016
|
));
|
|
103641
|
-
const
|
|
103642
|
-
if (
|
|
104017
|
+
const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
|
|
104018
|
+
if (needsOutParam || hasCapturedBindingsInForHead) {
|
|
103643
104019
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
103644
104020
|
let flags = 0 /* None */;
|
|
103645
|
-
if (
|
|
104021
|
+
if (needsOutParam) {
|
|
103646
104022
|
flags |= 1 /* Body */;
|
|
103647
104023
|
}
|
|
103648
104024
|
if (isForStatement(container)) {
|
|
@@ -112665,6 +113041,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112665
113041
|
emitSkipped = true;
|
|
112666
113042
|
return;
|
|
112667
113043
|
}
|
|
113044
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(
|
|
113045
|
+
(sourceFile) => {
|
|
113046
|
+
if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
|
|
113047
|
+
}
|
|
113048
|
+
);
|
|
112668
113049
|
const transform = transformNodes(
|
|
112669
113050
|
resolver,
|
|
112670
113051
|
host,
|
|
@@ -112714,9 +113095,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112714
113095
|
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
|
|
112715
113096
|
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
|
|
112716
113097
|
const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
|
|
112717
|
-
|
|
112718
|
-
|
|
112719
|
-
|
|
113098
|
+
filesForEmit.forEach((sourceFile) => {
|
|
113099
|
+
if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) {
|
|
113100
|
+
collectLinkedAliases(sourceFile);
|
|
113101
|
+
}
|
|
113102
|
+
});
|
|
112720
113103
|
const declarationTransform = transformNodes(
|
|
112721
113104
|
resolver,
|
|
112722
113105
|
host,
|
|
@@ -112799,6 +113182,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112799
113182
|
}
|
|
112800
113183
|
forEachChild(node, collectLinkedAliases);
|
|
112801
113184
|
}
|
|
113185
|
+
function markLinkedReferences(file) {
|
|
113186
|
+
forEachChildRecursively(file, (n) => {
|
|
113187
|
+
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
|
|
113188
|
+
if (isImportDeclaration(n)) return "skip";
|
|
113189
|
+
resolver.markLinkedReferences(n);
|
|
113190
|
+
});
|
|
113191
|
+
}
|
|
112802
113192
|
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
112803
113193
|
const sourceFileOrBundle = transform.transformed[0];
|
|
112804
113194
|
const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
|
|
@@ -112930,10 +113320,11 @@ var notImplementedResolver = {
|
|
|
112930
113320
|
isValueAliasDeclaration: notImplemented,
|
|
112931
113321
|
isReferencedAliasDeclaration: notImplemented,
|
|
112932
113322
|
isTopLevelValueImportEqualsWithEntityName: notImplemented,
|
|
112933
|
-
|
|
113323
|
+
hasNodeCheckFlag: notImplemented,
|
|
112934
113324
|
isDeclarationVisible: notImplemented,
|
|
112935
113325
|
isLateBound: (_node) => false,
|
|
112936
113326
|
collectLinkedAliases: notImplemented,
|
|
113327
|
+
markLinkedReferences: notImplemented,
|
|
112937
113328
|
isImplementationOfOverload: notImplemented,
|
|
112938
113329
|
requiresAddingImplicitUndefined: notImplemented,
|
|
112939
113330
|
isExpandoFunctionDeclaration: notImplemented,
|
|
@@ -119760,15 +120151,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119760
120151
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
119761
120152
|
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
119762
120153
|
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
119763
|
-
|
|
119764
|
-
|
|
119765
|
-
let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
|
|
119766
|
-
let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
|
|
120154
|
+
let bindDiagnostics = sourceFile.bindDiagnostics;
|
|
120155
|
+
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
|
|
119767
120156
|
if (isPlainJs) {
|
|
119768
120157
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
119769
120158
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
119770
120159
|
}
|
|
119771
|
-
return getMergedBindAndCheckDiagnostics(sourceFile,
|
|
120160
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
|
|
119772
120161
|
});
|
|
119773
120162
|
}
|
|
119774
120163
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
|
@@ -121023,9 +121412,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121023
121412
|
if (options.noEmit) {
|
|
121024
121413
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
|
121025
121414
|
}
|
|
121026
|
-
if (!options.emitDeclarationOnly) {
|
|
121027
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
|
121028
|
-
}
|
|
121029
121415
|
}
|
|
121030
121416
|
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
|
|
121031
121417
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|