@typescript-deploys/pr-build 4.7.0-pr-48581-7 → 4.7.0-pr-48792-4
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/cs/diagnosticMessages.generated.json +2 -0
- package/lib/de/diagnosticMessages.generated.json +2 -0
- package/lib/es/diagnosticMessages.generated.json +2 -0
- package/lib/fr/diagnosticMessages.generated.json +2 -0
- package/lib/it/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +2 -0
- package/lib/ko/diagnosticMessages.generated.json +2 -0
- package/lib/pl/diagnosticMessages.generated.json +2 -0
- package/lib/protocol.d.ts +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +2 -0
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tr/diagnosticMessages.generated.json +2 -0
- package/lib/tsc.js +304 -246
- package/lib/tsserver.js +772 -380
- package/lib/tsserverlibrary.d.ts +7 -2
- package/lib/tsserverlibrary.js +772 -380
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +531 -360
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +531 -360
- package/lib/typingsInstaller.js +354 -277
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -0
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220420";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -4854,7 +4854,6 @@ var ts;
|
|
|
4854
4854
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4855
4855
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4856
4856
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4857
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4858
4857
|
// Error handling
|
|
4859
4858
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4860
4859
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8911,6 +8910,7 @@ var ts;
|
|
|
8911
8910
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8912
8911
|
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8913
8912
|
Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
|
|
8913
|
+
Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
|
|
8914
8914
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8915
8915
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8916
8916
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -15159,6 +15159,10 @@ var ts;
|
|
|
15159
15159
|
}
|
|
15160
15160
|
}
|
|
15161
15161
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
15162
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
15163
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
15164
|
+
}
|
|
15165
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
15162
15166
|
function isLateVisibilityPaintedStatement(node) {
|
|
15163
15167
|
switch (node.kind) {
|
|
15164
15168
|
case 266 /* ImportDeclaration */:
|
|
@@ -16519,17 +16523,13 @@ var ts;
|
|
|
16519
16523
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16520
16524
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16521
16525
|
}
|
|
16522
|
-
if (ts.
|
|
16526
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16523
16527
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16524
16528
|
ts.isIdentifier(initializer.expression) &&
|
|
16525
16529
|
(initializer.expression.escapedText === "window" ||
|
|
16526
16530
|
initializer.expression.escapedText === "self" ||
|
|
16527
16531
|
initializer.expression.escapedText === "global"))) {
|
|
16528
|
-
|
|
16529
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16530
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16531
|
-
}
|
|
16532
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16532
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16533
16533
|
}
|
|
16534
16534
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16535
16535
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16737,14 +16737,14 @@ var ts;
|
|
|
16737
16737
|
}
|
|
16738
16738
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16739
16739
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16740
|
-
var _a, _b
|
|
16740
|
+
var _a, _b;
|
|
16741
16741
|
switch (node.kind) {
|
|
16742
16742
|
case 254 /* VariableDeclaration */:
|
|
16743
|
-
return node.initializer.arguments[0]
|
|
16743
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16744
16744
|
case 266 /* ImportDeclaration */:
|
|
16745
|
-
return
|
|
16745
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16746
16746
|
case 265 /* ImportEqualsDeclaration */:
|
|
16747
|
-
return
|
|
16747
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16748
16748
|
default:
|
|
16749
16749
|
ts.Debug.assertNever(node);
|
|
16750
16750
|
}
|
|
@@ -17259,7 +17259,10 @@ var ts;
|
|
|
17259
17259
|
return parent.propertyName === node;
|
|
17260
17260
|
case 275 /* ExportSpecifier */:
|
|
17261
17261
|
case 285 /* JsxAttribute */:
|
|
17262
|
-
|
|
17262
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17263
|
+
case 280 /* JsxOpeningElement */:
|
|
17264
|
+
case 281 /* JsxClosingElement */:
|
|
17265
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17263
17266
|
return true;
|
|
17264
17267
|
}
|
|
17265
17268
|
return false;
|
|
@@ -17275,21 +17278,28 @@ var ts;
|
|
|
17275
17278
|
// export = <EntityNameExpression>
|
|
17276
17279
|
// export default <EntityNameExpression>
|
|
17277
17280
|
// module.exports = <EntityNameExpression>
|
|
17278
|
-
//
|
|
17279
|
-
//
|
|
17281
|
+
// module.exports.x = <EntityNameExpression>
|
|
17282
|
+
// const x = require("...")
|
|
17283
|
+
// const { x } = require("...")
|
|
17284
|
+
// const x = require("...").y
|
|
17285
|
+
// const { x } = require("...").y
|
|
17280
17286
|
function isAliasSymbolDeclaration(node) {
|
|
17281
|
-
|
|
17287
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17282
17288
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17283
17289
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17284
17290
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17285
17291
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17286
17292
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17287
17293
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17288
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17294
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17295
|
+
return true;
|
|
17296
|
+
}
|
|
17297
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17298
|
+
ts.isPropertyAccessExpression(node)
|
|
17299
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17300
|
+
&& node.parent.left === node
|
|
17301
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17302
|
+
&& isAliasableExpression(node.parent.right));
|
|
17293
17303
|
}
|
|
17294
17304
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17295
17305
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17300,6 +17310,7 @@ var ts;
|
|
|
17300
17310
|
case 275 /* ExportSpecifier */:
|
|
17301
17311
|
case 271 /* ExportAssignment */:
|
|
17302
17312
|
case 265 /* ImportEqualsDeclaration */:
|
|
17313
|
+
case 274 /* NamespaceExport */:
|
|
17303
17314
|
return node.parent;
|
|
17304
17315
|
case 161 /* QualifiedName */:
|
|
17305
17316
|
do {
|
|
@@ -19126,6 +19137,11 @@ var ts;
|
|
|
19126
19137
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
19127
19138
|
}
|
|
19128
19139
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
19140
|
+
function isRightSideOfAccessExpression(node) {
|
|
19141
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
19142
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
19143
|
+
}
|
|
19144
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
19129
19145
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
19130
19146
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
19131
19147
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19777,6 +19793,41 @@ var ts;
|
|
|
19777
19793
|
return expr;
|
|
19778
19794
|
}
|
|
19779
19795
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19796
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19797
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19798
|
+
return walkAccessExpression(name.parent);
|
|
19799
|
+
}
|
|
19800
|
+
function walkAccessExpression(access) {
|
|
19801
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19802
|
+
var res = action(access.name);
|
|
19803
|
+
if (res !== undefined) {
|
|
19804
|
+
return res;
|
|
19805
|
+
}
|
|
19806
|
+
}
|
|
19807
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19808
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19809
|
+
var res = action(access.argumentExpression);
|
|
19810
|
+
if (res !== undefined) {
|
|
19811
|
+
return res;
|
|
19812
|
+
}
|
|
19813
|
+
}
|
|
19814
|
+
else {
|
|
19815
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19816
|
+
return undefined;
|
|
19817
|
+
}
|
|
19818
|
+
}
|
|
19819
|
+
if (isAccessExpression(access.expression)) {
|
|
19820
|
+
return walkAccessExpression(access.expression);
|
|
19821
|
+
}
|
|
19822
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19823
|
+
// End of chain at Identifier 'x.y.z'
|
|
19824
|
+
return action(access.expression);
|
|
19825
|
+
}
|
|
19826
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19827
|
+
return undefined;
|
|
19828
|
+
}
|
|
19829
|
+
}
|
|
19830
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19780
19831
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19781
19832
|
while (true) {
|
|
19782
19833
|
switch (node.kind) {
|
|
@@ -20724,6 +20775,7 @@ var ts;
|
|
|
20724
20775
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20725
20776
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
20726
20777
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20778
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20727
20779
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20728
20780
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20729
20781
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21412,6 +21464,11 @@ var ts;
|
|
|
21412
21464
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21413
21465
|
}
|
|
21414
21466
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21467
|
+
function getParameterTypeNode(parameter) {
|
|
21468
|
+
var _a;
|
|
21469
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21470
|
+
}
|
|
21471
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21415
21472
|
})(ts || (ts = {}));
|
|
21416
21473
|
/* @internal */
|
|
21417
21474
|
var ts;
|
|
@@ -33323,7 +33380,8 @@ var ts;
|
|
|
33323
33380
|
var pos = getNodePos();
|
|
33324
33381
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33325
33382
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33326
|
-
|
|
33383
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33327
33385
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33328
33386
|
}
|
|
33329
33387
|
function parseTypeParameter() {
|
|
@@ -34359,7 +34417,7 @@ var ts;
|
|
|
34359
34417
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34360
34418
|
}
|
|
34361
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34362
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34420
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34363
34421
|
}
|
|
34364
34422
|
function isYieldExpression() {
|
|
34365
34423
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34424,7 +34482,7 @@ var ts;
|
|
|
34424
34482
|
return addJSDocComment(finishNode(node, pos));
|
|
34425
34483
|
}
|
|
34426
34484
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34427
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34485
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34428
34486
|
if (triState === 0 /* False */) {
|
|
34429
34487
|
// It's definitely not a parenthesized arrow function expression.
|
|
34430
34488
|
return undefined;
|
|
@@ -34434,16 +34492,16 @@ var ts;
|
|
|
34434
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34435
34493
|
// expression instead.
|
|
34436
34494
|
return triState === 1 /* True */ ?
|
|
34437
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34438
34496
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34439
34497
|
}
|
|
34440
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34441
34499
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34442
34500
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34443
34501
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34444
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34502
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34445
34503
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34446
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34504
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34447
34505
|
}
|
|
34448
34506
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34449
34507
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34454,7 +34512,7 @@ var ts;
|
|
|
34454
34512
|
// Definitely not a parenthesized arrow function.
|
|
34455
34513
|
return 0 /* False */;
|
|
34456
34514
|
}
|
|
34457
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34515
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34458
34516
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34459
34517
|
nextToken();
|
|
34460
34518
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34474,8 +34532,13 @@ var ts;
|
|
|
34474
34532
|
// but this is probably what the user intended.
|
|
34475
34533
|
var third = nextToken();
|
|
34476
34534
|
switch (third) {
|
|
34477
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34478
34535
|
case 58 /* ColonToken */:
|
|
34536
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34537
|
+
// "a ? () : ..."
|
|
34538
|
+
return 0 /* False */;
|
|
34539
|
+
}
|
|
34540
|
+
return 1 /* True */;
|
|
34541
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34479
34542
|
case 18 /* OpenBraceToken */:
|
|
34480
34543
|
return 1 /* True */;
|
|
34481
34544
|
default:
|
|
@@ -34649,13 +34712,8 @@ var ts;
|
|
|
34649
34712
|
// This is a valid arrow function with "z" as the return type.
|
|
34650
34713
|
//
|
|
34651
34714
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34652
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34715
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34653
34716
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34654
|
-
//
|
|
34655
|
-
// For example,
|
|
34656
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34657
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34658
|
-
// be an arrow expression, so we allow a return type.
|
|
34659
34717
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34660
34718
|
return undefined;
|
|
34661
34719
|
}
|
|
@@ -34725,7 +34783,7 @@ var ts;
|
|
|
34725
34783
|
topLevel = savedTopLevel;
|
|
34726
34784
|
return node;
|
|
34727
34785
|
}
|
|
34728
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34786
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34729
34787
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34730
34788
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34731
34789
|
if (!questionToken) {
|
|
@@ -34735,7 +34793,7 @@ var ts;
|
|
|
34735
34793
|
// we do not that for the 'whenFalse' part.
|
|
34736
34794
|
var colonToken;
|
|
34737
34795
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34738
|
-
? parseAssignmentExpressionOrHigher(
|
|
34796
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34739
34797
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34740
34798
|
}
|
|
34741
34799
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35565,34 +35623,10 @@ var ts;
|
|
|
35565
35623
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35566
35624
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35567
35625
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35568
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35569
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35570
|
-
// expression.
|
|
35571
|
-
// falls through
|
|
35572
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35573
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35574
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35575
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35576
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35577
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35578
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35579
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35580
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35581
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35582
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35583
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35584
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35585
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35586
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35587
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35588
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35589
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35590
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35591
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35592
35626
|
return true;
|
|
35593
35627
|
}
|
|
35594
|
-
//
|
|
35595
|
-
return
|
|
35628
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35629
|
+
return !isStartOfExpression();
|
|
35596
35630
|
}
|
|
35597
35631
|
function parsePrimaryExpression() {
|
|
35598
35632
|
switch (token()) {
|
|
@@ -38810,7 +38844,7 @@ var ts;
|
|
|
38810
38844
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38811
38845
|
/** @internal */
|
|
38812
38846
|
function isDeclarationFileName(fileName) {
|
|
38813
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38847
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38814
38848
|
}
|
|
38815
38849
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38816
38850
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42318,7 +42352,8 @@ var ts;
|
|
|
42318
42352
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42319
42353
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42320
42354
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42321
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42355
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42356
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42322
42357
|
})(Extensions || (Extensions = {}));
|
|
42323
42358
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42324
42359
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43263,7 +43298,21 @@ var ts;
|
|
|
43263
43298
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43264
43299
|
}
|
|
43265
43300
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43266
|
-
|
|
43301
|
+
var extensions;
|
|
43302
|
+
if (lookupConfig) {
|
|
43303
|
+
extensions = tsconfigExtensions;
|
|
43304
|
+
}
|
|
43305
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43306
|
+
extensions = [Extensions.TsOnly];
|
|
43307
|
+
if (compilerOptions.allowJs)
|
|
43308
|
+
extensions.push(Extensions.JavaScript);
|
|
43309
|
+
if (compilerOptions.resolveJsonModule)
|
|
43310
|
+
extensions.push(Extensions.Json);
|
|
43311
|
+
}
|
|
43312
|
+
else {
|
|
43313
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43314
|
+
}
|
|
43315
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43267
43316
|
}
|
|
43268
43317
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43269
43318
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43272,6 +43321,10 @@ var ts;
|
|
|
43272
43321
|
var failedLookupLocations = [];
|
|
43273
43322
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43274
43323
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43324
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43325
|
+
if (compilerOptions.noDtsResolution) {
|
|
43326
|
+
conditions.pop();
|
|
43327
|
+
}
|
|
43275
43328
|
var state = {
|
|
43276
43329
|
compilerOptions: compilerOptions,
|
|
43277
43330
|
host: host,
|
|
@@ -43279,7 +43332,7 @@ var ts;
|
|
|
43279
43332
|
failedLookupLocations: failedLookupLocations,
|
|
43280
43333
|
packageJsonInfoCache: cache,
|
|
43281
43334
|
features: features,
|
|
43282
|
-
conditions:
|
|
43335
|
+
conditions: conditions,
|
|
43283
43336
|
};
|
|
43284
43337
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43285
43338
|
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
@@ -43455,9 +43508,9 @@ var ts;
|
|
|
43455
43508
|
}
|
|
43456
43509
|
}
|
|
43457
43510
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43458
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43511
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43459
43512
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43460
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43513
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43461
43514
|
}
|
|
43462
43515
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43463
43516
|
}
|
|
@@ -43487,20 +43540,22 @@ var ts;
|
|
|
43487
43540
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43488
43541
|
}
|
|
43489
43542
|
case Extensions.TypeScript:
|
|
43543
|
+
case Extensions.TsOnly:
|
|
43544
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43490
43545
|
switch (originalExtension) {
|
|
43491
43546
|
case ".mjs" /* Mjs */:
|
|
43492
43547
|
case ".mts" /* Mts */:
|
|
43493
43548
|
case ".d.mts" /* Dmts */:
|
|
43494
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43549
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43495
43550
|
case ".cjs" /* Cjs */:
|
|
43496
43551
|
case ".cts" /* Cts */:
|
|
43497
43552
|
case ".d.cts" /* Dcts */:
|
|
43498
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43553
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43499
43554
|
case ".json" /* Json */:
|
|
43500
43555
|
candidate += ".json" /* Json */;
|
|
43501
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43556
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43502
43557
|
default:
|
|
43503
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43558
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43504
43559
|
}
|
|
43505
43560
|
case Extensions.JavaScript:
|
|
43506
43561
|
switch (originalExtension) {
|
|
@@ -43727,6 +43782,7 @@ var ts;
|
|
|
43727
43782
|
switch (extensions) {
|
|
43728
43783
|
case Extensions.JavaScript:
|
|
43729
43784
|
case Extensions.Json:
|
|
43785
|
+
case Extensions.TsOnly:
|
|
43730
43786
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43731
43787
|
break;
|
|
43732
43788
|
case Extensions.TypeScript:
|
|
@@ -43799,14 +43855,16 @@ var ts;
|
|
|
43799
43855
|
function extensionIsOk(extensions, extension) {
|
|
43800
43856
|
switch (extensions) {
|
|
43801
43857
|
case Extensions.JavaScript:
|
|
43802
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43858
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43803
43859
|
case Extensions.TSConfig:
|
|
43804
43860
|
case Extensions.Json:
|
|
43805
43861
|
return extension === ".json" /* Json */;
|
|
43806
43862
|
case Extensions.TypeScript:
|
|
43807
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43863
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43864
|
+
case Extensions.TsOnly:
|
|
43865
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43808
43866
|
case Extensions.DtsOnly:
|
|
43809
|
-
return extension === ".d.ts" /* Dts */;
|
|
43867
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43810
43868
|
}
|
|
43811
43869
|
}
|
|
43812
43870
|
/* @internal */
|
|
@@ -45966,6 +46024,7 @@ var ts;
|
|
|
45966
46024
|
case 261 /* ModuleDeclaration */:
|
|
45967
46025
|
case 259 /* TypeAliasDeclaration */:
|
|
45968
46026
|
case 195 /* MappedType */:
|
|
46027
|
+
case 176 /* IndexSignature */:
|
|
45969
46028
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45970
46029
|
case 305 /* SourceFile */:
|
|
45971
46030
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45984,7 +46043,6 @@ var ts;
|
|
|
45984
46043
|
case 317 /* JSDocFunctionType */:
|
|
45985
46044
|
case 179 /* FunctionType */:
|
|
45986
46045
|
case 175 /* ConstructSignature */:
|
|
45987
|
-
case 176 /* IndexSignature */:
|
|
45988
46046
|
case 180 /* ConstructorType */:
|
|
45989
46047
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45990
46048
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50562,27 +50620,27 @@ var ts;
|
|
|
50562
50620
|
function resolveAlias(symbol) {
|
|
50563
50621
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50564
50622
|
var links = getSymbolLinks(symbol);
|
|
50565
|
-
if (!links.
|
|
50566
|
-
links.
|
|
50623
|
+
if (!links.aliasTarget) {
|
|
50624
|
+
links.aliasTarget = resolvingSymbol;
|
|
50567
50625
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50568
50626
|
if (!node)
|
|
50569
50627
|
return ts.Debug.fail();
|
|
50570
50628
|
var target = getTargetOfAliasDeclaration(node);
|
|
50571
|
-
if (links.
|
|
50572
|
-
links.
|
|
50629
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50630
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50573
50631
|
}
|
|
50574
50632
|
else {
|
|
50575
50633
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50576
50634
|
}
|
|
50577
50635
|
}
|
|
50578
|
-
else if (links.
|
|
50579
|
-
links.
|
|
50636
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50637
|
+
links.aliasTarget = unknownSymbol;
|
|
50580
50638
|
}
|
|
50581
|
-
return links.
|
|
50639
|
+
return links.aliasTarget;
|
|
50582
50640
|
}
|
|
50583
50641
|
function tryResolveAlias(symbol) {
|
|
50584
50642
|
var links = getSymbolLinks(symbol);
|
|
50585
|
-
if (links.
|
|
50643
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50586
50644
|
return resolveAlias(symbol);
|
|
50587
50645
|
}
|
|
50588
50646
|
return undefined;
|
|
@@ -52379,13 +52437,37 @@ var ts;
|
|
|
52379
52437
|
return ts.Debug.fail("Should be unreachable.");
|
|
52380
52438
|
function conditionalTypeToTypeNode(type) {
|
|
52381
52439
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52440
|
+
context.approximateLength += 15;
|
|
52441
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52442
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52443
|
+
var name = typeParameterToName(newParam, context);
|
|
52444
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52445
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52446
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52447
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52448
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52449
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52450
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52451
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52452
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52453
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52454
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52455
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52456
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52457
|
+
// this is potentially simplifiable to
|
|
52458
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52459
|
+
// but that may confuse users who read the output more.
|
|
52460
|
+
// On the other hand,
|
|
52461
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52462
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52463
|
+
return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
|
|
52464
|
+
}
|
|
52382
52465
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52383
52466
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52384
52467
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52385
52468
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52386
52469
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52387
52470
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52388
|
-
context.approximateLength += 15;
|
|
52389
52471
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52390
52472
|
}
|
|
52391
52473
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -52499,7 +52581,7 @@ var ts;
|
|
|
52499
52581
|
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
|
52500
52582
|
// of types allows us to catch circular references to instantiations of the same anonymous type
|
|
52501
52583
|
if (!context.visitedTypes) {
|
|
52502
|
-
context.visitedTypes = new ts.
|
|
52584
|
+
context.visitedTypes = new ts.Set();
|
|
52503
52585
|
}
|
|
52504
52586
|
if (id && !context.symbolDepth) {
|
|
52505
52587
|
context.symbolDepth = new ts.Map();
|
|
@@ -52517,22 +52599,15 @@ var ts;
|
|
|
52517
52599
|
context.approximateLength += cachedResult.addedLength;
|
|
52518
52600
|
return deepCloneOrReuseNode(cachedResult);
|
|
52519
52601
|
}
|
|
52520
|
-
var
|
|
52521
|
-
var symbolDepth = id ? context.symbolDepth.get(id) : undefined;
|
|
52522
|
-
if (symbolDepth) {
|
|
52523
|
-
totalDepth += symbolDepth;
|
|
52524
|
-
}
|
|
52525
|
-
var visitedTypeDepth = context.visitedTypes.get(typeId);
|
|
52526
|
-
if (visitedTypeDepth) {
|
|
52527
|
-
totalDepth += visitedTypeDepth;
|
|
52528
|
-
}
|
|
52529
|
-
if (totalDepth > 10) {
|
|
52530
|
-
return createElidedInformationPlaceholder(context);
|
|
52531
|
-
}
|
|
52602
|
+
var depth;
|
|
52532
52603
|
if (id) {
|
|
52533
|
-
context.symbolDepth.
|
|
52604
|
+
depth = context.symbolDepth.get(id) || 0;
|
|
52605
|
+
if (depth > 10) {
|
|
52606
|
+
return createElidedInformationPlaceholder(context);
|
|
52607
|
+
}
|
|
52608
|
+
context.symbolDepth.set(id, depth + 1);
|
|
52534
52609
|
}
|
|
52535
|
-
context.visitedTypes.
|
|
52610
|
+
context.visitedTypes.add(typeId);
|
|
52536
52611
|
var startLength = context.approximateLength;
|
|
52537
52612
|
var result = transform(type);
|
|
52538
52613
|
var addedLength = context.approximateLength - startLength;
|
|
@@ -52543,19 +52618,9 @@ var ts;
|
|
|
52543
52618
|
result.addedLength = addedLength;
|
|
52544
52619
|
(_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
52545
52620
|
}
|
|
52546
|
-
|
|
52547
|
-
context.visitedTypes.set(typeId, visitedTypeDepth);
|
|
52548
|
-
}
|
|
52549
|
-
else {
|
|
52550
|
-
context.visitedTypes.delete(typeId);
|
|
52551
|
-
}
|
|
52621
|
+
context.visitedTypes.delete(typeId);
|
|
52552
52622
|
if (id) {
|
|
52553
|
-
|
|
52554
|
-
context.symbolDepth.set(id, symbolDepth);
|
|
52555
|
-
}
|
|
52556
|
-
else {
|
|
52557
|
-
context.symbolDepth.delete(id);
|
|
52558
|
-
}
|
|
52623
|
+
context.symbolDepth.set(id, depth);
|
|
52559
52624
|
}
|
|
52560
52625
|
return result;
|
|
52561
52626
|
function deepCloneOrReuseNode(node) {
|
|
@@ -53101,9 +53166,6 @@ var ts;
|
|
|
53101
53166
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
53102
53167
|
parameterType = getOptionalType(parameterType);
|
|
53103
53168
|
}
|
|
53104
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
53105
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
53106
|
-
}
|
|
53107
53169
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
53108
53170
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
53109
53171
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53662,7 +53724,7 @@ var ts;
|
|
|
53662
53724
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53663
53725
|
// try to reuse the existing annotation
|
|
53664
53726
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53665
|
-
if (
|
|
53727
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53666
53728
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53667
53729
|
if (result_6) {
|
|
53668
53730
|
return result_6;
|
|
@@ -53679,6 +53741,16 @@ var ts;
|
|
|
53679
53741
|
context.flags = oldFlags;
|
|
53680
53742
|
return result;
|
|
53681
53743
|
}
|
|
53744
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53745
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53746
|
+
if (typeFromTypeNode === type) {
|
|
53747
|
+
return true;
|
|
53748
|
+
}
|
|
53749
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53750
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53751
|
+
}
|
|
53752
|
+
return false;
|
|
53753
|
+
}
|
|
53682
53754
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53683
53755
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53684
53756
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55950,7 +56022,7 @@ var ts;
|
|
|
55950
56022
|
}
|
|
55951
56023
|
}
|
|
55952
56024
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55953
|
-
type = getUnionType(sourceTypes
|
|
56025
|
+
type = getUnionType(sourceTypes);
|
|
55954
56026
|
}
|
|
55955
56027
|
}
|
|
55956
56028
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58699,8 +58771,9 @@ var ts;
|
|
|
58699
58771
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58700
58772
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58701
58773
|
// nesting, so it is effectively just a safety stop.
|
|
58702
|
-
|
|
58703
|
-
|
|
58774
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58775
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58776
|
+
stack.push(identity_1);
|
|
58704
58777
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58705
58778
|
stack.pop();
|
|
58706
58779
|
}
|
|
@@ -62056,11 +62129,14 @@ var ts;
|
|
|
62056
62129
|
return type[cache] = elementType;
|
|
62057
62130
|
}
|
|
62058
62131
|
}
|
|
62059
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
62060
|
-
//
|
|
62061
|
-
// construct the type Box<T[X]>.
|
|
62062
|
-
if (isGenericMappedType(objectType)
|
|
62063
|
-
|
|
62132
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
62133
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
62134
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
62135
|
+
if (isGenericMappedType(objectType)) {
|
|
62136
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
62137
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
62138
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
62139
|
+
}
|
|
62064
62140
|
}
|
|
62065
62141
|
return type[cache] = type;
|
|
62066
62142
|
}
|
|
@@ -66898,12 +66974,12 @@ var ts;
|
|
|
66898
66974
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66899
66975
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66900
66976
|
if (depth >= maxDepth) {
|
|
66901
|
-
var
|
|
66977
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66902
66978
|
var count = 0;
|
|
66903
66979
|
var lastTypeId = 0;
|
|
66904
66980
|
for (var i = 0; i < depth; i++) {
|
|
66905
66981
|
var t = stack[i];
|
|
66906
|
-
if (getRecursionIdentity(t) ===
|
|
66982
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66907
66983
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66908
66984
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66909
66985
|
if (t.id >= lastTypeId) {
|
|
@@ -74380,10 +74456,15 @@ var ts;
|
|
|
74380
74456
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74381
74457
|
}
|
|
74382
74458
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74459
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74460
|
+
// here even if `Foo` is not a const enum.
|
|
74461
|
+
//
|
|
74383
74462
|
// The exceptions are:
|
|
74384
74463
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74385
74464
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74386
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74465
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74466
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74467
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74387
74468
|
markAliasReferenced(parentSymbol, node);
|
|
74388
74469
|
}
|
|
74389
74470
|
var propType;
|
|
@@ -76905,7 +76986,7 @@ var ts;
|
|
|
76905
76986
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76906
76987
|
newSymbol.parent = originalSymbol;
|
|
76907
76988
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76908
|
-
newSymbol.
|
|
76989
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76909
76990
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76910
76991
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76911
76992
|
}
|
|
@@ -79717,19 +79798,28 @@ var ts;
|
|
|
79717
79798
|
if (constraintType && defaultType) {
|
|
79718
79799
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79719
79800
|
}
|
|
79720
|
-
|
|
79801
|
+
checkNodeDeferred(node);
|
|
79802
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79803
|
+
}
|
|
79804
|
+
function checkTypeParameterDeferred(node) {
|
|
79805
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79806
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79721
79807
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79722
|
-
if (modifiers
|
|
79808
|
+
if (modifiers) {
|
|
79723
79809
|
var symbol = getSymbolOfNode(node.parent);
|
|
79724
|
-
|
|
79725
|
-
|
|
79726
|
-
|
|
79727
|
-
|
|
79728
|
-
|
|
79729
|
-
|
|
79810
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79811
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79812
|
+
}
|
|
79813
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79814
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79815
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79816
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79817
|
+
varianceTypeParameter = typeParameter;
|
|
79818
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79819
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79820
|
+
}
|
|
79730
79821
|
}
|
|
79731
79822
|
}
|
|
79732
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79733
79823
|
}
|
|
79734
79824
|
function checkParameter(node) {
|
|
79735
79825
|
// Grammar checking
|
|
@@ -80219,7 +80309,7 @@ var ts;
|
|
|
80219
80309
|
superCallStatement = statement;
|
|
80220
80310
|
break;
|
|
80221
80311
|
}
|
|
80222
|
-
if (
|
|
80312
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80223
80313
|
break;
|
|
80224
80314
|
}
|
|
80225
80315
|
}
|
|
@@ -85572,6 +85662,9 @@ var ts;
|
|
|
85572
85662
|
case 226 /* ClassExpression */:
|
|
85573
85663
|
checkClassExpressionDeferred(node);
|
|
85574
85664
|
break;
|
|
85665
|
+
case 163 /* TypeParameter */:
|
|
85666
|
+
checkTypeParameterDeferred(node);
|
|
85667
|
+
break;
|
|
85575
85668
|
case 279 /* JsxSelfClosingElement */:
|
|
85576
85669
|
checkJsxSelfClosingElementDeferred(node);
|
|
85577
85670
|
break;
|
|
@@ -86106,15 +86199,20 @@ var ts;
|
|
|
86106
86199
|
return propertyDeclaration;
|
|
86107
86200
|
}
|
|
86108
86201
|
}
|
|
86109
|
-
else if (ts.isMetaProperty(parent)) {
|
|
86110
|
-
|
|
86111
|
-
|
|
86112
|
-
if (propertyDeclaration) {
|
|
86113
|
-
return propertyDeclaration;
|
|
86114
|
-
}
|
|
86115
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86202
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86203
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86204
|
+
// `target` in `new.target`
|
|
86116
86205
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
86117
86206
|
}
|
|
86207
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86208
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86209
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86210
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86211
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86212
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86213
|
+
}
|
|
86214
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86215
|
+
return undefined;
|
|
86118
86216
|
}
|
|
86119
86217
|
}
|
|
86120
86218
|
switch (node.kind) {
|
|
@@ -86386,11 +86484,11 @@ var ts;
|
|
|
86386
86484
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86387
86485
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86388
86486
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86389
|
-
: ts.singleElementArray(
|
|
86487
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86390
86488
|
}
|
|
86391
86489
|
return undefined;
|
|
86392
86490
|
}
|
|
86393
|
-
function
|
|
86491
|
+
function tryGetTarget(symbol) {
|
|
86394
86492
|
var target;
|
|
86395
86493
|
var next = symbol;
|
|
86396
86494
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86620,7 +86718,7 @@ var ts;
|
|
|
86620
86718
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86621
86719
|
return true;
|
|
86622
86720
|
}
|
|
86623
|
-
var target = getSymbolLinks(symbol).
|
|
86721
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86624
86722
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86625
86723
|
target.flags & 111551 /* Value */ &&
|
|
86626
86724
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86668,11 +86766,6 @@ var ts;
|
|
|
86668
86766
|
!parameter.initializer &&
|
|
86669
86767
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86670
86768
|
}
|
|
86671
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86672
|
-
return !!strictNullChecks &&
|
|
86673
|
-
isOptionalParameter(parameter) &&
|
|
86674
|
-
!parameter.initializer;
|
|
86675
|
-
}
|
|
86676
86769
|
function isExpandoFunctionDeclaration(node) {
|
|
86677
86770
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86678
86771
|
if (!declaration) {
|
|
@@ -87589,8 +87682,7 @@ var ts;
|
|
|
87589
87682
|
case 144 /* OutKeyword */:
|
|
87590
87683
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87591
87684
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87592
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87593
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87685
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87594
87686
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87595
87687
|
}
|
|
87596
87688
|
if (flags & inOutFlag) {
|
|
@@ -92824,11 +92916,11 @@ var ts;
|
|
|
92824
92916
|
}
|
|
92825
92917
|
var statements = [];
|
|
92826
92918
|
resumeLexicalEnvironment();
|
|
92827
|
-
var
|
|
92828
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92919
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92920
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92829
92921
|
// If there was a super call, visit existing statements up to and including it
|
|
92830
92922
|
if (superStatementIndex >= 0) {
|
|
92831
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92923
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92832
92924
|
}
|
|
92833
92925
|
// Transform parameters into property assignments. Transforms this:
|
|
92834
92926
|
//
|
|
@@ -92847,12 +92939,12 @@ var ts;
|
|
|
92847
92939
|
if (superStatementIndex >= 0) {
|
|
92848
92940
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92849
92941
|
}
|
|
92850
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92942
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92851
92943
|
else {
|
|
92852
|
-
statements =
|
|
92944
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92853
92945
|
}
|
|
92854
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92855
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92946
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92947
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92856
92948
|
// End the lexical environment.
|
|
92857
92949
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92858
92950
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -94798,7 +94890,7 @@ var ts;
|
|
|
94798
94890
|
}
|
|
94799
94891
|
resumeLexicalEnvironment();
|
|
94800
94892
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94801
|
-
var
|
|
94893
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94802
94894
|
var prologueStatementCount = 0;
|
|
94803
94895
|
var superStatementIndex = -1;
|
|
94804
94896
|
var statements = [];
|
|
@@ -94807,8 +94899,11 @@ var ts;
|
|
|
94807
94899
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94808
94900
|
// If there was a super call, visit existing statements up to and including it
|
|
94809
94901
|
if (superStatementIndex >= 0) {
|
|
94810
|
-
|
|
94811
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94902
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94903
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
94904
|
+
}
|
|
94905
|
+
else if (prologueStatementCount >= 0) {
|
|
94906
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94812
94907
|
}
|
|
94813
94908
|
}
|
|
94814
94909
|
if (needsSyntheticConstructor) {
|
|
@@ -94844,22 +94939,20 @@ var ts;
|
|
|
94844
94939
|
}
|
|
94845
94940
|
}
|
|
94846
94941
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94847
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94942
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94848
94943
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94849
94944
|
if (superStatementIndex >= 0) {
|
|
94850
94945
|
ts.addRange(statements, parameterProperties);
|
|
94851
94946
|
}
|
|
94852
|
-
// If a synthetic super() call was added, add them just after it
|
|
94853
|
-
else if (needsSyntheticConstructor) {
|
|
94854
|
-
statements = __spreadArray(__spreadArray([
|
|
94855
|
-
statements[0]
|
|
94856
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94857
|
-
}
|
|
94858
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94859
94947
|
else {
|
|
94860
|
-
|
|
94948
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94949
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94950
|
+
// If a synthetic super() call was added, need to account for that
|
|
94951
|
+
if (needsSyntheticConstructor)
|
|
94952
|
+
superAndPrologueStatementCount++;
|
|
94953
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94861
94954
|
}
|
|
94862
|
-
|
|
94955
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94863
94956
|
}
|
|
94864
94957
|
}
|
|
94865
94958
|
}
|
|
@@ -94869,7 +94962,7 @@ var ts;
|
|
|
94869
94962
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94870
94963
|
// Add existing statements after the initial prologues and super call
|
|
94871
94964
|
if (constructor) {
|
|
94872
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94965
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94873
94966
|
}
|
|
94874
94967
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94875
94968
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -98910,7 +99003,7 @@ var ts;
|
|
|
98910
99003
|
// ```
|
|
98911
99004
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98912
99005
|
}
|
|
98913
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
99006
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98914
99007
|
/*location*/ constructor.body.statements),
|
|
98915
99008
|
/*multiLine*/ true);
|
|
98916
99009
|
ts.setTextRange(body, constructor.body);
|
|
@@ -108616,6 +108709,10 @@ var ts;
|
|
|
108616
108709
|
return factory.updateModifiers(statement, modifiers);
|
|
108617
108710
|
}
|
|
108618
108711
|
function transformTopLevelDeclaration(input) {
|
|
108712
|
+
if (lateMarkedStatements) {
|
|
108713
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108714
|
+
;
|
|
108715
|
+
}
|
|
108619
108716
|
if (shouldStripInternal(input))
|
|
108620
108717
|
return;
|
|
108621
108718
|
switch (input.kind) {
|
|
@@ -109747,7 +109844,7 @@ var ts;
|
|
|
109747
109844
|
addOutput(buildInfoPath);
|
|
109748
109845
|
}
|
|
109749
109846
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109750
|
-
if (ts.
|
|
109847
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109751
109848
|
return;
|
|
109752
109849
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109753
109850
|
addOutput(js);
|
|
@@ -109792,7 +109889,7 @@ var ts;
|
|
|
109792
109889
|
/*@internal*/
|
|
109793
109890
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109794
109891
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109795
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109892
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.isDeclarationFileName(file); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
109796
109893
|
}
|
|
109797
109894
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109798
109895
|
/*@internal*/
|
|
@@ -109834,7 +109931,7 @@ var ts;
|
|
|
109834
109931
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109835
109932
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109836
109933
|
var inputFileName = _b[_a];
|
|
109837
|
-
if (ts.
|
|
109934
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109838
109935
|
continue;
|
|
109839
109936
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109840
109937
|
if (jsFilePath)
|
|
@@ -115184,7 +115281,7 @@ var ts;
|
|
|
115184
115281
|
if (ts.outFile(options) || options.outDir)
|
|
115185
115282
|
return false;
|
|
115186
115283
|
// File if emitted next to input needs to be ignored
|
|
115187
|
-
if (ts.
|
|
115284
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
115188
115285
|
// If its declaration directory: its not ignored if not excluded by config
|
|
115189
115286
|
if (options.declarationDir)
|
|
115190
115287
|
return false;
|
|
@@ -116357,7 +116454,7 @@ var ts;
|
|
|
116357
116454
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116358
116455
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116359
116456
|
var fileName = _c[_b];
|
|
116360
|
-
if (!ts.
|
|
116457
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116361
116458
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116362
116459
|
}
|
|
116363
116460
|
}
|
|
@@ -116548,7 +116645,7 @@ var ts;
|
|
|
116548
116645
|
}
|
|
116549
116646
|
function getRedirectReferenceForResolution(file) {
|
|
116550
116647
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116551
|
-
if (redirect || !ts.
|
|
116648
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116552
116649
|
return redirect;
|
|
116553
116650
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116554
116651
|
// So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case
|
|
@@ -117939,7 +118036,7 @@ var ts;
|
|
|
117939
118036
|
}
|
|
117940
118037
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117941
118038
|
// Ignore dts or any json files
|
|
117942
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
118039
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117943
118040
|
return undefined;
|
|
117944
118041
|
}
|
|
117945
118042
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117988,7 +118085,7 @@ var ts;
|
|
|
117988
118085
|
else {
|
|
117989
118086
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117990
118087
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117991
|
-
if (!ts.
|
|
118088
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117992
118089
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117993
118090
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117994
118091
|
}
|
|
@@ -118789,7 +118886,7 @@ var ts;
|
|
|
118789
118886
|
if (options.outDir) {
|
|
118790
118887
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118791
118888
|
}
|
|
118792
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118889
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118793
118890
|
// Otherwise just check if sourceFile with the name exists
|
|
118794
118891
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118795
118892
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -119122,13 +119219,9 @@ var ts;
|
|
|
119122
119219
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
119123
119220
|
var BuilderState;
|
|
119124
119221
|
(function (BuilderState) {
|
|
119125
|
-
var manyToManyPathMapCount = 0;
|
|
119126
119222
|
function createManyToManyPathMap() {
|
|
119127
119223
|
function create(forward, reverse, deleted) {
|
|
119128
|
-
var version = 0;
|
|
119129
119224
|
var map = {
|
|
119130
|
-
id: manyToManyPathMapCount++,
|
|
119131
|
-
version: function () { return version; },
|
|
119132
119225
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
119133
119226
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
119134
119227
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -119144,30 +119237,29 @@ var ts;
|
|
|
119144
119237
|
}
|
|
119145
119238
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
119146
119239
|
forward.delete(k);
|
|
119147
|
-
version++;
|
|
119148
119240
|
return true;
|
|
119149
119241
|
},
|
|
119150
119242
|
set: function (k, vSet) {
|
|
119151
|
-
|
|
119243
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
119152
119244
|
var existingVSet = forward.get(k);
|
|
119153
119245
|
forward.set(k, vSet);
|
|
119154
119246
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
119155
119247
|
if (!vSet.has(v)) {
|
|
119156
|
-
changed = true;
|
|
119157
119248
|
deleteFromMultimap(reverse, v, k);
|
|
119158
119249
|
}
|
|
119159
119250
|
});
|
|
119160
119251
|
vSet.forEach(function (v) {
|
|
119161
119252
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
119162
|
-
changed = true;
|
|
119163
119253
|
addToMultimap(reverse, v, k);
|
|
119164
119254
|
}
|
|
119165
119255
|
});
|
|
119166
|
-
if (changed) {
|
|
119167
|
-
version++;
|
|
119168
|
-
}
|
|
119169
119256
|
return map;
|
|
119170
119257
|
},
|
|
119258
|
+
clear: function () {
|
|
119259
|
+
forward.clear();
|
|
119260
|
+
reverse.clear();
|
|
119261
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119262
|
+
}
|
|
119171
119263
|
};
|
|
119172
119264
|
return map;
|
|
119173
119265
|
}
|
|
@@ -119182,11 +119274,10 @@ var ts;
|
|
|
119182
119274
|
}
|
|
119183
119275
|
set.add(v);
|
|
119184
119276
|
}
|
|
119185
|
-
function deleteFromMultimap(map, k, v
|
|
119186
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119277
|
+
function deleteFromMultimap(map, k, v) {
|
|
119187
119278
|
var set = map.get(k);
|
|
119188
119279
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
119189
|
-
if (
|
|
119280
|
+
if (!set.size) {
|
|
119190
119281
|
map.delete(k);
|
|
119191
119282
|
}
|
|
119192
119283
|
return true;
|
|
@@ -119415,7 +119506,7 @@ var ts;
|
|
|
119415
119506
|
/*forceDtsEmit*/ true);
|
|
119416
119507
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119417
119508
|
if (firstDts_1) {
|
|
119418
|
-
ts.Debug.assert(ts.
|
|
119509
|
+
ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
119419
119510
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119420
119511
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119421
119512
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119473,20 +119564,6 @@ var ts;
|
|
|
119473
119564
|
var _a;
|
|
119474
119565
|
if (exportedModulesMapCache) {
|
|
119475
119566
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119476
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119477
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119478
|
-
if (state.previousCache) {
|
|
119479
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119480
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119481
|
-
// was updated, there's no need to update again
|
|
119482
|
-
return;
|
|
119483
|
-
}
|
|
119484
|
-
state.previousCache.id = cacheId;
|
|
119485
|
-
state.previousCache.version = cacheVersion;
|
|
119486
|
-
}
|
|
119487
|
-
else {
|
|
119488
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119489
|
-
}
|
|
119490
119567
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119491
119568
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119492
119569
|
}
|
|
@@ -119820,7 +119897,8 @@ var ts;
|
|
|
119820
119897
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119821
119898
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119822
119899
|
*/
|
|
119823
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119900
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119901
|
+
var _a;
|
|
119824
119902
|
while (true) {
|
|
119825
119903
|
var affectedFiles = state.affectedFiles;
|
|
119826
119904
|
if (affectedFiles) {
|
|
@@ -119831,7 +119909,7 @@ var ts;
|
|
|
119831
119909
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119832
119910
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119833
119911
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119834
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119912
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119835
119913
|
return affectedFile;
|
|
119836
119914
|
}
|
|
119837
119915
|
affectedFilesIndex++;
|
|
@@ -119843,6 +119921,7 @@ var ts;
|
|
|
119843
119921
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119844
119922
|
state.currentAffectedFilesSignatures.clear();
|
|
119845
119923
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119924
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119846
119925
|
state.affectedFiles = undefined;
|
|
119847
119926
|
}
|
|
119848
119927
|
// Get next changed file
|
|
@@ -119872,6 +119951,11 @@ var ts;
|
|
|
119872
119951
|
state.seenAffectedFiles = new ts.Set();
|
|
119873
119952
|
}
|
|
119874
119953
|
}
|
|
119954
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119955
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119956
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119957
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119958
|
+
}
|
|
119875
119959
|
/**
|
|
119876
119960
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119877
119961
|
*/
|
|
@@ -119891,9 +119975,7 @@ var ts;
|
|
|
119891
119975
|
}
|
|
119892
119976
|
}
|
|
119893
119977
|
}
|
|
119894
|
-
state
|
|
119895
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119896
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119978
|
+
clearAffectedFilesPendingEmit(state);
|
|
119897
119979
|
}
|
|
119898
119980
|
return undefined;
|
|
119899
119981
|
}
|
|
@@ -119901,7 +119983,7 @@ var ts;
|
|
|
119901
119983
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119902
119984
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119903
119985
|
*/
|
|
119904
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119986
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119905
119987
|
var _a;
|
|
119906
119988
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119907
119989
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119926,14 +120008,14 @@ var ts;
|
|
|
119926
120008
|
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
119927
120009
|
}
|
|
119928
120010
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119929
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
120011
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119930
120012
|
}
|
|
119931
120013
|
}
|
|
119932
120014
|
/**
|
|
119933
120015
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119934
120016
|
* Also we need to make sure signature is updated for these files
|
|
119935
120017
|
*/
|
|
119936
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
120018
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119937
120019
|
removeSemanticDiagnosticsOf(state, path);
|
|
119938
120020
|
if (!state.changedFilesSet.has(path)) {
|
|
119939
120021
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119944,8 +120026,7 @@ var ts;
|
|
|
119944
120026
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119945
120027
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119946
120028
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119947
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119948
|
-
/* useFileVersionAsSignature */ true);
|
|
120029
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119949
120030
|
// If not dts emit, nothing more to do
|
|
119950
120031
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119951
120032
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -120142,13 +120223,18 @@ var ts;
|
|
|
120142
120223
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
120143
120224
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
120144
120225
|
return value.version === actualSignature ?
|
|
120145
|
-
value.affectsGlobalScope ?
|
|
120146
|
-
|
|
120226
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120227
|
+
// If file version is same as signature, dont serialize signature
|
|
120228
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120229
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
120147
120230
|
value.version :
|
|
120148
|
-
actualSignature !== undefined ?
|
|
120231
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
120149
120232
|
signature === undefined ?
|
|
120233
|
+
// If we havent computed signature, use fileInfo as is
|
|
120150
120234
|
value :
|
|
120235
|
+
// Serialize fileInfo with new updated signature
|
|
120151
120236
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120237
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
120152
120238
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
120153
120239
|
});
|
|
120154
120240
|
var referencedMap;
|
|
@@ -120393,7 +120479,7 @@ var ts;
|
|
|
120393
120479
|
* in that order would be used to write the files
|
|
120394
120480
|
*/
|
|
120395
120481
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120396
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120482
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120397
120483
|
var emitKind = 1 /* Full */;
|
|
120398
120484
|
var isPendingEmitFile = false;
|
|
120399
120485
|
if (!affected) {
|
|
@@ -120438,54 +120524,48 @@ var ts;
|
|
|
120438
120524
|
* in that order would be used to write the files
|
|
120439
120525
|
*/
|
|
120440
120526
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120441
|
-
var
|
|
120442
|
-
var savedAffectedFilesPendingEmit;
|
|
120443
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120444
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120445
|
-
// Backup and restore affected pendings emit state for non emit Builder if noEmitOnError is enabled and emitBuildInfo could be written in case there are errors
|
|
120446
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120447
|
-
// Note that when there are no errors, emit proceeds as if everything is emitted as it is callers reponsibility to write the files to disk if at all (because its builder that doesnt track files to emit)
|
|
120448
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120449
|
-
!targetSourceFile &&
|
|
120450
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120451
|
-
!state.compilerOptions.noEmit &&
|
|
120452
|
-
state.compilerOptions.noEmitOnError) {
|
|
120453
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120454
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120455
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120456
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120457
|
-
}
|
|
120527
|
+
var _a;
|
|
120458
120528
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120459
120529
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120460
120530
|
}
|
|
120461
120531
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120462
120532
|
if (result)
|
|
120463
120533
|
return result;
|
|
120464
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120465
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120466
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120467
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120468
|
-
}
|
|
120469
120534
|
// Emit only affected files if using builder for emit
|
|
120470
|
-
if (!targetSourceFile
|
|
120471
|
-
|
|
120472
|
-
|
|
120473
|
-
|
|
120474
|
-
|
|
120475
|
-
|
|
120476
|
-
|
|
120477
|
-
|
|
120478
|
-
|
|
120479
|
-
|
|
120480
|
-
|
|
120481
|
-
|
|
120535
|
+
if (!targetSourceFile) {
|
|
120536
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120537
|
+
// Emit and report any errors we ran into.
|
|
120538
|
+
var sourceMaps = [];
|
|
120539
|
+
var emitSkipped = false;
|
|
120540
|
+
var diagnostics = void 0;
|
|
120541
|
+
var emittedFiles = [];
|
|
120542
|
+
var affectedEmitResult = void 0;
|
|
120543
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120544
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120545
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120546
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120547
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120548
|
+
}
|
|
120549
|
+
return {
|
|
120550
|
+
emitSkipped: emitSkipped,
|
|
120551
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120552
|
+
emittedFiles: emittedFiles,
|
|
120553
|
+
sourceMaps: sourceMaps
|
|
120554
|
+
};
|
|
120555
|
+
}
|
|
120556
|
+
// In non Emit builder, clear affected files pending emit
|
|
120557
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120558
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120559
|
+
// State can clear affected files pending emit if
|
|
120560
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120561
|
+
// If every file pending emit is pending on only dts emit
|
|
120562
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120563
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120564
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120565
|
+
})) {
|
|
120566
|
+
clearAffectedFilesPendingEmit(state);
|
|
120567
|
+
}
|
|
120482
120568
|
}
|
|
120483
|
-
return {
|
|
120484
|
-
emitSkipped: emitSkipped,
|
|
120485
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120486
|
-
emittedFiles: emittedFiles,
|
|
120487
|
-
sourceMaps: sourceMaps
|
|
120488
|
-
};
|
|
120489
120569
|
}
|
|
120490
120570
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120491
120571
|
}
|
|
@@ -120495,7 +120575,7 @@ var ts;
|
|
|
120495
120575
|
*/
|
|
120496
120576
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120497
120577
|
while (true) {
|
|
120498
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120578
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120499
120579
|
if (!affected) {
|
|
120500
120580
|
// Done
|
|
120501
120581
|
return undefined;
|
|
@@ -123615,9 +123695,6 @@ var ts;
|
|
|
123615
123695
|
function newer(date1, date2) {
|
|
123616
123696
|
return date2 > date1 ? date2 : date1;
|
|
123617
123697
|
}
|
|
123618
|
-
function isDeclarationFile(fileName) {
|
|
123619
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123620
|
-
}
|
|
123621
123698
|
/*@internal*/
|
|
123622
123699
|
function isCircularBuildOrder(buildOrder) {
|
|
123623
123700
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -124180,7 +124257,7 @@ var ts;
|
|
|
124180
124257
|
outputFiles.forEach(function (_a) {
|
|
124181
124258
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
124182
124259
|
var priorChangeTime;
|
|
124183
|
-
if (!anyDtsChanged &&
|
|
124260
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
124184
124261
|
// Check for unchanged .d.ts files
|
|
124185
124262
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
124186
124263
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124521,7 +124598,7 @@ var ts;
|
|
|
124521
124598
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124522
124599
|
// had its file touched but not had its contents changed - this allows us
|
|
124523
124600
|
// to skip a downstream typecheck
|
|
124524
|
-
if (
|
|
124601
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124525
124602
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124526
124603
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124527
124604
|
}
|
|
@@ -124675,7 +124752,7 @@ var ts;
|
|
|
124675
124752
|
reportVerbose = false;
|
|
124676
124753
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124677
124754
|
}
|
|
124678
|
-
if (
|
|
124755
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124679
124756
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124680
124757
|
}
|
|
124681
124758
|
host.setModifiedTime(file, now);
|
|
@@ -131987,17 +132064,13 @@ var ts;
|
|
|
131987
132064
|
}
|
|
131988
132065
|
}
|
|
131989
132066
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131990
|
-
|
|
131991
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
132067
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
|
|
131992
132068
|
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131993
132069
|
name = name + labelDetails.detail;
|
|
131994
132070
|
labelDetails = undefined;
|
|
131995
132071
|
}
|
|
131996
132072
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131997
132073
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131998
|
-
if (importAdder.hasFixes()) {
|
|
131999
|
-
hasAction = true;
|
|
132000
|
-
}
|
|
132001
132074
|
}
|
|
132002
132075
|
if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
132003
132076
|
var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
|
|
@@ -132220,8 +132293,7 @@ var ts;
|
|
|
132220
132293
|
var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
|
|
132221
132294
|
var insertText = name;
|
|
132222
132295
|
var sourceFile = enclosingDeclaration.getSourceFile();
|
|
132223
|
-
var
|
|
132224
|
-
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
|
|
132296
|
+
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
|
|
132225
132297
|
if (!method) {
|
|
132226
132298
|
return undefined;
|
|
132227
132299
|
}
|
|
@@ -132250,16 +132322,15 @@ var ts;
|
|
|
132250
132322
|
/*modifiers*/ undefined,
|
|
132251
132323
|
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
132252
132324
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
132253
|
-
return { isSnippet: isSnippet, insertText: insertText,
|
|
132325
|
+
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
132254
132326
|
}
|
|
132255
132327
|
;
|
|
132256
|
-
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences
|
|
132328
|
+
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
132257
132329
|
var declarations = symbol.getDeclarations();
|
|
132258
132330
|
if (!(declarations && declarations.length)) {
|
|
132259
132331
|
return undefined;
|
|
132260
132332
|
}
|
|
132261
132333
|
var checker = program.getTypeChecker();
|
|
132262
|
-
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
132263
132334
|
var declaration = declarations[0];
|
|
132264
132335
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
132265
132336
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
@@ -132292,11 +132363,6 @@ var ts;
|
|
|
132292
132363
|
if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
|
|
132293
132364
|
return undefined;
|
|
132294
132365
|
}
|
|
132295
|
-
var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
132296
|
-
if (importableReference) {
|
|
132297
|
-
typeNode = importableReference.typeNode;
|
|
132298
|
-
ts.codefix.importSymbols(importAdder, importableReference.symbols);
|
|
132299
|
-
}
|
|
132300
132366
|
var body = void 0;
|
|
132301
132367
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
132302
132368
|
var emptyStmt = ts.factory.createEmptyStatement();
|
|
@@ -132306,11 +132372,19 @@ var ts;
|
|
|
132306
132372
|
else {
|
|
132307
132373
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
132308
132374
|
}
|
|
132375
|
+
var parameters = typeNode.parameters.map(function (typedParam) {
|
|
132376
|
+
return ts.factory.createParameterDeclaration(
|
|
132377
|
+
/*decorators*/ undefined,
|
|
132378
|
+
/*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken,
|
|
132379
|
+
/*type*/ undefined, typedParam.initializer);
|
|
132380
|
+
});
|
|
132309
132381
|
return ts.factory.createMethodDeclaration(
|
|
132310
132382
|
/*decorators*/ undefined,
|
|
132311
132383
|
/*modifiers*/ undefined,
|
|
132312
132384
|
/*asteriskToken*/ undefined, name,
|
|
132313
|
-
/*questionToken*/ undefined,
|
|
132385
|
+
/*questionToken*/ undefined,
|
|
132386
|
+
/*typeParameters*/ undefined, parameters,
|
|
132387
|
+
/*type*/ undefined, body);
|
|
132314
132388
|
}
|
|
132315
132389
|
default:
|
|
132316
132390
|
return undefined;
|
|
@@ -132673,20 +132747,6 @@ var ts;
|
|
|
132673
132747
|
};
|
|
132674
132748
|
}
|
|
132675
132749
|
}
|
|
132676
|
-
if (source === CompletionSource.ObjectLiteralMethodSnippet) {
|
|
132677
|
-
var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
|
|
132678
|
-
var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
|
|
132679
|
-
if (importAdder.hasFixes()) {
|
|
132680
|
-
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
132681
|
-
return {
|
|
132682
|
-
sourceDisplay: undefined,
|
|
132683
|
-
codeActions: [{
|
|
132684
|
-
changes: changes,
|
|
132685
|
-
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
132686
|
-
}],
|
|
132687
|
-
};
|
|
132688
|
-
}
|
|
132689
|
-
}
|
|
132690
132750
|
if (originIsTypeOnlyAlias(origin)) {
|
|
132691
132751
|
var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
|
|
132692
132752
|
ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
|
|
@@ -135507,7 +135567,7 @@ var ts;
|
|
|
135507
135567
|
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
135508
135568
|
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
135509
135569
|
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
135510
|
-
var otherBucketKey = !ts.
|
|
135570
|
+
var otherBucketKey = !ts.isDeclarationFileName(path) &&
|
|
135511
135571
|
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
|
|
135512
135572
|
if (otherBucketKey) {
|
|
135513
135573
|
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
|
|
@@ -137447,6 +137507,30 @@ var ts;
|
|
|
137447
137507
|
}
|
|
137448
137508
|
}
|
|
137449
137509
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
137510
|
+
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
137511
|
+
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
137512
|
+
return candidates.reduce(function (topMost, decl) {
|
|
137513
|
+
var depth = getDepth(decl);
|
|
137514
|
+
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
137515
|
+
topMost.declarationNames.push(decl);
|
|
137516
|
+
topMost.depth = depth;
|
|
137517
|
+
}
|
|
137518
|
+
else if (depth < topMost.depth) {
|
|
137519
|
+
topMost.declarationNames = [decl];
|
|
137520
|
+
topMost.depth = depth;
|
|
137521
|
+
}
|
|
137522
|
+
return topMost;
|
|
137523
|
+
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
137524
|
+
function getDepth(declaration) {
|
|
137525
|
+
var depth = 0;
|
|
137526
|
+
while (declaration) {
|
|
137527
|
+
declaration = ts.getContainerNode(declaration);
|
|
137528
|
+
depth++;
|
|
137529
|
+
}
|
|
137530
|
+
return depth;
|
|
137531
|
+
}
|
|
137532
|
+
}
|
|
137533
|
+
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
137450
137534
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
137451
137535
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
137452
137536
|
return false;
|
|
@@ -139083,7 +139167,9 @@ var ts;
|
|
|
139083
139167
|
(function (ts) {
|
|
139084
139168
|
var GoToDefinition;
|
|
139085
139169
|
(function (GoToDefinition) {
|
|
139086
|
-
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
139170
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139171
|
+
var _a;
|
|
139172
|
+
var _b;
|
|
139087
139173
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
139088
139174
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
139089
139175
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -139106,33 +139192,63 @@ var ts;
|
|
|
139106
139192
|
}
|
|
139107
139193
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139108
139194
|
var classDecl = node.parent.parent;
|
|
139109
|
-
var
|
|
139195
|
+
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139110
139196
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139111
139197
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139112
139198
|
var sourceFile_1 = node.getSourceFile();
|
|
139113
139199
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
139114
139200
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
139115
139201
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
139116
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
139202
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139117
139203
|
});
|
|
139118
139204
|
}
|
|
139119
|
-
var
|
|
139205
|
+
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139206
|
+
var fallbackNode = node;
|
|
139207
|
+
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139208
|
+
// We couldn't resolve the specific import, try on the module specifier.
|
|
139209
|
+
var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
|
|
139210
|
+
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139211
|
+
if (moduleSpecifier) {
|
|
139212
|
+
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139213
|
+
fallbackNode = moduleSpecifier;
|
|
139214
|
+
}
|
|
139215
|
+
}
|
|
139216
|
+
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
139217
|
+
// We couldn't resolve the module specifier as an external module, but it could
|
|
139218
|
+
// be that module resolution succeeded but the target was not a module.
|
|
139219
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
139220
|
+
if (ref) {
|
|
139221
|
+
return [{
|
|
139222
|
+
name: fallbackNode.text,
|
|
139223
|
+
fileName: ref.resolvedFileName,
|
|
139224
|
+
containerName: undefined,
|
|
139225
|
+
containerKind: undefined,
|
|
139226
|
+
kind: "script" /* scriptElement */,
|
|
139227
|
+
textSpan: ts.createTextSpan(0, 0),
|
|
139228
|
+
failedAliasResolution: failedAliasResolution,
|
|
139229
|
+
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
139230
|
+
unverified: fallbackNode !== node,
|
|
139231
|
+
}];
|
|
139232
|
+
}
|
|
139233
|
+
}
|
|
139120
139234
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
139121
139235
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
139122
139236
|
if (!symbol) {
|
|
139123
139237
|
return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
|
139124
139238
|
}
|
|
139239
|
+
if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
|
|
139240
|
+
return undefined;
|
|
139125
139241
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
139126
139242
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
139127
139243
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
139128
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
139244
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
139129
139245
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
139130
139246
|
// If this is the original constructor definition, parent is the class.
|
|
139131
139247
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
139132
139248
|
return [sigInfo];
|
|
139133
139249
|
}
|
|
139134
139250
|
else {
|
|
139135
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
139251
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
|
|
139136
139252
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
139137
139253
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
139138
139254
|
}
|
|
@@ -139144,7 +139260,7 @@ var ts;
|
|
|
139144
139260
|
// assignment. This case and others are handled by the following code.
|
|
139145
139261
|
if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
|
|
139146
139262
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
139147
|
-
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : ts.emptyArray;
|
|
139263
|
+
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray;
|
|
139148
139264
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
139149
139265
|
}
|
|
139150
139266
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -139167,7 +139283,7 @@ var ts;
|
|
|
139167
139283
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
139168
139284
|
});
|
|
139169
139285
|
}
|
|
139170
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
139286
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
|
|
139171
139287
|
}
|
|
139172
139288
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
139173
139289
|
/**
|
|
@@ -139265,24 +139381,24 @@ var ts;
|
|
|
139265
139381
|
return undefined;
|
|
139266
139382
|
}
|
|
139267
139383
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139268
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
139384
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139269
139385
|
}
|
|
139270
|
-
var
|
|
139386
|
+
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139271
139387
|
if (!symbol)
|
|
139272
139388
|
return undefined;
|
|
139273
139389
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
139274
139390
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
139275
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
139391
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
139276
139392
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
139277
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
139393
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
139278
139394
|
return typeDefinitions.length ? typeDefinitions
|
|
139279
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
139395
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node, failedAliasResolution)
|
|
139280
139396
|
: undefined;
|
|
139281
139397
|
}
|
|
139282
139398
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
139283
|
-
function definitionFromType(type, checker, node) {
|
|
139399
|
+
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
139284
139400
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
139285
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
139401
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
|
|
139286
139402
|
});
|
|
139287
139403
|
}
|
|
139288
139404
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -139324,13 +139440,17 @@ var ts;
|
|
|
139324
139440
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139325
139441
|
// import {A, B} from "mod";
|
|
139326
139442
|
// to jump to the implementation directly.
|
|
139443
|
+
var failedAliasResolution = false;
|
|
139327
139444
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139328
139445
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139329
139446
|
if (aliased.declarations) {
|
|
139330
|
-
return aliased;
|
|
139447
|
+
return { symbol: aliased };
|
|
139448
|
+
}
|
|
139449
|
+
else {
|
|
139450
|
+
failedAliasResolution = true;
|
|
139331
139451
|
}
|
|
139332
139452
|
}
|
|
139333
|
-
return symbol;
|
|
139453
|
+
return { symbol: symbol, failedAliasResolution: failedAliasResolution };
|
|
139334
139454
|
}
|
|
139335
139455
|
// Go to the original declaration for cases:
|
|
139336
139456
|
//
|
|
@@ -139344,26 +139464,45 @@ var ts;
|
|
|
139344
139464
|
if (node.parent === declaration) {
|
|
139345
139465
|
return true;
|
|
139346
139466
|
}
|
|
139347
|
-
|
|
139348
|
-
|
|
139349
|
-
case 265 /* ImportEqualsDeclaration */:
|
|
139350
|
-
return true;
|
|
139351
|
-
case 270 /* ImportSpecifier */:
|
|
139352
|
-
return declaration.parent.kind === 269 /* NamedImports */;
|
|
139353
|
-
case 203 /* BindingElement */:
|
|
139354
|
-
case 254 /* VariableDeclaration */:
|
|
139355
|
-
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
139356
|
-
default:
|
|
139357
|
-
return false;
|
|
139467
|
+
if (declaration.kind === 268 /* NamespaceImport */) {
|
|
139468
|
+
return false;
|
|
139358
139469
|
}
|
|
139470
|
+
return true;
|
|
139471
|
+
}
|
|
139472
|
+
/**
|
|
139473
|
+
* ```ts
|
|
139474
|
+
* function f() {}
|
|
139475
|
+
* f.foo = 0;
|
|
139476
|
+
* ```
|
|
139477
|
+
*
|
|
139478
|
+
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
139479
|
+
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
139480
|
+
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
139481
|
+
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
139482
|
+
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
139483
|
+
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
139484
|
+
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
139485
|
+
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
139486
|
+
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
139487
|
+
* up with a more precise definition of what counts as a definition.
|
|
139488
|
+
*/
|
|
139489
|
+
function isExpandoDeclaration(node) {
|
|
139490
|
+
if (!ts.isAssignmentDeclaration(node))
|
|
139491
|
+
return false;
|
|
139492
|
+
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
139493
|
+
if (ts.isAssignmentExpression(p))
|
|
139494
|
+
return true;
|
|
139495
|
+
if (!ts.isAssignmentDeclaration(p))
|
|
139496
|
+
return "quit";
|
|
139497
|
+
return false;
|
|
139498
|
+
});
|
|
139499
|
+
return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
|
|
139359
139500
|
}
|
|
139360
|
-
function getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
139361
|
-
|
|
139362
|
-
|
|
139363
|
-
|
|
139364
|
-
|
|
139365
|
-
|| undefined;
|
|
139366
|
-
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
|
|
139501
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
|
|
139502
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; });
|
|
139503
|
+
var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); });
|
|
139504
|
+
var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
|
|
139505
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); });
|
|
139367
139506
|
function getConstructSignatureDefinition() {
|
|
139368
139507
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
139369
139508
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -139387,26 +139526,27 @@ var ts;
|
|
|
139387
139526
|
return declarations.length
|
|
139388
139527
|
? declarationsWithBody.length !== 0
|
|
139389
139528
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
139390
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
139529
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
|
|
139391
139530
|
: undefined;
|
|
139392
139531
|
}
|
|
139393
139532
|
}
|
|
139394
139533
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
139395
|
-
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
139534
|
+
function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
|
|
139396
139535
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
139397
139536
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
139398
139537
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
139399
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
139538
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
|
|
139400
139539
|
}
|
|
139540
|
+
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
139401
139541
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
139402
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
139542
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
|
|
139403
139543
|
var sourceFile = declaration.getSourceFile();
|
|
139404
139544
|
if (!textSpan) {
|
|
139405
139545
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
139406
139546
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
139407
139547
|
}
|
|
139408
139548
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
139409
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
139549
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216 /* Ambient */), unverified: unverified, failedAliasResolution: failedAliasResolution });
|
|
139410
139550
|
}
|
|
139411
139551
|
function isDefinitionVisible(checker, declaration) {
|
|
139412
139552
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -139439,8 +139579,8 @@ var ts;
|
|
|
139439
139579
|
return false;
|
|
139440
139580
|
}
|
|
139441
139581
|
}
|
|
139442
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
139443
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
139582
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
|
|
139583
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
|
|
139444
139584
|
}
|
|
139445
139585
|
function findReferenceInPosition(refs, pos) {
|
|
139446
139586
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -152555,9 +152695,10 @@ var ts;
|
|
|
152555
152695
|
// 2. add "member3" to the second import statement's import list
|
|
152556
152696
|
// and it is up to the user to decide which one fits best.
|
|
152557
152697
|
return ts.firstDefined(existingImports, function (_a) {
|
|
152698
|
+
var _b;
|
|
152558
152699
|
var declaration = _a.declaration;
|
|
152559
152700
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
152560
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152701
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152561
152702
|
if (namespacePrefix && moduleSpecifier) {
|
|
152562
152703
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
152563
152704
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -152733,8 +152874,9 @@ var ts;
|
|
|
152733
152874
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
152734
152875
|
}
|
|
152735
152876
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152877
|
+
var _b;
|
|
152736
152878
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
152737
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152879
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152738
152880
|
if (moduleSpecifier) {
|
|
152739
152881
|
var addAsTypeOnly = useRequire
|
|
152740
152882
|
? 4 /* NotAllowed */
|
|
@@ -157092,7 +157234,6 @@ var ts;
|
|
|
157092
157234
|
var checker = program.getTypeChecker();
|
|
157093
157235
|
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157094
157236
|
var flags = 1 /* NoTruncation */
|
|
157095
|
-
| 1073741824 /* NoUndefinedOptionalParameterType */
|
|
157096
157237
|
| 256 /* SuppressAnyReturnType */
|
|
157097
157238
|
| 524288 /* AllowEmptyTuple */
|
|
157098
157239
|
| (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
@@ -159471,6 +159612,7 @@ var ts;
|
|
|
159471
159612
|
Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes");
|
|
159472
159613
|
Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS");
|
|
159473
159614
|
Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block");
|
|
159615
|
+
Messages.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method");
|
|
159474
159616
|
})(Messages = extractSymbol.Messages || (extractSymbol.Messages = {}));
|
|
159475
159617
|
var RangeFacts;
|
|
159476
159618
|
(function (RangeFacts) {
|
|
@@ -159479,10 +159621,11 @@ var ts;
|
|
|
159479
159621
|
RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator";
|
|
159480
159622
|
RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction";
|
|
159481
159623
|
RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis";
|
|
159624
|
+
RangeFacts[RangeFacts["UsesThisInFunction"] = 16] = "UsesThisInFunction";
|
|
159482
159625
|
/**
|
|
159483
159626
|
* The range is in a function which needs the 'static' modifier in a class
|
|
159484
159627
|
*/
|
|
159485
|
-
RangeFacts[RangeFacts["InStaticRegion"] =
|
|
159628
|
+
RangeFacts[RangeFacts["InStaticRegion"] = 32] = "InStaticRegion";
|
|
159486
159629
|
})(RangeFacts || (RangeFacts = {}));
|
|
159487
159630
|
/**
|
|
159488
159631
|
* getRangeToExtract takes a span inside a text file and returns either an expression or an array
|
|
@@ -159513,6 +159656,7 @@ var ts;
|
|
|
159513
159656
|
// We'll modify these flags as we walk the tree to collect data
|
|
159514
159657
|
// about what things need to be done as part of the extraction.
|
|
159515
159658
|
var rangeFacts = RangeFacts.None;
|
|
159659
|
+
var thisNode;
|
|
159516
159660
|
if (!start || !end) {
|
|
159517
159661
|
// cannot find either start or end node
|
|
159518
159662
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
@@ -159551,7 +159695,7 @@ var ts;
|
|
|
159551
159695
|
// the expression.
|
|
159552
159696
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
159553
159697
|
}
|
|
159554
|
-
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } };
|
|
159698
|
+
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
|
|
159555
159699
|
}
|
|
159556
159700
|
if (ts.isReturnStatement(start) && !start.expression) {
|
|
159557
159701
|
// Makes no sense to extract an expression-less return statement.
|
|
@@ -159563,7 +159707,7 @@ var ts;
|
|
|
159563
159707
|
if (errors) {
|
|
159564
159708
|
return { errors: errors };
|
|
159565
159709
|
}
|
|
159566
|
-
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } }; // TODO: GH#18217
|
|
159710
|
+
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
|
|
159567
159711
|
/**
|
|
159568
159712
|
* Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
|
|
159569
159713
|
* @param node The unrefined extraction node.
|
|
@@ -159655,6 +159799,14 @@ var ts;
|
|
|
159655
159799
|
var permittedJumps = 4 /* Return */;
|
|
159656
159800
|
var seenLabels;
|
|
159657
159801
|
visit(nodeToCheck);
|
|
159802
|
+
if (rangeFacts & RangeFacts.UsesThis) {
|
|
159803
|
+
var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false);
|
|
159804
|
+
if (container.kind === 256 /* FunctionDeclaration */ ||
|
|
159805
|
+
(container.kind === 169 /* MethodDeclaration */ && container.parent.kind === 205 /* ObjectLiteralExpression */) ||
|
|
159806
|
+
container.kind === 213 /* FunctionExpression */) {
|
|
159807
|
+
rangeFacts |= RangeFacts.UsesThisInFunction;
|
|
159808
|
+
}
|
|
159809
|
+
}
|
|
159658
159810
|
return errors;
|
|
159659
159811
|
function visit(node) {
|
|
159660
159812
|
if (errors) {
|
|
@@ -159693,6 +159845,7 @@ var ts;
|
|
|
159693
159845
|
}
|
|
159694
159846
|
else {
|
|
159695
159847
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159848
|
+
thisNode = node;
|
|
159696
159849
|
}
|
|
159697
159850
|
break;
|
|
159698
159851
|
case 214 /* ArrowFunction */:
|
|
@@ -159700,6 +159853,7 @@ var ts;
|
|
|
159700
159853
|
ts.forEachChild(node, function check(n) {
|
|
159701
159854
|
if (ts.isThis(n)) {
|
|
159702
159855
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159856
|
+
thisNode = node;
|
|
159703
159857
|
}
|
|
159704
159858
|
else if (ts.isClassLike(n) || (ts.isFunctionLike(n) && !ts.isArrowFunction(n))) {
|
|
159705
159859
|
return false;
|
|
@@ -159756,6 +159910,7 @@ var ts;
|
|
|
159756
159910
|
case 192 /* ThisType */:
|
|
159757
159911
|
case 108 /* ThisKeyword */:
|
|
159758
159912
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159913
|
+
thisNode = node;
|
|
159759
159914
|
break;
|
|
159760
159915
|
case 250 /* LabeledStatement */: {
|
|
159761
159916
|
var label = node.label;
|
|
@@ -159843,7 +159998,7 @@ var ts;
|
|
|
159843
159998
|
*/
|
|
159844
159999
|
function collectEnclosingScopes(range) {
|
|
159845
160000
|
var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range;
|
|
159846
|
-
if (range.facts & RangeFacts.UsesThis) {
|
|
160001
|
+
if (range.facts & RangeFacts.UsesThis && !(range.facts & RangeFacts.UsesThisInFunction)) {
|
|
159847
160002
|
// if range uses this as keyword or as type inside the class then it can only be extracted to a method of the containing class
|
|
159848
160003
|
var containingClass = ts.getContainingClass(current);
|
|
159849
160004
|
if (containingClass) {
|
|
@@ -160049,6 +160204,7 @@ var ts;
|
|
|
160049
160204
|
var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty;
|
|
160050
160205
|
ts.suppressLeadingAndTrailingTrivia(body);
|
|
160051
160206
|
var newFunction;
|
|
160207
|
+
var callThis = !!(range.facts & RangeFacts.UsesThisInFunction);
|
|
160052
160208
|
if (ts.isClassLike(scope)) {
|
|
160053
160209
|
// always create private method in TypeScript files
|
|
160054
160210
|
var modifiers = isJS ? [] : [ts.factory.createModifier(121 /* PrivateKeyword */)];
|
|
@@ -160063,6 +160219,15 @@ var ts;
|
|
|
160063
160219
|
/*questionToken*/ undefined, typeParameters, parameters, returnType, body);
|
|
160064
160220
|
}
|
|
160065
160221
|
else {
|
|
160222
|
+
if (callThis) {
|
|
160223
|
+
parameters.unshift(ts.factory.createParameterDeclaration(
|
|
160224
|
+
/*decorators*/ undefined,
|
|
160225
|
+
/*modifiers*/ undefined,
|
|
160226
|
+
/*dotDotDotToken*/ undefined,
|
|
160227
|
+
/*name*/ "this",
|
|
160228
|
+
/*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NoTruncation */),
|
|
160229
|
+
/*initializer*/ undefined));
|
|
160230
|
+
}
|
|
160066
160231
|
newFunction = ts.factory.createFunctionDeclaration(
|
|
160067
160232
|
/*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
|
|
160068
160233
|
}
|
|
@@ -160079,7 +160244,10 @@ var ts;
|
|
|
160079
160244
|
var newNodes = [];
|
|
160080
160245
|
// replace range with function call
|
|
160081
160246
|
var called = getCalledExpression(scope, range, functionNameText);
|
|
160082
|
-
|
|
160247
|
+
if (callThis) {
|
|
160248
|
+
callArguments.unshift(ts.factory.createIdentifier("this"));
|
|
160249
|
+
}
|
|
160250
|
+
var call = ts.factory.createCallExpression(callThis ? ts.factory.createPropertyAccessExpression(called, "call") : called, callTypeArguments, // Note that no attempt is made to take advantage of type argument inference
|
|
160083
160251
|
callArguments);
|
|
160084
160252
|
if (range.facts & RangeFacts.IsGenerator) {
|
|
160085
160253
|
call = ts.factory.createYieldExpression(ts.factory.createToken(41 /* AsteriskToken */), call);
|
|
@@ -160690,6 +160858,9 @@ var ts;
|
|
|
160690
160858
|
var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
|
|
160691
160859
|
constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
|
|
160692
160860
|
}
|
|
160861
|
+
if (targetRange.facts & RangeFacts.UsesThisInFunction && ts.isClassLike(scopes[i])) {
|
|
160862
|
+
functionErrorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
|
|
160863
|
+
}
|
|
160693
160864
|
var hasWrite = false;
|
|
160694
160865
|
var readonlyClassPropertyWrite;
|
|
160695
160866
|
usagesPerScope[i].usages.forEach(function (value) {
|
|
@@ -164643,9 +164814,9 @@ var ts;
|
|
|
164643
164814
|
}
|
|
164644
164815
|
}
|
|
164645
164816
|
/// Goto definition
|
|
164646
|
-
function getDefinitionAtPosition(fileName, position) {
|
|
164817
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164647
164818
|
synchronizeHostData();
|
|
164648
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
164819
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164649
164820
|
}
|
|
164650
164821
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164651
164822
|
synchronizeHostData();
|
|
@@ -167186,6 +167357,11 @@ var ts;
|
|
|
167186
167357
|
return "/dev/null/autoImportProviderProject" + counter + "*";
|
|
167187
167358
|
}
|
|
167188
167359
|
server.makeAutoImportProviderProjectName = makeAutoImportProviderProjectName;
|
|
167360
|
+
/*@internal*/
|
|
167361
|
+
function makeAuxiliaryProjectName(counter) {
|
|
167362
|
+
return "/dev/null/auxiliaryProject" + counter + "*";
|
|
167363
|
+
}
|
|
167364
|
+
server.makeAuxiliaryProjectName = makeAuxiliaryProjectName;
|
|
167189
167365
|
function createSortedArray() {
|
|
167190
167366
|
return []; // TODO: GH#19873
|
|
167191
167367
|
}
|
|
@@ -167399,6 +167575,7 @@ var ts;
|
|
|
167399
167575
|
CommandTypes["SignatureHelp"] = "signatureHelp";
|
|
167400
167576
|
/* @internal */
|
|
167401
167577
|
CommandTypes["SignatureHelpFull"] = "signatureHelp-full";
|
|
167578
|
+
CommandTypes["FindSourceDefinition"] = "findSourceDefinition";
|
|
167402
167579
|
CommandTypes["Status"] = "status";
|
|
167403
167580
|
CommandTypes["TypeDefinition"] = "typeDefinition";
|
|
167404
167581
|
CommandTypes["ProjectInfo"] = "projectInfo";
|
|
@@ -167978,7 +168155,7 @@ var ts;
|
|
|
167978
168155
|
case 0:
|
|
167979
168156
|
return server.Errors.ThrowNoProject();
|
|
167980
168157
|
case 1:
|
|
167981
|
-
return
|
|
168158
|
+
return ensurePrimaryProjectKind(this.containingProjects[0]);
|
|
167982
168159
|
default:
|
|
167983
168160
|
// If this file belongs to multiple projects, below is the order in which default project is used
|
|
167984
168161
|
// - for open script info, its default configured project during opening is default if info is part of it
|
|
@@ -168016,7 +168193,7 @@ var ts;
|
|
|
168016
168193
|
firstInferredProject = project;
|
|
168017
168194
|
}
|
|
168018
168195
|
}
|
|
168019
|
-
return
|
|
168196
|
+
return ensurePrimaryProjectKind(defaultConfiguredProject ||
|
|
168020
168197
|
firstNonSourceOfProjectReferenceRedirect ||
|
|
168021
168198
|
firstConfiguredProject ||
|
|
168022
168199
|
firstExternalProject ||
|
|
@@ -168092,8 +168269,8 @@ var ts;
|
|
|
168092
168269
|
return !ts.forEach(this.containingProjects, function (p) { return !p.isOrphan(); });
|
|
168093
168270
|
};
|
|
168094
168271
|
/*@internal*/
|
|
168095
|
-
ScriptInfo.prototype.
|
|
168096
|
-
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider; });
|
|
168272
|
+
ScriptInfo.prototype.isContainedByBackgroundProject = function () {
|
|
168273
|
+
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider || p.projectKind === server.ProjectKind.Auxiliary; });
|
|
168097
168274
|
};
|
|
168098
168275
|
/**
|
|
168099
168276
|
* @param line 1 based index
|
|
@@ -168127,8 +168304,13 @@ var ts;
|
|
|
168127
168304
|
return ScriptInfo;
|
|
168128
168305
|
}());
|
|
168129
168306
|
server.ScriptInfo = ScriptInfo;
|
|
168130
|
-
|
|
168131
|
-
|
|
168307
|
+
/**
|
|
168308
|
+
* Throws an error if `project` is an AutoImportProvider or AuxiliaryProject,
|
|
168309
|
+
* which are used in the background by other Projects and should never be
|
|
168310
|
+
* reported as the default project for a ScriptInfo.
|
|
168311
|
+
*/
|
|
168312
|
+
function ensurePrimaryProjectKind(project) {
|
|
168313
|
+
if (!project || project.projectKind === server.ProjectKind.AutoImportProvider || project.projectKind === server.ProjectKind.Auxiliary) {
|
|
168132
168314
|
return server.Errors.ThrowNoProject();
|
|
168133
168315
|
}
|
|
168134
168316
|
return project;
|
|
@@ -168268,6 +168450,7 @@ var ts;
|
|
|
168268
168450
|
ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
|
|
168269
168451
|
ProjectKind[ProjectKind["External"] = 2] = "External";
|
|
168270
168452
|
ProjectKind[ProjectKind["AutoImportProvider"] = 3] = "AutoImportProvider";
|
|
168453
|
+
ProjectKind[ProjectKind["Auxiliary"] = 4] = "Auxiliary";
|
|
168271
168454
|
})(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));
|
|
168272
168455
|
/* @internal */
|
|
168273
168456
|
function countEachFileTypes(infos, includeSizes) {
|
|
@@ -168293,7 +168476,7 @@ var ts;
|
|
|
168293
168476
|
result.jsxSize += fileSize;
|
|
168294
168477
|
break;
|
|
168295
168478
|
case 3 /* TS */:
|
|
168296
|
-
if (ts.
|
|
168479
|
+
if (ts.isDeclarationFileName(info.fileName)) {
|
|
168297
168480
|
result.dts += 1;
|
|
168298
168481
|
result.dtsSize += fileSize;
|
|
168299
168482
|
}
|
|
@@ -168331,7 +168514,7 @@ var ts;
|
|
|
168331
168514
|
server.allFilesAreJsOrDts = allFilesAreJsOrDts;
|
|
168332
168515
|
/* @internal */
|
|
168333
168516
|
function hasNoTypeScriptSource(fileNames) {
|
|
168334
|
-
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.
|
|
168517
|
+
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.isDeclarationFileName(fileName)) || ts.fileExtensionIs(fileName, ".tsx" /* Tsx */); });
|
|
168335
168518
|
}
|
|
168336
168519
|
server.hasNoTypeScriptSource = hasNoTypeScriptSource;
|
|
168337
168520
|
function isGeneratedFileWatcher(watch) {
|
|
@@ -168735,7 +168918,7 @@ var ts;
|
|
|
168735
168918
|
}
|
|
168736
168919
|
// Update the signature
|
|
168737
168920
|
if (this.builderState && ts.getEmitDeclarations(this.compilerOptions)) {
|
|
168738
|
-
var dtsFiles = outputFiles.filter(function (f) { return ts.
|
|
168921
|
+
var dtsFiles = outputFiles.filter(function (f) { return ts.isDeclarationFileName(f.name); });
|
|
168739
168922
|
if (dtsFiles.length === 1) {
|
|
168740
168923
|
var sourceFile = this.program.getSourceFile(scriptInfo.fileName);
|
|
168741
168924
|
var signature = this.projectService.host.createHash ?
|
|
@@ -168854,6 +169037,10 @@ var ts;
|
|
|
168854
169037
|
this.autoImportProviderHost.close();
|
|
168855
169038
|
}
|
|
168856
169039
|
this.autoImportProviderHost = undefined;
|
|
169040
|
+
if (this.noDtsResolutionProject) {
|
|
169041
|
+
this.noDtsResolutionProject.close();
|
|
169042
|
+
}
|
|
169043
|
+
this.noDtsResolutionProject = undefined;
|
|
168857
169044
|
// signal language service to release source files acquired from document registry
|
|
168858
169045
|
this.languageService.dispose();
|
|
168859
169046
|
this.languageService = undefined;
|
|
@@ -169376,11 +169563,13 @@ var ts;
|
|
|
169376
169563
|
}
|
|
169377
169564
|
};
|
|
169378
169565
|
Project.prototype.setCompilerOptions = function (compilerOptions) {
|
|
169566
|
+
var _a;
|
|
169379
169567
|
if (compilerOptions) {
|
|
169380
169568
|
compilerOptions.allowNonTsExtensions = true;
|
|
169381
169569
|
var oldOptions = this.compilerOptions;
|
|
169382
169570
|
this.compilerOptions = compilerOptions;
|
|
169383
169571
|
this.setInternalCompilerOptionsForEmittingJsFiles();
|
|
169572
|
+
(_a = this.noDtsResolutionProject) === null || _a === void 0 ? void 0 : _a.setCompilerOptions(this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169384
169573
|
if (ts.changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
169385
169574
|
// reset cached unresolved imports if changes in compiler options affected module resolution
|
|
169386
169575
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
@@ -169720,6 +169909,31 @@ var ts;
|
|
|
169720
169909
|
Project.prototype.getIncompleteCompletionsCache = function () {
|
|
169721
169910
|
return this.projectService.getIncompleteCompletionsCache();
|
|
169722
169911
|
};
|
|
169912
|
+
/*@internal*/
|
|
169913
|
+
Project.prototype.getNoDtsResolutionProject = function (rootFileNames) {
|
|
169914
|
+
var _this = this;
|
|
169915
|
+
ts.Debug.assert(this.projectService.serverMode === ts.LanguageServiceMode.Semantic);
|
|
169916
|
+
if (!this.noDtsResolutionProject) {
|
|
169917
|
+
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169918
|
+
}
|
|
169919
|
+
ts.enumerateInsertsAndDeletes(rootFileNames.map(server.toNormalizedPath), this.noDtsResolutionProject.getRootFiles(), ts.getStringComparer(!this.useCaseSensitiveFileNames()), function (pathToAdd) {
|
|
169920
|
+
var info = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(pathToAdd, _this.currentDirectory, _this.noDtsResolutionProject.directoryStructureHost);
|
|
169921
|
+
if (info) {
|
|
169922
|
+
_this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
169923
|
+
}
|
|
169924
|
+
}, function (pathToRemove) {
|
|
169925
|
+
// It may be preferable to remove roots only once project grows to a certain size?
|
|
169926
|
+
var info = _this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
169927
|
+
if (info) {
|
|
169928
|
+
_this.noDtsResolutionProject.removeRoot(info);
|
|
169929
|
+
}
|
|
169930
|
+
});
|
|
169931
|
+
return this.noDtsResolutionProject;
|
|
169932
|
+
};
|
|
169933
|
+
/*@internal*/
|
|
169934
|
+
Project.prototype.getCompilerOptionsForNoDtsResolutionProject = function () {
|
|
169935
|
+
return __assign(__assign({}, this.getCompilerOptions()), { noDtsResolution: true, allowJs: true, maxNodeModuleJsDepth: 3, diagnostics: false, skipLibCheck: true, sourceMap: false, types: ts.emptyArray, lib: ts.emptyArray, noLib: true });
|
|
169936
|
+
};
|
|
169723
169937
|
return Project;
|
|
169724
169938
|
}());
|
|
169725
169939
|
server.Project = Project;
|
|
@@ -169835,6 +170049,26 @@ var ts;
|
|
|
169835
170049
|
return InferredProject;
|
|
169836
170050
|
}(Project));
|
|
169837
170051
|
server.InferredProject = InferredProject;
|
|
170052
|
+
var AuxiliaryProject = /** @class */ (function (_super) {
|
|
170053
|
+
__extends(AuxiliaryProject, _super);
|
|
170054
|
+
function AuxiliaryProject(projectService, documentRegistry, compilerOptions) {
|
|
170055
|
+
return _super.call(this, projectService.newAuxiliaryProjectName(), ProjectKind.Auxiliary, projectService, documentRegistry,
|
|
170056
|
+
/*hasExplicitListOfFiles*/ false,
|
|
170057
|
+
/*lastFileExceededProgramSize*/ undefined, compilerOptions,
|
|
170058
|
+
/*compileOnSaveEnabled*/ false,
|
|
170059
|
+
/*watchOptions*/ undefined, projectService.host,
|
|
170060
|
+
/*currentDirectory*/ undefined) || this;
|
|
170061
|
+
}
|
|
170062
|
+
AuxiliaryProject.prototype.isOrphan = function () {
|
|
170063
|
+
return true;
|
|
170064
|
+
};
|
|
170065
|
+
/*@internal*/
|
|
170066
|
+
AuxiliaryProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170067
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170068
|
+
return;
|
|
170069
|
+
};
|
|
170070
|
+
return AuxiliaryProject;
|
|
170071
|
+
}(Project));
|
|
169838
170072
|
var AutoImportProviderProject = /** @class */ (function (_super) {
|
|
169839
170073
|
__extends(AutoImportProviderProject, _super);
|
|
169840
170074
|
/*@internal*/
|
|
@@ -169986,6 +170220,11 @@ var ts;
|
|
|
169986
170220
|
}
|
|
169987
170221
|
return hasSameSetOfFiles;
|
|
169988
170222
|
};
|
|
170223
|
+
/*@internal*/
|
|
170224
|
+
AutoImportProviderProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170225
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170226
|
+
return;
|
|
170227
|
+
};
|
|
169989
170228
|
AutoImportProviderProject.prototype.hasRoots = function () {
|
|
169990
170229
|
var _a;
|
|
169991
170230
|
return !!((_a = this.rootFileNames) === null || _a === void 0 ? void 0 : _a.length);
|
|
@@ -170671,6 +170910,8 @@ var ts;
|
|
|
170671
170910
|
this.newInferredProjectName = createProjectNameFactoryWithCounter(server.makeInferredProjectName);
|
|
170672
170911
|
/*@internal*/
|
|
170673
170912
|
this.newAutoImportProviderProjectName = createProjectNameFactoryWithCounter(server.makeAutoImportProviderProjectName);
|
|
170913
|
+
/*@internal*/
|
|
170914
|
+
this.newAuxiliaryProjectName = createProjectNameFactoryWithCounter(server.makeAuxiliaryProjectName);
|
|
170674
170915
|
/**
|
|
170675
170916
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
170676
170917
|
*/
|
|
@@ -170874,13 +171115,15 @@ var ts;
|
|
|
170874
171115
|
ProjectService.prototype.delayUpdateProjectGraph = function (project) {
|
|
170875
171116
|
var _this = this;
|
|
170876
171117
|
project.markAsDirty();
|
|
170877
|
-
|
|
170878
|
-
|
|
170879
|
-
|
|
170880
|
-
|
|
170881
|
-
|
|
170882
|
-
|
|
170883
|
-
|
|
171118
|
+
if (project.projectKind !== server.ProjectKind.AutoImportProvider && project.projectKind !== server.ProjectKind.Auxiliary) {
|
|
171119
|
+
var projectName_1 = project.getProjectName();
|
|
171120
|
+
this.pendingProjectUpdates.set(projectName_1, project);
|
|
171121
|
+
this.throttledOperations.schedule(projectName_1, /*delay*/ 250, function () {
|
|
171122
|
+
if (_this.pendingProjectUpdates.delete(projectName_1)) {
|
|
171123
|
+
updateProjectIfDirty(project);
|
|
171124
|
+
}
|
|
171125
|
+
});
|
|
171126
|
+
}
|
|
170884
171127
|
};
|
|
170885
171128
|
/*@internal*/
|
|
170886
171129
|
ProjectService.prototype.hasPendingProjectUpdate = function (project) {
|
|
@@ -173161,7 +173404,7 @@ var ts;
|
|
|
173161
173404
|
var toRemoveScriptInfos = new ts.Map(this.filenameToScriptInfo);
|
|
173162
173405
|
this.filenameToScriptInfo.forEach(function (info) {
|
|
173163
173406
|
// If script info is open or orphan, retain it and its dependencies
|
|
173164
|
-
if (!info.isScriptOpen() && info.isOrphan() && !info.
|
|
173407
|
+
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
173165
173408
|
// Otherwise if there is any source info that is alive, this alive too
|
|
173166
173409
|
if (!info.sourceMapFilePath)
|
|
173167
173410
|
return;
|
|
@@ -174457,6 +174700,9 @@ var ts;
|
|
|
174457
174700
|
_a[server.CommandNames.DefinitionAndBoundSpanFull] = function (request) {
|
|
174458
174701
|
return _this.requiredResponse(_this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
174459
174702
|
},
|
|
174703
|
+
_a[server.CommandNames.FindSourceDefinition] = function (request) {
|
|
174704
|
+
return _this.requiredResponse(_this.findSourceDefinition(request.arguments));
|
|
174705
|
+
},
|
|
174460
174706
|
_a[server.CommandNames.EmitOutput] = function (request) {
|
|
174461
174707
|
return _this.requiredResponse(_this.getEmitOutput(request.arguments));
|
|
174462
174708
|
},
|
|
@@ -175198,7 +175444,7 @@ var ts;
|
|
|
175198
175444
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
175199
175445
|
return definitions.map(function (info) {
|
|
175200
175446
|
var newDocumentSpan = getMappedDocumentSpan(info, project);
|
|
175201
|
-
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name }), info.unverified && { unverified: info.unverified });
|
|
175447
|
+
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name, failedAliasResolution: info.failedAliasResolution }), info.unverified && { unverified: info.unverified });
|
|
175202
175448
|
});
|
|
175203
175449
|
};
|
|
175204
175450
|
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
|
@@ -175225,6 +175471,152 @@ var ts;
|
|
|
175225
175471
|
textSpan: textSpan,
|
|
175226
175472
|
};
|
|
175227
175473
|
};
|
|
175474
|
+
Session.prototype.findSourceDefinition = function (args) {
|
|
175475
|
+
var _a;
|
|
175476
|
+
var _b = this.getFileAndProject(args), file = _b.file, project = _b.project;
|
|
175477
|
+
var position = this.getPositionInFile(args, file);
|
|
175478
|
+
var unmappedDefinitions = project.getLanguageService().getDefinitionAtPosition(file, position);
|
|
175479
|
+
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || server.emptyArray, project).slice();
|
|
175480
|
+
var needsJsResolution = this.projectService.serverMode === ts.LanguageServiceMode.Semantic && (!ts.some(definitions, function (d) { return server.toNormalizedPath(d.fileName) !== file && !d.isAmbient; }) ||
|
|
175481
|
+
ts.some(definitions, function (d) { return !!d.failedAliasResolution; }));
|
|
175482
|
+
if (needsJsResolution) {
|
|
175483
|
+
var definitionSet_1 = ts.createSet(function (d) { return d.textSpan.start; }, ts.documentSpansEqual);
|
|
175484
|
+
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175485
|
+
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175486
|
+
var ls = noDtsProject.getLanguageService();
|
|
175487
|
+
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175488
|
+
if (ts.some(jsDefinitions)) {
|
|
175489
|
+
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175490
|
+
var jsDefinition = jsDefinitions_1[_i];
|
|
175491
|
+
if (jsDefinition.unverified) {
|
|
175492
|
+
var refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram());
|
|
175493
|
+
if (ts.some(refined)) {
|
|
175494
|
+
for (var _c = 0, refined_1 = refined; _c < refined_1.length; _c++) {
|
|
175495
|
+
var def = refined_1[_c];
|
|
175496
|
+
definitionSet_1.add(def);
|
|
175497
|
+
}
|
|
175498
|
+
continue;
|
|
175499
|
+
}
|
|
175500
|
+
}
|
|
175501
|
+
definitionSet_1.add(jsDefinition);
|
|
175502
|
+
}
|
|
175503
|
+
}
|
|
175504
|
+
else {
|
|
175505
|
+
var ambientCandidates = definitions.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; });
|
|
175506
|
+
for (var _d = 0, _e = ts.some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain(); _d < _e.length; _d++) {
|
|
175507
|
+
var candidate = _e[_d];
|
|
175508
|
+
var fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
175509
|
+
if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
|
|
175510
|
+
continue;
|
|
175511
|
+
}
|
|
175512
|
+
var noDtsProgram = ls.getProgram();
|
|
175513
|
+
var fileToSearch = ts.Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
175514
|
+
for (var _f = 0, _g = searchForDeclaration(candidate.name, fileToSearch, noDtsProgram); _f < _g.length; _f++) {
|
|
175515
|
+
var match = _g[_f];
|
|
175516
|
+
definitionSet_1.add(match);
|
|
175517
|
+
}
|
|
175518
|
+
}
|
|
175519
|
+
}
|
|
175520
|
+
definitions = ts.arrayFrom(definitionSet_1.values());
|
|
175521
|
+
}
|
|
175522
|
+
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
175523
|
+
return this.mapDefinitionInfo(definitions, project);
|
|
175524
|
+
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
175525
|
+
var _a;
|
|
175526
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(fileName);
|
|
175527
|
+
if (nodeModulesPathParts && fileName.lastIndexOf(ts.nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
175528
|
+
// Second check ensures the fileName only contains one `/node_modules/`. If there's more than one I give up.
|
|
175529
|
+
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
175530
|
+
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
175531
|
+
var compilerOptions = project.getCompilationSettings();
|
|
175532
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175533
|
+
if (!packageJson)
|
|
175534
|
+
return undefined;
|
|
175535
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node12 or nodenext -
|
|
175536
|
+
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175537
|
+
// resolved from the package root under --moduleResolution node
|
|
175538
|
+
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
175539
|
+
// This substring is correct only because we checked for a single `/node_modules/` at the top.
|
|
175540
|
+
var packageNamePathPart = fileName.substring(nodeModulesPathParts.topLevelPackageNameIndex + 1, nodeModulesPathParts.packageRootIndex);
|
|
175541
|
+
var packageName = ts.getPackageNameFromTypesPackageName(ts.unmangleScopedPackageName(packageNamePathPart));
|
|
175542
|
+
var path_1 = project.toPath(fileName);
|
|
175543
|
+
if (entrypoints && ts.some(entrypoints, function (e) { return project.toPath(e) === path_1; })) {
|
|
175544
|
+
// This file was the main entrypoint of a package. Try to resolve that same package name with
|
|
175545
|
+
// the auxiliary project that only resolves to implementation files.
|
|
175546
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile)[0];
|
|
175547
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175548
|
+
}
|
|
175549
|
+
else {
|
|
175550
|
+
// It wasn't the main entrypoint but we are in node_modules. Try a subpath into the package.
|
|
175551
|
+
var pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
175552
|
+
var specifier = packageName + "/" + ts.removeFileExtension(pathToFileInPackage);
|
|
175553
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile)[0];
|
|
175554
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175555
|
+
}
|
|
175556
|
+
}
|
|
175557
|
+
// We're not in node_modules, and we only get to this function if non-dts module resolution failed.
|
|
175558
|
+
// I'm not sure what else I can do here that isn't already covered by that module resolution.
|
|
175559
|
+
return undefined;
|
|
175560
|
+
}
|
|
175561
|
+
// In 'foo.bar./**/baz', if we got not results on 'baz', see if we can get an ambient definition
|
|
175562
|
+
// for 'bar' or 'foo' (in that order) so we can search for declarations of 'baz' later.
|
|
175563
|
+
function getAmbientCandidatesByClimbingAccessChain() {
|
|
175564
|
+
var ls = project.getLanguageService();
|
|
175565
|
+
var program = ls.getProgram();
|
|
175566
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175567
|
+
if ((ts.isStringLiteralLike(initialNode) || ts.isIdentifier(initialNode)) && ts.isAccessExpression(initialNode.parent)) {
|
|
175568
|
+
return ts.forEachNameInAccessChainWalkingLeft(initialNode, function (nameInChain) {
|
|
175569
|
+
var _a;
|
|
175570
|
+
if (nameInChain === initialNode)
|
|
175571
|
+
return undefined;
|
|
175572
|
+
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175573
|
+
fileName: d.fileName,
|
|
175574
|
+
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175575
|
+
}); });
|
|
175576
|
+
if (ts.some(candidates)) {
|
|
175577
|
+
return candidates;
|
|
175578
|
+
}
|
|
175579
|
+
}) || server.emptyArray;
|
|
175580
|
+
}
|
|
175581
|
+
return server.emptyArray;
|
|
175582
|
+
}
|
|
175583
|
+
function tryRefineDefinition(definition, program, noDtsProgram) {
|
|
175584
|
+
var _a;
|
|
175585
|
+
var fileToSearch = noDtsProgram.getSourceFile(definition.fileName);
|
|
175586
|
+
if (!fileToSearch) {
|
|
175587
|
+
return undefined;
|
|
175588
|
+
}
|
|
175589
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175590
|
+
var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode);
|
|
175591
|
+
var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* ImportSpecifier */);
|
|
175592
|
+
if (!importSpecifier)
|
|
175593
|
+
return undefined;
|
|
175594
|
+
var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text;
|
|
175595
|
+
return searchForDeclaration(nameToSearch, fileToSearch, noDtsProgram);
|
|
175596
|
+
}
|
|
175597
|
+
function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
|
|
175598
|
+
var matches = ts.FindAllReferences.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
|
|
175599
|
+
return ts.mapDefined(matches, function (match) {
|
|
175600
|
+
var symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
|
|
175601
|
+
var decl = ts.getDeclarationFromName(match);
|
|
175602
|
+
if (symbol && decl) {
|
|
175603
|
+
// I think the last argument to this is supposed to be the start node, but it doesn't seem important.
|
|
175604
|
+
// Callers internal to GoToDefinition already get confused about this.
|
|
175605
|
+
return ts.GoToDefinition.createDefinitionInfo(decl, noDtsProgram.getTypeChecker(), symbol, decl, /*unverified*/ true);
|
|
175606
|
+
}
|
|
175607
|
+
});
|
|
175608
|
+
}
|
|
175609
|
+
function ensureRoot(project, fileName) {
|
|
175610
|
+
var info = project.getScriptInfo(fileName);
|
|
175611
|
+
if (!info)
|
|
175612
|
+
return false;
|
|
175613
|
+
if (!project.containsScriptInfo(info)) {
|
|
175614
|
+
project.addRoot(info);
|
|
175615
|
+
project.updateGraph();
|
|
175616
|
+
}
|
|
175617
|
+
return true;
|
|
175618
|
+
}
|
|
175619
|
+
};
|
|
175228
175620
|
Session.prototype.getEmitOutput = function (args) {
|
|
175229
175621
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
175230
175622
|
if (!project.shouldEmitFile(project.getScriptInfo(file))) {
|
|
@@ -175788,7 +176180,7 @@ var ts;
|
|
|
175788
176180
|
return undefined;
|
|
175789
176181
|
}
|
|
175790
176182
|
var compilationSettings = project.getCompilationSettings();
|
|
175791
|
-
if (!!compilationSettings.noEmit || ts.
|
|
176183
|
+
if (!!compilationSettings.noEmit || ts.isDeclarationFileName(info.fileName) && !dtsChangeCanAffectEmit(compilationSettings)) {
|
|
175792
176184
|
// avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
|
|
175793
176185
|
return undefined;
|
|
175794
176186
|
}
|
|
@@ -176268,7 +176660,7 @@ var ts;
|
|
|
176268
176660
|
else {
|
|
176269
176661
|
var info = this.projectService.getScriptInfo(fileNameInProject); // TODO: GH#18217
|
|
176270
176662
|
if (!info.isScriptOpen()) {
|
|
176271
|
-
if (ts.
|
|
176663
|
+
if (ts.isDeclarationFileName(fileNameInProject)) {
|
|
176272
176664
|
veryLowPriorityFiles.push(fileNameInProject);
|
|
176273
176665
|
}
|
|
176274
176666
|
else {
|