@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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220420";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -4660,7 +4660,6 @@ var ts;
|
|
|
4660
4660
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4661
4661
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4662
4662
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4663
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4664
4663
|
// Error handling
|
|
4665
4664
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4666
4665
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8717,6 +8716,7 @@ var ts;
|
|
|
8717
8716
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8718
8717
|
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."),
|
|
8719
8718
|
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."),
|
|
8719
|
+
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."),
|
|
8720
8720
|
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."),
|
|
8721
8721
|
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."),
|
|
8722
8722
|
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."),
|
|
@@ -14965,6 +14965,10 @@ var ts;
|
|
|
14965
14965
|
}
|
|
14966
14966
|
}
|
|
14967
14967
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14968
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14969
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14970
|
+
}
|
|
14971
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14968
14972
|
function isLateVisibilityPaintedStatement(node) {
|
|
14969
14973
|
switch (node.kind) {
|
|
14970
14974
|
case 266 /* ImportDeclaration */:
|
|
@@ -16325,17 +16329,13 @@ var ts;
|
|
|
16325
16329
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16326
16330
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16327
16331
|
}
|
|
16328
|
-
if (ts.
|
|
16332
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16329
16333
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16330
16334
|
ts.isIdentifier(initializer.expression) &&
|
|
16331
16335
|
(initializer.expression.escapedText === "window" ||
|
|
16332
16336
|
initializer.expression.escapedText === "self" ||
|
|
16333
16337
|
initializer.expression.escapedText === "global"))) {
|
|
16334
|
-
|
|
16335
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16336
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16337
|
-
}
|
|
16338
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16338
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16339
16339
|
}
|
|
16340
16340
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16341
16341
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16543,14 +16543,14 @@ var ts;
|
|
|
16543
16543
|
}
|
|
16544
16544
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16545
16545
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16546
|
-
var _a, _b
|
|
16546
|
+
var _a, _b;
|
|
16547
16547
|
switch (node.kind) {
|
|
16548
16548
|
case 254 /* VariableDeclaration */:
|
|
16549
|
-
return node.initializer.arguments[0]
|
|
16549
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16550
16550
|
case 266 /* ImportDeclaration */:
|
|
16551
|
-
return
|
|
16551
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16552
16552
|
case 265 /* ImportEqualsDeclaration */:
|
|
16553
|
-
return
|
|
16553
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16554
16554
|
default:
|
|
16555
16555
|
ts.Debug.assertNever(node);
|
|
16556
16556
|
}
|
|
@@ -17065,7 +17065,10 @@ var ts;
|
|
|
17065
17065
|
return parent.propertyName === node;
|
|
17066
17066
|
case 275 /* ExportSpecifier */:
|
|
17067
17067
|
case 285 /* JsxAttribute */:
|
|
17068
|
-
|
|
17068
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17069
|
+
case 280 /* JsxOpeningElement */:
|
|
17070
|
+
case 281 /* JsxClosingElement */:
|
|
17071
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17069
17072
|
return true;
|
|
17070
17073
|
}
|
|
17071
17074
|
return false;
|
|
@@ -17081,21 +17084,28 @@ var ts;
|
|
|
17081
17084
|
// export = <EntityNameExpression>
|
|
17082
17085
|
// export default <EntityNameExpression>
|
|
17083
17086
|
// module.exports = <EntityNameExpression>
|
|
17084
|
-
//
|
|
17085
|
-
//
|
|
17087
|
+
// module.exports.x = <EntityNameExpression>
|
|
17088
|
+
// const x = require("...")
|
|
17089
|
+
// const { x } = require("...")
|
|
17090
|
+
// const x = require("...").y
|
|
17091
|
+
// const { x } = require("...").y
|
|
17086
17092
|
function isAliasSymbolDeclaration(node) {
|
|
17087
|
-
|
|
17093
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17088
17094
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17089
17095
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17090
17096
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17091
17097
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17092
17098
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17093
17099
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17094
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17100
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17101
|
+
return true;
|
|
17102
|
+
}
|
|
17103
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17104
|
+
ts.isPropertyAccessExpression(node)
|
|
17105
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17106
|
+
&& node.parent.left === node
|
|
17107
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17108
|
+
&& isAliasableExpression(node.parent.right));
|
|
17099
17109
|
}
|
|
17100
17110
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17101
17111
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17106,6 +17116,7 @@ var ts;
|
|
|
17106
17116
|
case 275 /* ExportSpecifier */:
|
|
17107
17117
|
case 271 /* ExportAssignment */:
|
|
17108
17118
|
case 265 /* ImportEqualsDeclaration */:
|
|
17119
|
+
case 274 /* NamespaceExport */:
|
|
17109
17120
|
return node.parent;
|
|
17110
17121
|
case 161 /* QualifiedName */:
|
|
17111
17122
|
do {
|
|
@@ -18932,6 +18943,11 @@ var ts;
|
|
|
18932
18943
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
18933
18944
|
}
|
|
18934
18945
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
18946
|
+
function isRightSideOfAccessExpression(node) {
|
|
18947
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
18948
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
18949
|
+
}
|
|
18950
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
18935
18951
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
18936
18952
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
18937
18953
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19583,6 +19599,41 @@ var ts;
|
|
|
19583
19599
|
return expr;
|
|
19584
19600
|
}
|
|
19585
19601
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19602
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19603
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19604
|
+
return walkAccessExpression(name.parent);
|
|
19605
|
+
}
|
|
19606
|
+
function walkAccessExpression(access) {
|
|
19607
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19608
|
+
var res = action(access.name);
|
|
19609
|
+
if (res !== undefined) {
|
|
19610
|
+
return res;
|
|
19611
|
+
}
|
|
19612
|
+
}
|
|
19613
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19614
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19615
|
+
var res = action(access.argumentExpression);
|
|
19616
|
+
if (res !== undefined) {
|
|
19617
|
+
return res;
|
|
19618
|
+
}
|
|
19619
|
+
}
|
|
19620
|
+
else {
|
|
19621
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19622
|
+
return undefined;
|
|
19623
|
+
}
|
|
19624
|
+
}
|
|
19625
|
+
if (isAccessExpression(access.expression)) {
|
|
19626
|
+
return walkAccessExpression(access.expression);
|
|
19627
|
+
}
|
|
19628
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19629
|
+
// End of chain at Identifier 'x.y.z'
|
|
19630
|
+
return action(access.expression);
|
|
19631
|
+
}
|
|
19632
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19633
|
+
return undefined;
|
|
19634
|
+
}
|
|
19635
|
+
}
|
|
19636
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19586
19637
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19587
19638
|
while (true) {
|
|
19588
19639
|
switch (node.kind) {
|
|
@@ -20530,6 +20581,7 @@ var ts;
|
|
|
20530
20581
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20531
20582
|
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 */]];
|
|
20532
20583
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20584
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20533
20585
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20534
20586
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20535
20587
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21218,6 +21270,11 @@ var ts;
|
|
|
21218
21270
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21219
21271
|
}
|
|
21220
21272
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21273
|
+
function getParameterTypeNode(parameter) {
|
|
21274
|
+
var _a;
|
|
21275
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21276
|
+
}
|
|
21277
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21221
21278
|
})(ts || (ts = {}));
|
|
21222
21279
|
/* @internal */
|
|
21223
21280
|
var ts;
|
|
@@ -33129,7 +33186,8 @@ var ts;
|
|
|
33129
33186
|
var pos = getNodePos();
|
|
33130
33187
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33131
33188
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33132
|
-
|
|
33189
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33190
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33133
33191
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33134
33192
|
}
|
|
33135
33193
|
function parseTypeParameter() {
|
|
@@ -34165,7 +34223,7 @@ var ts;
|
|
|
34165
34223
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34166
34224
|
}
|
|
34167
34225
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34168
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34226
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34169
34227
|
}
|
|
34170
34228
|
function isYieldExpression() {
|
|
34171
34229
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34230,7 +34288,7 @@ var ts;
|
|
|
34230
34288
|
return addJSDocComment(finishNode(node, pos));
|
|
34231
34289
|
}
|
|
34232
34290
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34233
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34291
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34234
34292
|
if (triState === 0 /* False */) {
|
|
34235
34293
|
// It's definitely not a parenthesized arrow function expression.
|
|
34236
34294
|
return undefined;
|
|
@@ -34240,16 +34298,16 @@ var ts;
|
|
|
34240
34298
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34241
34299
|
// expression instead.
|
|
34242
34300
|
return triState === 1 /* True */ ?
|
|
34243
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34301
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34244
34302
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34245
34303
|
}
|
|
34246
34304
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34247
34305
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34248
34306
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34249
34307
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34250
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34308
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34251
34309
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34252
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34310
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34253
34311
|
}
|
|
34254
34312
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34255
34313
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34260,7 +34318,7 @@ var ts;
|
|
|
34260
34318
|
// Definitely not a parenthesized arrow function.
|
|
34261
34319
|
return 0 /* False */;
|
|
34262
34320
|
}
|
|
34263
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34321
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34264
34322
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34265
34323
|
nextToken();
|
|
34266
34324
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34280,8 +34338,13 @@ var ts;
|
|
|
34280
34338
|
// but this is probably what the user intended.
|
|
34281
34339
|
var third = nextToken();
|
|
34282
34340
|
switch (third) {
|
|
34283
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34284
34341
|
case 58 /* ColonToken */:
|
|
34342
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34343
|
+
// "a ? () : ..."
|
|
34344
|
+
return 0 /* False */;
|
|
34345
|
+
}
|
|
34346
|
+
return 1 /* True */;
|
|
34347
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34285
34348
|
case 18 /* OpenBraceToken */:
|
|
34286
34349
|
return 1 /* True */;
|
|
34287
34350
|
default:
|
|
@@ -34455,13 +34518,8 @@ var ts;
|
|
|
34455
34518
|
// This is a valid arrow function with "z" as the return type.
|
|
34456
34519
|
//
|
|
34457
34520
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34458
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34521
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34459
34522
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34460
|
-
//
|
|
34461
|
-
// For example,
|
|
34462
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34463
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34464
|
-
// be an arrow expression, so we allow a return type.
|
|
34465
34523
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34466
34524
|
return undefined;
|
|
34467
34525
|
}
|
|
@@ -34531,7 +34589,7 @@ var ts;
|
|
|
34531
34589
|
topLevel = savedTopLevel;
|
|
34532
34590
|
return node;
|
|
34533
34591
|
}
|
|
34534
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34592
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34535
34593
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34536
34594
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34537
34595
|
if (!questionToken) {
|
|
@@ -34541,7 +34599,7 @@ var ts;
|
|
|
34541
34599
|
// we do not that for the 'whenFalse' part.
|
|
34542
34600
|
var colonToken;
|
|
34543
34601
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34544
|
-
? parseAssignmentExpressionOrHigher(
|
|
34602
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34545
34603
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34546
34604
|
}
|
|
34547
34605
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35371,34 +35429,10 @@ var ts;
|
|
|
35371
35429
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35372
35430
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35373
35431
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35374
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35375
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35376
|
-
// expression.
|
|
35377
|
-
// falls through
|
|
35378
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35379
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35380
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35381
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35382
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35383
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35384
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35385
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35386
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35387
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35388
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35389
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35390
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35391
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35392
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35393
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35394
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35395
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35396
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35397
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35398
35432
|
return true;
|
|
35399
35433
|
}
|
|
35400
|
-
//
|
|
35401
|
-
return
|
|
35434
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35435
|
+
return !isStartOfExpression();
|
|
35402
35436
|
}
|
|
35403
35437
|
function parsePrimaryExpression() {
|
|
35404
35438
|
switch (token()) {
|
|
@@ -38616,7 +38650,7 @@ var ts;
|
|
|
38616
38650
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38617
38651
|
/** @internal */
|
|
38618
38652
|
function isDeclarationFileName(fileName) {
|
|
38619
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38653
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38620
38654
|
}
|
|
38621
38655
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38622
38656
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42124,7 +42158,8 @@ var ts;
|
|
|
42124
42158
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42125
42159
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42126
42160
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42127
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42161
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42162
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42128
42163
|
})(Extensions || (Extensions = {}));
|
|
42129
42164
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42130
42165
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43069,7 +43104,21 @@ var ts;
|
|
|
43069
43104
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43070
43105
|
}
|
|
43071
43106
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43072
|
-
|
|
43107
|
+
var extensions;
|
|
43108
|
+
if (lookupConfig) {
|
|
43109
|
+
extensions = tsconfigExtensions;
|
|
43110
|
+
}
|
|
43111
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43112
|
+
extensions = [Extensions.TsOnly];
|
|
43113
|
+
if (compilerOptions.allowJs)
|
|
43114
|
+
extensions.push(Extensions.JavaScript);
|
|
43115
|
+
if (compilerOptions.resolveJsonModule)
|
|
43116
|
+
extensions.push(Extensions.Json);
|
|
43117
|
+
}
|
|
43118
|
+
else {
|
|
43119
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43120
|
+
}
|
|
43121
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43073
43122
|
}
|
|
43074
43123
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43075
43124
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43078,6 +43127,10 @@ var ts;
|
|
|
43078
43127
|
var failedLookupLocations = [];
|
|
43079
43128
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43080
43129
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43130
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43131
|
+
if (compilerOptions.noDtsResolution) {
|
|
43132
|
+
conditions.pop();
|
|
43133
|
+
}
|
|
43081
43134
|
var state = {
|
|
43082
43135
|
compilerOptions: compilerOptions,
|
|
43083
43136
|
host: host,
|
|
@@ -43085,7 +43138,7 @@ var ts;
|
|
|
43085
43138
|
failedLookupLocations: failedLookupLocations,
|
|
43086
43139
|
packageJsonInfoCache: cache,
|
|
43087
43140
|
features: features,
|
|
43088
|
-
conditions:
|
|
43141
|
+
conditions: conditions,
|
|
43089
43142
|
};
|
|
43090
43143
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43091
43144
|
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);
|
|
@@ -43261,9 +43314,9 @@ var ts;
|
|
|
43261
43314
|
}
|
|
43262
43315
|
}
|
|
43263
43316
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43264
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43317
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43265
43318
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43266
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43319
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43267
43320
|
}
|
|
43268
43321
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43269
43322
|
}
|
|
@@ -43293,20 +43346,22 @@ var ts;
|
|
|
43293
43346
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43294
43347
|
}
|
|
43295
43348
|
case Extensions.TypeScript:
|
|
43349
|
+
case Extensions.TsOnly:
|
|
43350
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43296
43351
|
switch (originalExtension) {
|
|
43297
43352
|
case ".mjs" /* Mjs */:
|
|
43298
43353
|
case ".mts" /* Mts */:
|
|
43299
43354
|
case ".d.mts" /* Dmts */:
|
|
43300
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43355
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43301
43356
|
case ".cjs" /* Cjs */:
|
|
43302
43357
|
case ".cts" /* Cts */:
|
|
43303
43358
|
case ".d.cts" /* Dcts */:
|
|
43304
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43359
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43305
43360
|
case ".json" /* Json */:
|
|
43306
43361
|
candidate += ".json" /* Json */;
|
|
43307
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43362
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43308
43363
|
default:
|
|
43309
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43364
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43310
43365
|
}
|
|
43311
43366
|
case Extensions.JavaScript:
|
|
43312
43367
|
switch (originalExtension) {
|
|
@@ -43533,6 +43588,7 @@ var ts;
|
|
|
43533
43588
|
switch (extensions) {
|
|
43534
43589
|
case Extensions.JavaScript:
|
|
43535
43590
|
case Extensions.Json:
|
|
43591
|
+
case Extensions.TsOnly:
|
|
43536
43592
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43537
43593
|
break;
|
|
43538
43594
|
case Extensions.TypeScript:
|
|
@@ -43605,14 +43661,16 @@ var ts;
|
|
|
43605
43661
|
function extensionIsOk(extensions, extension) {
|
|
43606
43662
|
switch (extensions) {
|
|
43607
43663
|
case Extensions.JavaScript:
|
|
43608
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43664
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43609
43665
|
case Extensions.TSConfig:
|
|
43610
43666
|
case Extensions.Json:
|
|
43611
43667
|
return extension === ".json" /* Json */;
|
|
43612
43668
|
case Extensions.TypeScript:
|
|
43613
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43669
|
+
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 */;
|
|
43670
|
+
case Extensions.TsOnly:
|
|
43671
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43614
43672
|
case Extensions.DtsOnly:
|
|
43615
|
-
return extension === ".d.ts" /* Dts */;
|
|
43673
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43616
43674
|
}
|
|
43617
43675
|
}
|
|
43618
43676
|
/* @internal */
|
|
@@ -45772,6 +45830,7 @@ var ts;
|
|
|
45772
45830
|
case 261 /* ModuleDeclaration */:
|
|
45773
45831
|
case 259 /* TypeAliasDeclaration */:
|
|
45774
45832
|
case 195 /* MappedType */:
|
|
45833
|
+
case 176 /* IndexSignature */:
|
|
45775
45834
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45776
45835
|
case 305 /* SourceFile */:
|
|
45777
45836
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45790,7 +45849,6 @@ var ts;
|
|
|
45790
45849
|
case 317 /* JSDocFunctionType */:
|
|
45791
45850
|
case 179 /* FunctionType */:
|
|
45792
45851
|
case 175 /* ConstructSignature */:
|
|
45793
|
-
case 176 /* IndexSignature */:
|
|
45794
45852
|
case 180 /* ConstructorType */:
|
|
45795
45853
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45796
45854
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50368,27 +50426,27 @@ var ts;
|
|
|
50368
50426
|
function resolveAlias(symbol) {
|
|
50369
50427
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50370
50428
|
var links = getSymbolLinks(symbol);
|
|
50371
|
-
if (!links.
|
|
50372
|
-
links.
|
|
50429
|
+
if (!links.aliasTarget) {
|
|
50430
|
+
links.aliasTarget = resolvingSymbol;
|
|
50373
50431
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50374
50432
|
if (!node)
|
|
50375
50433
|
return ts.Debug.fail();
|
|
50376
50434
|
var target = getTargetOfAliasDeclaration(node);
|
|
50377
|
-
if (links.
|
|
50378
|
-
links.
|
|
50435
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50436
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50379
50437
|
}
|
|
50380
50438
|
else {
|
|
50381
50439
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50382
50440
|
}
|
|
50383
50441
|
}
|
|
50384
|
-
else if (links.
|
|
50385
|
-
links.
|
|
50442
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50443
|
+
links.aliasTarget = unknownSymbol;
|
|
50386
50444
|
}
|
|
50387
|
-
return links.
|
|
50445
|
+
return links.aliasTarget;
|
|
50388
50446
|
}
|
|
50389
50447
|
function tryResolveAlias(symbol) {
|
|
50390
50448
|
var links = getSymbolLinks(symbol);
|
|
50391
|
-
if (links.
|
|
50449
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50392
50450
|
return resolveAlias(symbol);
|
|
50393
50451
|
}
|
|
50394
50452
|
return undefined;
|
|
@@ -52185,13 +52243,37 @@ var ts;
|
|
|
52185
52243
|
return ts.Debug.fail("Should be unreachable.");
|
|
52186
52244
|
function conditionalTypeToTypeNode(type) {
|
|
52187
52245
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52246
|
+
context.approximateLength += 15;
|
|
52247
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52248
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52249
|
+
var name = typeParameterToName(newParam, context);
|
|
52250
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52251
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52252
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52253
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52254
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52255
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52256
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52257
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52258
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52259
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52260
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52261
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52262
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52263
|
+
// this is potentially simplifiable to
|
|
52264
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52265
|
+
// but that may confuse users who read the output more.
|
|
52266
|
+
// On the other hand,
|
|
52267
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52268
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52269
|
+
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 */));
|
|
52270
|
+
}
|
|
52188
52271
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52189
52272
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52190
52273
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52191
52274
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52192
52275
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52193
52276
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52194
|
-
context.approximateLength += 15;
|
|
52195
52277
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52196
52278
|
}
|
|
52197
52279
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -52305,7 +52387,7 @@ var ts;
|
|
|
52305
52387
|
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
|
52306
52388
|
// of types allows us to catch circular references to instantiations of the same anonymous type
|
|
52307
52389
|
if (!context.visitedTypes) {
|
|
52308
|
-
context.visitedTypes = new ts.
|
|
52390
|
+
context.visitedTypes = new ts.Set();
|
|
52309
52391
|
}
|
|
52310
52392
|
if (id && !context.symbolDepth) {
|
|
52311
52393
|
context.symbolDepth = new ts.Map();
|
|
@@ -52323,22 +52405,15 @@ var ts;
|
|
|
52323
52405
|
context.approximateLength += cachedResult.addedLength;
|
|
52324
52406
|
return deepCloneOrReuseNode(cachedResult);
|
|
52325
52407
|
}
|
|
52326
|
-
var
|
|
52327
|
-
var symbolDepth = id ? context.symbolDepth.get(id) : undefined;
|
|
52328
|
-
if (symbolDepth) {
|
|
52329
|
-
totalDepth += symbolDepth;
|
|
52330
|
-
}
|
|
52331
|
-
var visitedTypeDepth = context.visitedTypes.get(typeId);
|
|
52332
|
-
if (visitedTypeDepth) {
|
|
52333
|
-
totalDepth += visitedTypeDepth;
|
|
52334
|
-
}
|
|
52335
|
-
if (totalDepth > 10) {
|
|
52336
|
-
return createElidedInformationPlaceholder(context);
|
|
52337
|
-
}
|
|
52408
|
+
var depth;
|
|
52338
52409
|
if (id) {
|
|
52339
|
-
context.symbolDepth.
|
|
52410
|
+
depth = context.symbolDepth.get(id) || 0;
|
|
52411
|
+
if (depth > 10) {
|
|
52412
|
+
return createElidedInformationPlaceholder(context);
|
|
52413
|
+
}
|
|
52414
|
+
context.symbolDepth.set(id, depth + 1);
|
|
52340
52415
|
}
|
|
52341
|
-
context.visitedTypes.
|
|
52416
|
+
context.visitedTypes.add(typeId);
|
|
52342
52417
|
var startLength = context.approximateLength;
|
|
52343
52418
|
var result = transform(type);
|
|
52344
52419
|
var addedLength = context.approximateLength - startLength;
|
|
@@ -52349,19 +52424,9 @@ var ts;
|
|
|
52349
52424
|
result.addedLength = addedLength;
|
|
52350
52425
|
(_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
52351
52426
|
}
|
|
52352
|
-
|
|
52353
|
-
context.visitedTypes.set(typeId, visitedTypeDepth);
|
|
52354
|
-
}
|
|
52355
|
-
else {
|
|
52356
|
-
context.visitedTypes.delete(typeId);
|
|
52357
|
-
}
|
|
52427
|
+
context.visitedTypes.delete(typeId);
|
|
52358
52428
|
if (id) {
|
|
52359
|
-
|
|
52360
|
-
context.symbolDepth.set(id, symbolDepth);
|
|
52361
|
-
}
|
|
52362
|
-
else {
|
|
52363
|
-
context.symbolDepth.delete(id);
|
|
52364
|
-
}
|
|
52429
|
+
context.symbolDepth.set(id, depth);
|
|
52365
52430
|
}
|
|
52366
52431
|
return result;
|
|
52367
52432
|
function deepCloneOrReuseNode(node) {
|
|
@@ -52907,9 +52972,6 @@ var ts;
|
|
|
52907
52972
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
52908
52973
|
parameterType = getOptionalType(parameterType);
|
|
52909
52974
|
}
|
|
52910
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
52911
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
52912
|
-
}
|
|
52913
52975
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
52914
52976
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
52915
52977
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53468,7 +53530,7 @@ var ts;
|
|
|
53468
53530
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53469
53531
|
// try to reuse the existing annotation
|
|
53470
53532
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53471
|
-
if (
|
|
53533
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53472
53534
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53473
53535
|
if (result_6) {
|
|
53474
53536
|
return result_6;
|
|
@@ -53485,6 +53547,16 @@ var ts;
|
|
|
53485
53547
|
context.flags = oldFlags;
|
|
53486
53548
|
return result;
|
|
53487
53549
|
}
|
|
53550
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53551
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53552
|
+
if (typeFromTypeNode === type) {
|
|
53553
|
+
return true;
|
|
53554
|
+
}
|
|
53555
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53556
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53557
|
+
}
|
|
53558
|
+
return false;
|
|
53559
|
+
}
|
|
53488
53560
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53489
53561
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53490
53562
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55756,7 +55828,7 @@ var ts;
|
|
|
55756
55828
|
}
|
|
55757
55829
|
}
|
|
55758
55830
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55759
|
-
type = getUnionType(sourceTypes
|
|
55831
|
+
type = getUnionType(sourceTypes);
|
|
55760
55832
|
}
|
|
55761
55833
|
}
|
|
55762
55834
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58505,8 +58577,9 @@ var ts;
|
|
|
58505
58577
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58506
58578
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58507
58579
|
// nesting, so it is effectively just a safety stop.
|
|
58508
|
-
|
|
58509
|
-
|
|
58580
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58581
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58582
|
+
stack.push(identity_1);
|
|
58510
58583
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58511
58584
|
stack.pop();
|
|
58512
58585
|
}
|
|
@@ -61862,11 +61935,14 @@ var ts;
|
|
|
61862
61935
|
return type[cache] = elementType;
|
|
61863
61936
|
}
|
|
61864
61937
|
}
|
|
61865
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
61866
|
-
//
|
|
61867
|
-
// construct the type Box<T[X]>.
|
|
61868
|
-
if (isGenericMappedType(objectType)
|
|
61869
|
-
|
|
61938
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
61939
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
61940
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
61941
|
+
if (isGenericMappedType(objectType)) {
|
|
61942
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
61943
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61944
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61945
|
+
}
|
|
61870
61946
|
}
|
|
61871
61947
|
return type[cache] = type;
|
|
61872
61948
|
}
|
|
@@ -66704,12 +66780,12 @@ var ts;
|
|
|
66704
66780
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66705
66781
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66706
66782
|
if (depth >= maxDepth) {
|
|
66707
|
-
var
|
|
66783
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66708
66784
|
var count = 0;
|
|
66709
66785
|
var lastTypeId = 0;
|
|
66710
66786
|
for (var i = 0; i < depth; i++) {
|
|
66711
66787
|
var t = stack[i];
|
|
66712
|
-
if (getRecursionIdentity(t) ===
|
|
66788
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66713
66789
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66714
66790
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66715
66791
|
if (t.id >= lastTypeId) {
|
|
@@ -74186,10 +74262,15 @@ var ts;
|
|
|
74186
74262
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74187
74263
|
}
|
|
74188
74264
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74265
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74266
|
+
// here even if `Foo` is not a const enum.
|
|
74267
|
+
//
|
|
74189
74268
|
// The exceptions are:
|
|
74190
74269
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74191
74270
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74192
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74271
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74272
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74273
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74193
74274
|
markAliasReferenced(parentSymbol, node);
|
|
74194
74275
|
}
|
|
74195
74276
|
var propType;
|
|
@@ -76711,7 +76792,7 @@ var ts;
|
|
|
76711
76792
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76712
76793
|
newSymbol.parent = originalSymbol;
|
|
76713
76794
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76714
|
-
newSymbol.
|
|
76795
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76715
76796
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76716
76797
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76717
76798
|
}
|
|
@@ -79523,19 +79604,28 @@ var ts;
|
|
|
79523
79604
|
if (constraintType && defaultType) {
|
|
79524
79605
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79525
79606
|
}
|
|
79526
|
-
|
|
79607
|
+
checkNodeDeferred(node);
|
|
79608
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79609
|
+
}
|
|
79610
|
+
function checkTypeParameterDeferred(node) {
|
|
79611
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79612
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79527
79613
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79528
|
-
if (modifiers
|
|
79614
|
+
if (modifiers) {
|
|
79529
79615
|
var symbol = getSymbolOfNode(node.parent);
|
|
79530
|
-
|
|
79531
|
-
|
|
79532
|
-
|
|
79533
|
-
|
|
79534
|
-
|
|
79535
|
-
|
|
79616
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79617
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79618
|
+
}
|
|
79619
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79620
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79621
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79622
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79623
|
+
varianceTypeParameter = typeParameter;
|
|
79624
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79625
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79626
|
+
}
|
|
79536
79627
|
}
|
|
79537
79628
|
}
|
|
79538
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79539
79629
|
}
|
|
79540
79630
|
function checkParameter(node) {
|
|
79541
79631
|
// Grammar checking
|
|
@@ -80025,7 +80115,7 @@ var ts;
|
|
|
80025
80115
|
superCallStatement = statement;
|
|
80026
80116
|
break;
|
|
80027
80117
|
}
|
|
80028
|
-
if (
|
|
80118
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80029
80119
|
break;
|
|
80030
80120
|
}
|
|
80031
80121
|
}
|
|
@@ -85378,6 +85468,9 @@ var ts;
|
|
|
85378
85468
|
case 226 /* ClassExpression */:
|
|
85379
85469
|
checkClassExpressionDeferred(node);
|
|
85380
85470
|
break;
|
|
85471
|
+
case 163 /* TypeParameter */:
|
|
85472
|
+
checkTypeParameterDeferred(node);
|
|
85473
|
+
break;
|
|
85381
85474
|
case 279 /* JsxSelfClosingElement */:
|
|
85382
85475
|
checkJsxSelfClosingElementDeferred(node);
|
|
85383
85476
|
break;
|
|
@@ -85912,15 +86005,20 @@ var ts;
|
|
|
85912
86005
|
return propertyDeclaration;
|
|
85913
86006
|
}
|
|
85914
86007
|
}
|
|
85915
|
-
else if (ts.isMetaProperty(parent)) {
|
|
85916
|
-
|
|
85917
|
-
|
|
85918
|
-
if (propertyDeclaration) {
|
|
85919
|
-
return propertyDeclaration;
|
|
85920
|
-
}
|
|
85921
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86008
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86009
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86010
|
+
// `target` in `new.target`
|
|
85922
86011
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
85923
86012
|
}
|
|
86013
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86014
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86015
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86016
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86017
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86018
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86019
|
+
}
|
|
86020
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86021
|
+
return undefined;
|
|
85924
86022
|
}
|
|
85925
86023
|
}
|
|
85926
86024
|
switch (node.kind) {
|
|
@@ -86192,11 +86290,11 @@ var ts;
|
|
|
86192
86290
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86193
86291
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86194
86292
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86195
|
-
: ts.singleElementArray(
|
|
86293
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86196
86294
|
}
|
|
86197
86295
|
return undefined;
|
|
86198
86296
|
}
|
|
86199
|
-
function
|
|
86297
|
+
function tryGetTarget(symbol) {
|
|
86200
86298
|
var target;
|
|
86201
86299
|
var next = symbol;
|
|
86202
86300
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86426,7 +86524,7 @@ var ts;
|
|
|
86426
86524
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86427
86525
|
return true;
|
|
86428
86526
|
}
|
|
86429
|
-
var target = getSymbolLinks(symbol).
|
|
86527
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86430
86528
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86431
86529
|
target.flags & 111551 /* Value */ &&
|
|
86432
86530
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86474,11 +86572,6 @@ var ts;
|
|
|
86474
86572
|
!parameter.initializer &&
|
|
86475
86573
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86476
86574
|
}
|
|
86477
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86478
|
-
return !!strictNullChecks &&
|
|
86479
|
-
isOptionalParameter(parameter) &&
|
|
86480
|
-
!parameter.initializer;
|
|
86481
|
-
}
|
|
86482
86575
|
function isExpandoFunctionDeclaration(node) {
|
|
86483
86576
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86484
86577
|
if (!declaration) {
|
|
@@ -87395,8 +87488,7 @@ var ts;
|
|
|
87395
87488
|
case 144 /* OutKeyword */:
|
|
87396
87489
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87397
87490
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87398
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87399
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87491
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87400
87492
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87401
87493
|
}
|
|
87402
87494
|
if (flags & inOutFlag) {
|
|
@@ -92630,11 +92722,11 @@ var ts;
|
|
|
92630
92722
|
}
|
|
92631
92723
|
var statements = [];
|
|
92632
92724
|
resumeLexicalEnvironment();
|
|
92633
|
-
var
|
|
92634
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92725
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92726
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92635
92727
|
// If there was a super call, visit existing statements up to and including it
|
|
92636
92728
|
if (superStatementIndex >= 0) {
|
|
92637
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92729
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92638
92730
|
}
|
|
92639
92731
|
// Transform parameters into property assignments. Transforms this:
|
|
92640
92732
|
//
|
|
@@ -92653,12 +92745,12 @@ var ts;
|
|
|
92653
92745
|
if (superStatementIndex >= 0) {
|
|
92654
92746
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92655
92747
|
}
|
|
92656
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92748
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92657
92749
|
else {
|
|
92658
|
-
statements =
|
|
92750
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92659
92751
|
}
|
|
92660
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92661
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92752
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92753
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92662
92754
|
// End the lexical environment.
|
|
92663
92755
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92664
92756
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -94604,7 +94696,7 @@ var ts;
|
|
|
94604
94696
|
}
|
|
94605
94697
|
resumeLexicalEnvironment();
|
|
94606
94698
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94607
|
-
var
|
|
94699
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94608
94700
|
var prologueStatementCount = 0;
|
|
94609
94701
|
var superStatementIndex = -1;
|
|
94610
94702
|
var statements = [];
|
|
@@ -94613,8 +94705,11 @@ var ts;
|
|
|
94613
94705
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94614
94706
|
// If there was a super call, visit existing statements up to and including it
|
|
94615
94707
|
if (superStatementIndex >= 0) {
|
|
94616
|
-
|
|
94617
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94708
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94709
|
+
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);
|
|
94710
|
+
}
|
|
94711
|
+
else if (prologueStatementCount >= 0) {
|
|
94712
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94618
94713
|
}
|
|
94619
94714
|
}
|
|
94620
94715
|
if (needsSyntheticConstructor) {
|
|
@@ -94650,22 +94745,20 @@ var ts;
|
|
|
94650
94745
|
}
|
|
94651
94746
|
}
|
|
94652
94747
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94653
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94748
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94654
94749
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94655
94750
|
if (superStatementIndex >= 0) {
|
|
94656
94751
|
ts.addRange(statements, parameterProperties);
|
|
94657
94752
|
}
|
|
94658
|
-
// If a synthetic super() call was added, add them just after it
|
|
94659
|
-
else if (needsSyntheticConstructor) {
|
|
94660
|
-
statements = __spreadArray(__spreadArray([
|
|
94661
|
-
statements[0]
|
|
94662
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94663
|
-
}
|
|
94664
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94665
94753
|
else {
|
|
94666
|
-
|
|
94754
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94755
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94756
|
+
// If a synthetic super() call was added, need to account for that
|
|
94757
|
+
if (needsSyntheticConstructor)
|
|
94758
|
+
superAndPrologueStatementCount++;
|
|
94759
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94667
94760
|
}
|
|
94668
|
-
|
|
94761
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94669
94762
|
}
|
|
94670
94763
|
}
|
|
94671
94764
|
}
|
|
@@ -94675,7 +94768,7 @@ var ts;
|
|
|
94675
94768
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94676
94769
|
// Add existing statements after the initial prologues and super call
|
|
94677
94770
|
if (constructor) {
|
|
94678
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94771
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94679
94772
|
}
|
|
94680
94773
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94681
94774
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -98716,7 +98809,7 @@ var ts;
|
|
|
98716
98809
|
// ```
|
|
98717
98810
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98718
98811
|
}
|
|
98719
|
-
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)),
|
|
98812
|
+
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)),
|
|
98720
98813
|
/*location*/ constructor.body.statements),
|
|
98721
98814
|
/*multiLine*/ true);
|
|
98722
98815
|
ts.setTextRange(body, constructor.body);
|
|
@@ -108422,6 +108515,10 @@ var ts;
|
|
|
108422
108515
|
return factory.updateModifiers(statement, modifiers);
|
|
108423
108516
|
}
|
|
108424
108517
|
function transformTopLevelDeclaration(input) {
|
|
108518
|
+
if (lateMarkedStatements) {
|
|
108519
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108520
|
+
;
|
|
108521
|
+
}
|
|
108425
108522
|
if (shouldStripInternal(input))
|
|
108426
108523
|
return;
|
|
108427
108524
|
switch (input.kind) {
|
|
@@ -109553,7 +109650,7 @@ var ts;
|
|
|
109553
109650
|
addOutput(buildInfoPath);
|
|
109554
109651
|
}
|
|
109555
109652
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109556
|
-
if (ts.
|
|
109653
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109557
109654
|
return;
|
|
109558
109655
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109559
109656
|
addOutput(js);
|
|
@@ -109598,7 +109695,7 @@ var ts;
|
|
|
109598
109695
|
/*@internal*/
|
|
109599
109696
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109600
109697
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109601
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109698
|
+
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));
|
|
109602
109699
|
}
|
|
109603
109700
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109604
109701
|
/*@internal*/
|
|
@@ -109640,7 +109737,7 @@ var ts;
|
|
|
109640
109737
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109641
109738
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109642
109739
|
var inputFileName = _b[_a];
|
|
109643
|
-
if (ts.
|
|
109740
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109644
109741
|
continue;
|
|
109645
109742
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109646
109743
|
if (jsFilePath)
|
|
@@ -114990,7 +115087,7 @@ var ts;
|
|
|
114990
115087
|
if (ts.outFile(options) || options.outDir)
|
|
114991
115088
|
return false;
|
|
114992
115089
|
// File if emitted next to input needs to be ignored
|
|
114993
|
-
if (ts.
|
|
115090
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
114994
115091
|
// If its declaration directory: its not ignored if not excluded by config
|
|
114995
115092
|
if (options.declarationDir)
|
|
114996
115093
|
return false;
|
|
@@ -116163,7 +116260,7 @@ var ts;
|
|
|
116163
116260
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116164
116261
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116165
116262
|
var fileName = _c[_b];
|
|
116166
|
-
if (!ts.
|
|
116263
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116167
116264
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116168
116265
|
}
|
|
116169
116266
|
}
|
|
@@ -116354,7 +116451,7 @@ var ts;
|
|
|
116354
116451
|
}
|
|
116355
116452
|
function getRedirectReferenceForResolution(file) {
|
|
116356
116453
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116357
|
-
if (redirect || !ts.
|
|
116454
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116358
116455
|
return redirect;
|
|
116359
116456
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116360
116457
|
// 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
|
|
@@ -117745,7 +117842,7 @@ var ts;
|
|
|
117745
117842
|
}
|
|
117746
117843
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117747
117844
|
// Ignore dts or any json files
|
|
117748
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
117845
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117749
117846
|
return undefined;
|
|
117750
117847
|
}
|
|
117751
117848
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117794,7 +117891,7 @@ var ts;
|
|
|
117794
117891
|
else {
|
|
117795
117892
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117796
117893
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117797
|
-
if (!ts.
|
|
117894
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117798
117895
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117799
117896
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117800
117897
|
}
|
|
@@ -118595,7 +118692,7 @@ var ts;
|
|
|
118595
118692
|
if (options.outDir) {
|
|
118596
118693
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118597
118694
|
}
|
|
118598
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118695
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118599
118696
|
// Otherwise just check if sourceFile with the name exists
|
|
118600
118697
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118601
118698
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -118928,13 +119025,9 @@ var ts;
|
|
|
118928
119025
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
118929
119026
|
var BuilderState;
|
|
118930
119027
|
(function (BuilderState) {
|
|
118931
|
-
var manyToManyPathMapCount = 0;
|
|
118932
119028
|
function createManyToManyPathMap() {
|
|
118933
119029
|
function create(forward, reverse, deleted) {
|
|
118934
|
-
var version = 0;
|
|
118935
119030
|
var map = {
|
|
118936
|
-
id: manyToManyPathMapCount++,
|
|
118937
|
-
version: function () { return version; },
|
|
118938
119031
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
118939
119032
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
118940
119033
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -118950,30 +119043,29 @@ var ts;
|
|
|
118950
119043
|
}
|
|
118951
119044
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
118952
119045
|
forward.delete(k);
|
|
118953
|
-
version++;
|
|
118954
119046
|
return true;
|
|
118955
119047
|
},
|
|
118956
119048
|
set: function (k, vSet) {
|
|
118957
|
-
|
|
119049
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
118958
119050
|
var existingVSet = forward.get(k);
|
|
118959
119051
|
forward.set(k, vSet);
|
|
118960
119052
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
118961
119053
|
if (!vSet.has(v)) {
|
|
118962
|
-
changed = true;
|
|
118963
119054
|
deleteFromMultimap(reverse, v, k);
|
|
118964
119055
|
}
|
|
118965
119056
|
});
|
|
118966
119057
|
vSet.forEach(function (v) {
|
|
118967
119058
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
118968
|
-
changed = true;
|
|
118969
119059
|
addToMultimap(reverse, v, k);
|
|
118970
119060
|
}
|
|
118971
119061
|
});
|
|
118972
|
-
if (changed) {
|
|
118973
|
-
version++;
|
|
118974
|
-
}
|
|
118975
119062
|
return map;
|
|
118976
119063
|
},
|
|
119064
|
+
clear: function () {
|
|
119065
|
+
forward.clear();
|
|
119066
|
+
reverse.clear();
|
|
119067
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119068
|
+
}
|
|
118977
119069
|
};
|
|
118978
119070
|
return map;
|
|
118979
119071
|
}
|
|
@@ -118988,11 +119080,10 @@ var ts;
|
|
|
118988
119080
|
}
|
|
118989
119081
|
set.add(v);
|
|
118990
119082
|
}
|
|
118991
|
-
function deleteFromMultimap(map, k, v
|
|
118992
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119083
|
+
function deleteFromMultimap(map, k, v) {
|
|
118993
119084
|
var set = map.get(k);
|
|
118994
119085
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
118995
|
-
if (
|
|
119086
|
+
if (!set.size) {
|
|
118996
119087
|
map.delete(k);
|
|
118997
119088
|
}
|
|
118998
119089
|
return true;
|
|
@@ -119221,7 +119312,7 @@ var ts;
|
|
|
119221
119312
|
/*forceDtsEmit*/ true);
|
|
119222
119313
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119223
119314
|
if (firstDts_1) {
|
|
119224
|
-
ts.Debug.assert(ts.
|
|
119315
|
+
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; })); });
|
|
119225
119316
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119226
119317
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119227
119318
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119279,20 +119370,6 @@ var ts;
|
|
|
119279
119370
|
var _a;
|
|
119280
119371
|
if (exportedModulesMapCache) {
|
|
119281
119372
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119282
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119283
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119284
|
-
if (state.previousCache) {
|
|
119285
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119286
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119287
|
-
// was updated, there's no need to update again
|
|
119288
|
-
return;
|
|
119289
|
-
}
|
|
119290
|
-
state.previousCache.id = cacheId;
|
|
119291
|
-
state.previousCache.version = cacheVersion;
|
|
119292
|
-
}
|
|
119293
|
-
else {
|
|
119294
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119295
|
-
}
|
|
119296
119373
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119297
119374
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119298
119375
|
}
|
|
@@ -119626,7 +119703,8 @@ var ts;
|
|
|
119626
119703
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119627
119704
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119628
119705
|
*/
|
|
119629
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119706
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119707
|
+
var _a;
|
|
119630
119708
|
while (true) {
|
|
119631
119709
|
var affectedFiles = state.affectedFiles;
|
|
119632
119710
|
if (affectedFiles) {
|
|
@@ -119637,7 +119715,7 @@ var ts;
|
|
|
119637
119715
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119638
119716
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119639
119717
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119640
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119718
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119641
119719
|
return affectedFile;
|
|
119642
119720
|
}
|
|
119643
119721
|
affectedFilesIndex++;
|
|
@@ -119649,6 +119727,7 @@ var ts;
|
|
|
119649
119727
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119650
119728
|
state.currentAffectedFilesSignatures.clear();
|
|
119651
119729
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119730
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119652
119731
|
state.affectedFiles = undefined;
|
|
119653
119732
|
}
|
|
119654
119733
|
// Get next changed file
|
|
@@ -119678,6 +119757,11 @@ var ts;
|
|
|
119678
119757
|
state.seenAffectedFiles = new ts.Set();
|
|
119679
119758
|
}
|
|
119680
119759
|
}
|
|
119760
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119761
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119762
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119763
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119764
|
+
}
|
|
119681
119765
|
/**
|
|
119682
119766
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119683
119767
|
*/
|
|
@@ -119697,9 +119781,7 @@ var ts;
|
|
|
119697
119781
|
}
|
|
119698
119782
|
}
|
|
119699
119783
|
}
|
|
119700
|
-
state
|
|
119701
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119702
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119784
|
+
clearAffectedFilesPendingEmit(state);
|
|
119703
119785
|
}
|
|
119704
119786
|
return undefined;
|
|
119705
119787
|
}
|
|
@@ -119707,7 +119789,7 @@ var ts;
|
|
|
119707
119789
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119708
119790
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119709
119791
|
*/
|
|
119710
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119792
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119711
119793
|
var _a;
|
|
119712
119794
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119713
119795
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119732,14 +119814,14 @@ var ts;
|
|
|
119732
119814
|
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);
|
|
119733
119815
|
}
|
|
119734
119816
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119735
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119817
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119736
119818
|
}
|
|
119737
119819
|
}
|
|
119738
119820
|
/**
|
|
119739
119821
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119740
119822
|
* Also we need to make sure signature is updated for these files
|
|
119741
119823
|
*/
|
|
119742
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
119824
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119743
119825
|
removeSemanticDiagnosticsOf(state, path);
|
|
119744
119826
|
if (!state.changedFilesSet.has(path)) {
|
|
119745
119827
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119750,8 +119832,7 @@ var ts;
|
|
|
119750
119832
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119751
119833
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119752
119834
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119753
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119754
|
-
/* useFileVersionAsSignature */ true);
|
|
119835
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119755
119836
|
// If not dts emit, nothing more to do
|
|
119756
119837
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119757
119838
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -119948,13 +120029,18 @@ var ts;
|
|
|
119948
120029
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
119949
120030
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
119950
120031
|
return value.version === actualSignature ?
|
|
119951
|
-
value.affectsGlobalScope ?
|
|
119952
|
-
|
|
120032
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120033
|
+
// If file version is same as signature, dont serialize signature
|
|
120034
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120035
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
119953
120036
|
value.version :
|
|
119954
|
-
actualSignature !== undefined ?
|
|
120037
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
119955
120038
|
signature === undefined ?
|
|
120039
|
+
// If we havent computed signature, use fileInfo as is
|
|
119956
120040
|
value :
|
|
120041
|
+
// Serialize fileInfo with new updated signature
|
|
119957
120042
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120043
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
119958
120044
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
119959
120045
|
});
|
|
119960
120046
|
var referencedMap;
|
|
@@ -120199,7 +120285,7 @@ var ts;
|
|
|
120199
120285
|
* in that order would be used to write the files
|
|
120200
120286
|
*/
|
|
120201
120287
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120202
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120288
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120203
120289
|
var emitKind = 1 /* Full */;
|
|
120204
120290
|
var isPendingEmitFile = false;
|
|
120205
120291
|
if (!affected) {
|
|
@@ -120244,54 +120330,48 @@ var ts;
|
|
|
120244
120330
|
* in that order would be used to write the files
|
|
120245
120331
|
*/
|
|
120246
120332
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120247
|
-
var
|
|
120248
|
-
var savedAffectedFilesPendingEmit;
|
|
120249
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120250
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120251
|
-
// 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
|
|
120252
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120253
|
-
// 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)
|
|
120254
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120255
|
-
!targetSourceFile &&
|
|
120256
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120257
|
-
!state.compilerOptions.noEmit &&
|
|
120258
|
-
state.compilerOptions.noEmitOnError) {
|
|
120259
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120260
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120261
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120262
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120263
|
-
}
|
|
120333
|
+
var _a;
|
|
120264
120334
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120265
120335
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120266
120336
|
}
|
|
120267
120337
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120268
120338
|
if (result)
|
|
120269
120339
|
return result;
|
|
120270
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120271
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120272
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120273
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120274
|
-
}
|
|
120275
120340
|
// Emit only affected files if using builder for emit
|
|
120276
|
-
if (!targetSourceFile
|
|
120277
|
-
|
|
120278
|
-
|
|
120279
|
-
|
|
120280
|
-
|
|
120281
|
-
|
|
120282
|
-
|
|
120283
|
-
|
|
120284
|
-
|
|
120285
|
-
|
|
120286
|
-
|
|
120287
|
-
|
|
120341
|
+
if (!targetSourceFile) {
|
|
120342
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120343
|
+
// Emit and report any errors we ran into.
|
|
120344
|
+
var sourceMaps = [];
|
|
120345
|
+
var emitSkipped = false;
|
|
120346
|
+
var diagnostics = void 0;
|
|
120347
|
+
var emittedFiles = [];
|
|
120348
|
+
var affectedEmitResult = void 0;
|
|
120349
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120350
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120351
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120352
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120353
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120354
|
+
}
|
|
120355
|
+
return {
|
|
120356
|
+
emitSkipped: emitSkipped,
|
|
120357
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120358
|
+
emittedFiles: emittedFiles,
|
|
120359
|
+
sourceMaps: sourceMaps
|
|
120360
|
+
};
|
|
120361
|
+
}
|
|
120362
|
+
// In non Emit builder, clear affected files pending emit
|
|
120363
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120364
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120365
|
+
// State can clear affected files pending emit if
|
|
120366
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120367
|
+
// If every file pending emit is pending on only dts emit
|
|
120368
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120369
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120370
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120371
|
+
})) {
|
|
120372
|
+
clearAffectedFilesPendingEmit(state);
|
|
120373
|
+
}
|
|
120288
120374
|
}
|
|
120289
|
-
return {
|
|
120290
|
-
emitSkipped: emitSkipped,
|
|
120291
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120292
|
-
emittedFiles: emittedFiles,
|
|
120293
|
-
sourceMaps: sourceMaps
|
|
120294
|
-
};
|
|
120295
120375
|
}
|
|
120296
120376
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120297
120377
|
}
|
|
@@ -120301,7 +120381,7 @@ var ts;
|
|
|
120301
120381
|
*/
|
|
120302
120382
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120303
120383
|
while (true) {
|
|
120304
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120384
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120305
120385
|
if (!affected) {
|
|
120306
120386
|
// Done
|
|
120307
120387
|
return undefined;
|
|
@@ -123421,9 +123501,6 @@ var ts;
|
|
|
123421
123501
|
function newer(date1, date2) {
|
|
123422
123502
|
return date2 > date1 ? date2 : date1;
|
|
123423
123503
|
}
|
|
123424
|
-
function isDeclarationFile(fileName) {
|
|
123425
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123426
|
-
}
|
|
123427
123504
|
/*@internal*/
|
|
123428
123505
|
function isCircularBuildOrder(buildOrder) {
|
|
123429
123506
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -123986,7 +124063,7 @@ var ts;
|
|
|
123986
124063
|
outputFiles.forEach(function (_a) {
|
|
123987
124064
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
123988
124065
|
var priorChangeTime;
|
|
123989
|
-
if (!anyDtsChanged &&
|
|
124066
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
123990
124067
|
// Check for unchanged .d.ts files
|
|
123991
124068
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
123992
124069
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124327,7 +124404,7 @@ var ts;
|
|
|
124327
124404
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124328
124405
|
// had its file touched but not had its contents changed - this allows us
|
|
124329
124406
|
// to skip a downstream typecheck
|
|
124330
|
-
if (
|
|
124407
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124331
124408
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124332
124409
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124333
124410
|
}
|
|
@@ -124481,7 +124558,7 @@ var ts;
|
|
|
124481
124558
|
reportVerbose = false;
|
|
124482
124559
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124483
124560
|
}
|
|
124484
|
-
if (
|
|
124561
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124485
124562
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124486
124563
|
}
|
|
124487
124564
|
host.setModifiedTime(file, now);
|
|
@@ -131376,17 +131453,13 @@ var ts;
|
|
|
131376
131453
|
}
|
|
131377
131454
|
}
|
|
131378
131455
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131379
|
-
|
|
131380
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
131456
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
|
|
131381
131457
|
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131382
131458
|
name = name + labelDetails.detail;
|
|
131383
131459
|
labelDetails = undefined;
|
|
131384
131460
|
}
|
|
131385
131461
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131386
131462
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131387
|
-
if (importAdder.hasFixes()) {
|
|
131388
|
-
hasAction = true;
|
|
131389
|
-
}
|
|
131390
131463
|
}
|
|
131391
131464
|
if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
131392
131465
|
var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
|
|
@@ -131609,8 +131682,7 @@ var ts;
|
|
|
131609
131682
|
var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
|
|
131610
131683
|
var insertText = name;
|
|
131611
131684
|
var sourceFile = enclosingDeclaration.getSourceFile();
|
|
131612
|
-
var
|
|
131613
|
-
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
|
|
131685
|
+
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
|
|
131614
131686
|
if (!method) {
|
|
131615
131687
|
return undefined;
|
|
131616
131688
|
}
|
|
@@ -131639,16 +131711,15 @@ var ts;
|
|
|
131639
131711
|
/*modifiers*/ undefined,
|
|
131640
131712
|
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
131641
131713
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
131642
|
-
return { isSnippet: isSnippet, insertText: insertText,
|
|
131714
|
+
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
131643
131715
|
}
|
|
131644
131716
|
;
|
|
131645
|
-
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences
|
|
131717
|
+
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
131646
131718
|
var declarations = symbol.getDeclarations();
|
|
131647
131719
|
if (!(declarations && declarations.length)) {
|
|
131648
131720
|
return undefined;
|
|
131649
131721
|
}
|
|
131650
131722
|
var checker = program.getTypeChecker();
|
|
131651
|
-
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
131652
131723
|
var declaration = declarations[0];
|
|
131653
131724
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
131654
131725
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
@@ -131681,11 +131752,6 @@ var ts;
|
|
|
131681
131752
|
if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
|
|
131682
131753
|
return undefined;
|
|
131683
131754
|
}
|
|
131684
|
-
var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
131685
|
-
if (importableReference) {
|
|
131686
|
-
typeNode = importableReference.typeNode;
|
|
131687
|
-
ts.codefix.importSymbols(importAdder, importableReference.symbols);
|
|
131688
|
-
}
|
|
131689
131755
|
var body = void 0;
|
|
131690
131756
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
131691
131757
|
var emptyStmt = ts.factory.createEmptyStatement();
|
|
@@ -131695,11 +131761,19 @@ var ts;
|
|
|
131695
131761
|
else {
|
|
131696
131762
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
131697
131763
|
}
|
|
131764
|
+
var parameters = typeNode.parameters.map(function (typedParam) {
|
|
131765
|
+
return ts.factory.createParameterDeclaration(
|
|
131766
|
+
/*decorators*/ undefined,
|
|
131767
|
+
/*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken,
|
|
131768
|
+
/*type*/ undefined, typedParam.initializer);
|
|
131769
|
+
});
|
|
131698
131770
|
return ts.factory.createMethodDeclaration(
|
|
131699
131771
|
/*decorators*/ undefined,
|
|
131700
131772
|
/*modifiers*/ undefined,
|
|
131701
131773
|
/*asteriskToken*/ undefined, name,
|
|
131702
|
-
/*questionToken*/ undefined,
|
|
131774
|
+
/*questionToken*/ undefined,
|
|
131775
|
+
/*typeParameters*/ undefined, parameters,
|
|
131776
|
+
/*type*/ undefined, body);
|
|
131703
131777
|
}
|
|
131704
131778
|
default:
|
|
131705
131779
|
return undefined;
|
|
@@ -132062,20 +132136,6 @@ var ts;
|
|
|
132062
132136
|
};
|
|
132063
132137
|
}
|
|
132064
132138
|
}
|
|
132065
|
-
if (source === CompletionSource.ObjectLiteralMethodSnippet) {
|
|
132066
|
-
var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
|
|
132067
|
-
var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
|
|
132068
|
-
if (importAdder.hasFixes()) {
|
|
132069
|
-
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
132070
|
-
return {
|
|
132071
|
-
sourceDisplay: undefined,
|
|
132072
|
-
codeActions: [{
|
|
132073
|
-
changes: changes,
|
|
132074
|
-
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
132075
|
-
}],
|
|
132076
|
-
};
|
|
132077
|
-
}
|
|
132078
|
-
}
|
|
132079
132139
|
if (originIsTypeOnlyAlias(origin)) {
|
|
132080
132140
|
var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
|
|
132081
132141
|
ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
|
|
@@ -134896,7 +134956,7 @@ var ts;
|
|
|
134896
134956
|
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
134897
134957
|
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
134898
134958
|
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
134899
|
-
var otherBucketKey = !ts.
|
|
134959
|
+
var otherBucketKey = !ts.isDeclarationFileName(path) &&
|
|
134900
134960
|
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
|
|
134901
134961
|
if (otherBucketKey) {
|
|
134902
134962
|
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
|
|
@@ -136836,6 +136896,30 @@ var ts;
|
|
|
136836
136896
|
}
|
|
136837
136897
|
}
|
|
136838
136898
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
136899
|
+
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
136900
|
+
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
136901
|
+
return candidates.reduce(function (topMost, decl) {
|
|
136902
|
+
var depth = getDepth(decl);
|
|
136903
|
+
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
136904
|
+
topMost.declarationNames.push(decl);
|
|
136905
|
+
topMost.depth = depth;
|
|
136906
|
+
}
|
|
136907
|
+
else if (depth < topMost.depth) {
|
|
136908
|
+
topMost.declarationNames = [decl];
|
|
136909
|
+
topMost.depth = depth;
|
|
136910
|
+
}
|
|
136911
|
+
return topMost;
|
|
136912
|
+
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
136913
|
+
function getDepth(declaration) {
|
|
136914
|
+
var depth = 0;
|
|
136915
|
+
while (declaration) {
|
|
136916
|
+
declaration = ts.getContainerNode(declaration);
|
|
136917
|
+
depth++;
|
|
136918
|
+
}
|
|
136919
|
+
return depth;
|
|
136920
|
+
}
|
|
136921
|
+
}
|
|
136922
|
+
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
136839
136923
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
136840
136924
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
136841
136925
|
return false;
|
|
@@ -138472,7 +138556,9 @@ var ts;
|
|
|
138472
138556
|
(function (ts) {
|
|
138473
138557
|
var GoToDefinition;
|
|
138474
138558
|
(function (GoToDefinition) {
|
|
138475
|
-
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
138559
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
138560
|
+
var _a;
|
|
138561
|
+
var _b;
|
|
138476
138562
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
138477
138563
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
138478
138564
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -138495,33 +138581,63 @@ var ts;
|
|
|
138495
138581
|
}
|
|
138496
138582
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138497
138583
|
var classDecl = node.parent.parent;
|
|
138498
|
-
var
|
|
138584
|
+
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138499
138585
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138500
138586
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138501
138587
|
var sourceFile_1 = node.getSourceFile();
|
|
138502
138588
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
138503
138589
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
138504
138590
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
138505
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
138591
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
138506
138592
|
});
|
|
138507
138593
|
}
|
|
138508
|
-
var
|
|
138594
|
+
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138595
|
+
var fallbackNode = node;
|
|
138596
|
+
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
138597
|
+
// We couldn't resolve the specific import, try on the module specifier.
|
|
138598
|
+
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); });
|
|
138599
|
+
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138600
|
+
if (moduleSpecifier) {
|
|
138601
|
+
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138602
|
+
fallbackNode = moduleSpecifier;
|
|
138603
|
+
}
|
|
138604
|
+
}
|
|
138605
|
+
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
138606
|
+
// We couldn't resolve the module specifier as an external module, but it could
|
|
138607
|
+
// be that module resolution succeeded but the target was not a module.
|
|
138608
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
138609
|
+
if (ref) {
|
|
138610
|
+
return [{
|
|
138611
|
+
name: fallbackNode.text,
|
|
138612
|
+
fileName: ref.resolvedFileName,
|
|
138613
|
+
containerName: undefined,
|
|
138614
|
+
containerKind: undefined,
|
|
138615
|
+
kind: "script" /* scriptElement */,
|
|
138616
|
+
textSpan: ts.createTextSpan(0, 0),
|
|
138617
|
+
failedAliasResolution: failedAliasResolution,
|
|
138618
|
+
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
138619
|
+
unverified: fallbackNode !== node,
|
|
138620
|
+
}];
|
|
138621
|
+
}
|
|
138622
|
+
}
|
|
138509
138623
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
138510
138624
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
138511
138625
|
if (!symbol) {
|
|
138512
138626
|
return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
|
138513
138627
|
}
|
|
138628
|
+
if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
|
|
138629
|
+
return undefined;
|
|
138514
138630
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
138515
138631
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
138516
138632
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
138517
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
138633
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
138518
138634
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
138519
138635
|
// If this is the original constructor definition, parent is the class.
|
|
138520
138636
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
138521
138637
|
return [sigInfo];
|
|
138522
138638
|
}
|
|
138523
138639
|
else {
|
|
138524
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
138640
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
|
|
138525
138641
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
138526
138642
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
138527
138643
|
}
|
|
@@ -138533,7 +138649,7 @@ var ts;
|
|
|
138533
138649
|
// assignment. This case and others are handled by the following code.
|
|
138534
138650
|
if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
|
|
138535
138651
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
138536
|
-
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;
|
|
138652
|
+
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;
|
|
138537
138653
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
138538
138654
|
}
|
|
138539
138655
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -138556,7 +138672,7 @@ var ts;
|
|
|
138556
138672
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
138557
138673
|
});
|
|
138558
138674
|
}
|
|
138559
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
138675
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
|
|
138560
138676
|
}
|
|
138561
138677
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
138562
138678
|
/**
|
|
@@ -138654,24 +138770,24 @@ var ts;
|
|
|
138654
138770
|
return undefined;
|
|
138655
138771
|
}
|
|
138656
138772
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138657
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
138773
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
138658
138774
|
}
|
|
138659
|
-
var
|
|
138775
|
+
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138660
138776
|
if (!symbol)
|
|
138661
138777
|
return undefined;
|
|
138662
138778
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
138663
138779
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
138664
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
138780
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
138665
138781
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
138666
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
138782
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
138667
138783
|
return typeDefinitions.length ? typeDefinitions
|
|
138668
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
138784
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node, failedAliasResolution)
|
|
138669
138785
|
: undefined;
|
|
138670
138786
|
}
|
|
138671
138787
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
138672
|
-
function definitionFromType(type, checker, node) {
|
|
138788
|
+
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
138673
138789
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
138674
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
138790
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
|
|
138675
138791
|
});
|
|
138676
138792
|
}
|
|
138677
138793
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -138713,13 +138829,17 @@ var ts;
|
|
|
138713
138829
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
138714
138830
|
// import {A, B} from "mod";
|
|
138715
138831
|
// to jump to the implementation directly.
|
|
138832
|
+
var failedAliasResolution = false;
|
|
138716
138833
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
138717
138834
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
138718
138835
|
if (aliased.declarations) {
|
|
138719
|
-
return aliased;
|
|
138836
|
+
return { symbol: aliased };
|
|
138837
|
+
}
|
|
138838
|
+
else {
|
|
138839
|
+
failedAliasResolution = true;
|
|
138720
138840
|
}
|
|
138721
138841
|
}
|
|
138722
|
-
return symbol;
|
|
138842
|
+
return { symbol: symbol, failedAliasResolution: failedAliasResolution };
|
|
138723
138843
|
}
|
|
138724
138844
|
// Go to the original declaration for cases:
|
|
138725
138845
|
//
|
|
@@ -138733,26 +138853,45 @@ var ts;
|
|
|
138733
138853
|
if (node.parent === declaration) {
|
|
138734
138854
|
return true;
|
|
138735
138855
|
}
|
|
138736
|
-
|
|
138737
|
-
|
|
138738
|
-
case 265 /* ImportEqualsDeclaration */:
|
|
138739
|
-
return true;
|
|
138740
|
-
case 270 /* ImportSpecifier */:
|
|
138741
|
-
return declaration.parent.kind === 269 /* NamedImports */;
|
|
138742
|
-
case 203 /* BindingElement */:
|
|
138743
|
-
case 254 /* VariableDeclaration */:
|
|
138744
|
-
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
138745
|
-
default:
|
|
138746
|
-
return false;
|
|
138856
|
+
if (declaration.kind === 268 /* NamespaceImport */) {
|
|
138857
|
+
return false;
|
|
138747
138858
|
}
|
|
138859
|
+
return true;
|
|
138860
|
+
}
|
|
138861
|
+
/**
|
|
138862
|
+
* ```ts
|
|
138863
|
+
* function f() {}
|
|
138864
|
+
* f.foo = 0;
|
|
138865
|
+
* ```
|
|
138866
|
+
*
|
|
138867
|
+
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
138868
|
+
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
138869
|
+
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
138870
|
+
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
138871
|
+
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
138872
|
+
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
138873
|
+
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
138874
|
+
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
138875
|
+
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
138876
|
+
* up with a more precise definition of what counts as a definition.
|
|
138877
|
+
*/
|
|
138878
|
+
function isExpandoDeclaration(node) {
|
|
138879
|
+
if (!ts.isAssignmentDeclaration(node))
|
|
138880
|
+
return false;
|
|
138881
|
+
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
138882
|
+
if (ts.isAssignmentExpression(p))
|
|
138883
|
+
return true;
|
|
138884
|
+
if (!ts.isAssignmentDeclaration(p))
|
|
138885
|
+
return "quit";
|
|
138886
|
+
return false;
|
|
138887
|
+
});
|
|
138888
|
+
return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
|
|
138748
138889
|
}
|
|
138749
|
-
function getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
138750
|
-
|
|
138751
|
-
|
|
138752
|
-
|
|
138753
|
-
|
|
138754
|
-
|| undefined;
|
|
138755
|
-
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
|
|
138890
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
|
|
138891
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; });
|
|
138892
|
+
var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); });
|
|
138893
|
+
var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
|
|
138894
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); });
|
|
138756
138895
|
function getConstructSignatureDefinition() {
|
|
138757
138896
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
138758
138897
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -138776,26 +138915,27 @@ var ts;
|
|
|
138776
138915
|
return declarations.length
|
|
138777
138916
|
? declarationsWithBody.length !== 0
|
|
138778
138917
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
138779
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
138918
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
|
|
138780
138919
|
: undefined;
|
|
138781
138920
|
}
|
|
138782
138921
|
}
|
|
138783
138922
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
138784
|
-
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
138923
|
+
function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
|
|
138785
138924
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
138786
138925
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
138787
138926
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
138788
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
138927
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
|
|
138789
138928
|
}
|
|
138929
|
+
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
138790
138930
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
138791
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
138931
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
|
|
138792
138932
|
var sourceFile = declaration.getSourceFile();
|
|
138793
138933
|
if (!textSpan) {
|
|
138794
138934
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
138795
138935
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
138796
138936
|
}
|
|
138797
138937
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
138798
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
138938
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216 /* Ambient */), unverified: unverified, failedAliasResolution: failedAliasResolution });
|
|
138799
138939
|
}
|
|
138800
138940
|
function isDefinitionVisible(checker, declaration) {
|
|
138801
138941
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -138828,8 +138968,8 @@ var ts;
|
|
|
138828
138968
|
return false;
|
|
138829
138969
|
}
|
|
138830
138970
|
}
|
|
138831
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
138832
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
138971
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
|
|
138972
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
|
|
138833
138973
|
}
|
|
138834
138974
|
function findReferenceInPosition(refs, pos) {
|
|
138835
138975
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -151944,9 +152084,10 @@ var ts;
|
|
|
151944
152084
|
// 2. add "member3" to the second import statement's import list
|
|
151945
152085
|
// and it is up to the user to decide which one fits best.
|
|
151946
152086
|
return ts.firstDefined(existingImports, function (_a) {
|
|
152087
|
+
var _b;
|
|
151947
152088
|
var declaration = _a.declaration;
|
|
151948
152089
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
151949
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152090
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
151950
152091
|
if (namespacePrefix && moduleSpecifier) {
|
|
151951
152092
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
151952
152093
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -152122,8 +152263,9 @@ var ts;
|
|
|
152122
152263
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
152123
152264
|
}
|
|
152124
152265
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152266
|
+
var _b;
|
|
152125
152267
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
152126
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152268
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152127
152269
|
if (moduleSpecifier) {
|
|
152128
152270
|
var addAsTypeOnly = useRequire
|
|
152129
152271
|
? 4 /* NotAllowed */
|
|
@@ -156481,7 +156623,6 @@ var ts;
|
|
|
156481
156623
|
var checker = program.getTypeChecker();
|
|
156482
156624
|
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
156483
156625
|
var flags = 1 /* NoTruncation */
|
|
156484
|
-
| 1073741824 /* NoUndefinedOptionalParameterType */
|
|
156485
156626
|
| 256 /* SuppressAnyReturnType */
|
|
156486
156627
|
| 524288 /* AllowEmptyTuple */
|
|
156487
156628
|
| (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
@@ -158860,6 +159001,7 @@ var ts;
|
|
|
158860
159001
|
Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes");
|
|
158861
159002
|
Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS");
|
|
158862
159003
|
Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block");
|
|
159004
|
+
Messages.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method");
|
|
158863
159005
|
})(Messages = extractSymbol.Messages || (extractSymbol.Messages = {}));
|
|
158864
159006
|
var RangeFacts;
|
|
158865
159007
|
(function (RangeFacts) {
|
|
@@ -158868,10 +159010,11 @@ var ts;
|
|
|
158868
159010
|
RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator";
|
|
158869
159011
|
RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction";
|
|
158870
159012
|
RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis";
|
|
159013
|
+
RangeFacts[RangeFacts["UsesThisInFunction"] = 16] = "UsesThisInFunction";
|
|
158871
159014
|
/**
|
|
158872
159015
|
* The range is in a function which needs the 'static' modifier in a class
|
|
158873
159016
|
*/
|
|
158874
|
-
RangeFacts[RangeFacts["InStaticRegion"] =
|
|
159017
|
+
RangeFacts[RangeFacts["InStaticRegion"] = 32] = "InStaticRegion";
|
|
158875
159018
|
})(RangeFacts || (RangeFacts = {}));
|
|
158876
159019
|
/**
|
|
158877
159020
|
* getRangeToExtract takes a span inside a text file and returns either an expression or an array
|
|
@@ -158902,6 +159045,7 @@ var ts;
|
|
|
158902
159045
|
// We'll modify these flags as we walk the tree to collect data
|
|
158903
159046
|
// about what things need to be done as part of the extraction.
|
|
158904
159047
|
var rangeFacts = RangeFacts.None;
|
|
159048
|
+
var thisNode;
|
|
158905
159049
|
if (!start || !end) {
|
|
158906
159050
|
// cannot find either start or end node
|
|
158907
159051
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
@@ -158940,7 +159084,7 @@ var ts;
|
|
|
158940
159084
|
// the expression.
|
|
158941
159085
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
158942
159086
|
}
|
|
158943
|
-
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } };
|
|
159087
|
+
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
|
|
158944
159088
|
}
|
|
158945
159089
|
if (ts.isReturnStatement(start) && !start.expression) {
|
|
158946
159090
|
// Makes no sense to extract an expression-less return statement.
|
|
@@ -158952,7 +159096,7 @@ var ts;
|
|
|
158952
159096
|
if (errors) {
|
|
158953
159097
|
return { errors: errors };
|
|
158954
159098
|
}
|
|
158955
|
-
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } }; // TODO: GH#18217
|
|
159099
|
+
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
|
|
158956
159100
|
/**
|
|
158957
159101
|
* Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
|
|
158958
159102
|
* @param node The unrefined extraction node.
|
|
@@ -159044,6 +159188,14 @@ var ts;
|
|
|
159044
159188
|
var permittedJumps = 4 /* Return */;
|
|
159045
159189
|
var seenLabels;
|
|
159046
159190
|
visit(nodeToCheck);
|
|
159191
|
+
if (rangeFacts & RangeFacts.UsesThis) {
|
|
159192
|
+
var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false);
|
|
159193
|
+
if (container.kind === 256 /* FunctionDeclaration */ ||
|
|
159194
|
+
(container.kind === 169 /* MethodDeclaration */ && container.parent.kind === 205 /* ObjectLiteralExpression */) ||
|
|
159195
|
+
container.kind === 213 /* FunctionExpression */) {
|
|
159196
|
+
rangeFacts |= RangeFacts.UsesThisInFunction;
|
|
159197
|
+
}
|
|
159198
|
+
}
|
|
159047
159199
|
return errors;
|
|
159048
159200
|
function visit(node) {
|
|
159049
159201
|
if (errors) {
|
|
@@ -159082,6 +159234,7 @@ var ts;
|
|
|
159082
159234
|
}
|
|
159083
159235
|
else {
|
|
159084
159236
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159237
|
+
thisNode = node;
|
|
159085
159238
|
}
|
|
159086
159239
|
break;
|
|
159087
159240
|
case 214 /* ArrowFunction */:
|
|
@@ -159089,6 +159242,7 @@ var ts;
|
|
|
159089
159242
|
ts.forEachChild(node, function check(n) {
|
|
159090
159243
|
if (ts.isThis(n)) {
|
|
159091
159244
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159245
|
+
thisNode = node;
|
|
159092
159246
|
}
|
|
159093
159247
|
else if (ts.isClassLike(n) || (ts.isFunctionLike(n) && !ts.isArrowFunction(n))) {
|
|
159094
159248
|
return false;
|
|
@@ -159145,6 +159299,7 @@ var ts;
|
|
|
159145
159299
|
case 192 /* ThisType */:
|
|
159146
159300
|
case 108 /* ThisKeyword */:
|
|
159147
159301
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159302
|
+
thisNode = node;
|
|
159148
159303
|
break;
|
|
159149
159304
|
case 250 /* LabeledStatement */: {
|
|
159150
159305
|
var label = node.label;
|
|
@@ -159232,7 +159387,7 @@ var ts;
|
|
|
159232
159387
|
*/
|
|
159233
159388
|
function collectEnclosingScopes(range) {
|
|
159234
159389
|
var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range;
|
|
159235
|
-
if (range.facts & RangeFacts.UsesThis) {
|
|
159390
|
+
if (range.facts & RangeFacts.UsesThis && !(range.facts & RangeFacts.UsesThisInFunction)) {
|
|
159236
159391
|
// 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
|
|
159237
159392
|
var containingClass = ts.getContainingClass(current);
|
|
159238
159393
|
if (containingClass) {
|
|
@@ -159438,6 +159593,7 @@ var ts;
|
|
|
159438
159593
|
var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty;
|
|
159439
159594
|
ts.suppressLeadingAndTrailingTrivia(body);
|
|
159440
159595
|
var newFunction;
|
|
159596
|
+
var callThis = !!(range.facts & RangeFacts.UsesThisInFunction);
|
|
159441
159597
|
if (ts.isClassLike(scope)) {
|
|
159442
159598
|
// always create private method in TypeScript files
|
|
159443
159599
|
var modifiers = isJS ? [] : [ts.factory.createModifier(121 /* PrivateKeyword */)];
|
|
@@ -159452,6 +159608,15 @@ var ts;
|
|
|
159452
159608
|
/*questionToken*/ undefined, typeParameters, parameters, returnType, body);
|
|
159453
159609
|
}
|
|
159454
159610
|
else {
|
|
159611
|
+
if (callThis) {
|
|
159612
|
+
parameters.unshift(ts.factory.createParameterDeclaration(
|
|
159613
|
+
/*decorators*/ undefined,
|
|
159614
|
+
/*modifiers*/ undefined,
|
|
159615
|
+
/*dotDotDotToken*/ undefined,
|
|
159616
|
+
/*name*/ "this",
|
|
159617
|
+
/*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NoTruncation */),
|
|
159618
|
+
/*initializer*/ undefined));
|
|
159619
|
+
}
|
|
159455
159620
|
newFunction = ts.factory.createFunctionDeclaration(
|
|
159456
159621
|
/*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);
|
|
159457
159622
|
}
|
|
@@ -159468,7 +159633,10 @@ var ts;
|
|
|
159468
159633
|
var newNodes = [];
|
|
159469
159634
|
// replace range with function call
|
|
159470
159635
|
var called = getCalledExpression(scope, range, functionNameText);
|
|
159471
|
-
|
|
159636
|
+
if (callThis) {
|
|
159637
|
+
callArguments.unshift(ts.factory.createIdentifier("this"));
|
|
159638
|
+
}
|
|
159639
|
+
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
|
|
159472
159640
|
callArguments);
|
|
159473
159641
|
if (range.facts & RangeFacts.IsGenerator) {
|
|
159474
159642
|
call = ts.factory.createYieldExpression(ts.factory.createToken(41 /* AsteriskToken */), call);
|
|
@@ -160079,6 +160247,9 @@ var ts;
|
|
|
160079
160247
|
var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
|
|
160080
160248
|
constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
|
|
160081
160249
|
}
|
|
160250
|
+
if (targetRange.facts & RangeFacts.UsesThisInFunction && ts.isClassLike(scopes[i])) {
|
|
160251
|
+
functionErrorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
|
|
160252
|
+
}
|
|
160082
160253
|
var hasWrite = false;
|
|
160083
160254
|
var readonlyClassPropertyWrite;
|
|
160084
160255
|
usagesPerScope[i].usages.forEach(function (value) {
|
|
@@ -164032,9 +164203,9 @@ var ts;
|
|
|
164032
164203
|
}
|
|
164033
164204
|
}
|
|
164034
164205
|
/// Goto definition
|
|
164035
|
-
function getDefinitionAtPosition(fileName, position) {
|
|
164206
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164036
164207
|
synchronizeHostData();
|
|
164037
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
164208
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164038
164209
|
}
|
|
164039
164210
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164040
164211
|
synchronizeHostData();
|
|
@@ -166992,6 +167163,11 @@ var ts;
|
|
|
166992
167163
|
return "/dev/null/autoImportProviderProject" + counter + "*";
|
|
166993
167164
|
}
|
|
166994
167165
|
server.makeAutoImportProviderProjectName = makeAutoImportProviderProjectName;
|
|
167166
|
+
/*@internal*/
|
|
167167
|
+
function makeAuxiliaryProjectName(counter) {
|
|
167168
|
+
return "/dev/null/auxiliaryProject" + counter + "*";
|
|
167169
|
+
}
|
|
167170
|
+
server.makeAuxiliaryProjectName = makeAuxiliaryProjectName;
|
|
166995
167171
|
function createSortedArray() {
|
|
166996
167172
|
return []; // TODO: GH#19873
|
|
166997
167173
|
}
|
|
@@ -167205,6 +167381,7 @@ var ts;
|
|
|
167205
167381
|
CommandTypes["SignatureHelp"] = "signatureHelp";
|
|
167206
167382
|
/* @internal */
|
|
167207
167383
|
CommandTypes["SignatureHelpFull"] = "signatureHelp-full";
|
|
167384
|
+
CommandTypes["FindSourceDefinition"] = "findSourceDefinition";
|
|
167208
167385
|
CommandTypes["Status"] = "status";
|
|
167209
167386
|
CommandTypes["TypeDefinition"] = "typeDefinition";
|
|
167210
167387
|
CommandTypes["ProjectInfo"] = "projectInfo";
|
|
@@ -167784,7 +167961,7 @@ var ts;
|
|
|
167784
167961
|
case 0:
|
|
167785
167962
|
return server.Errors.ThrowNoProject();
|
|
167786
167963
|
case 1:
|
|
167787
|
-
return
|
|
167964
|
+
return ensurePrimaryProjectKind(this.containingProjects[0]);
|
|
167788
167965
|
default:
|
|
167789
167966
|
// If this file belongs to multiple projects, below is the order in which default project is used
|
|
167790
167967
|
// - for open script info, its default configured project during opening is default if info is part of it
|
|
@@ -167822,7 +167999,7 @@ var ts;
|
|
|
167822
167999
|
firstInferredProject = project;
|
|
167823
168000
|
}
|
|
167824
168001
|
}
|
|
167825
|
-
return
|
|
168002
|
+
return ensurePrimaryProjectKind(defaultConfiguredProject ||
|
|
167826
168003
|
firstNonSourceOfProjectReferenceRedirect ||
|
|
167827
168004
|
firstConfiguredProject ||
|
|
167828
168005
|
firstExternalProject ||
|
|
@@ -167898,8 +168075,8 @@ var ts;
|
|
|
167898
168075
|
return !ts.forEach(this.containingProjects, function (p) { return !p.isOrphan(); });
|
|
167899
168076
|
};
|
|
167900
168077
|
/*@internal*/
|
|
167901
|
-
ScriptInfo.prototype.
|
|
167902
|
-
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider; });
|
|
168078
|
+
ScriptInfo.prototype.isContainedByBackgroundProject = function () {
|
|
168079
|
+
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider || p.projectKind === server.ProjectKind.Auxiliary; });
|
|
167903
168080
|
};
|
|
167904
168081
|
/**
|
|
167905
168082
|
* @param line 1 based index
|
|
@@ -167933,8 +168110,13 @@ var ts;
|
|
|
167933
168110
|
return ScriptInfo;
|
|
167934
168111
|
}());
|
|
167935
168112
|
server.ScriptInfo = ScriptInfo;
|
|
167936
|
-
|
|
167937
|
-
|
|
168113
|
+
/**
|
|
168114
|
+
* Throws an error if `project` is an AutoImportProvider or AuxiliaryProject,
|
|
168115
|
+
* which are used in the background by other Projects and should never be
|
|
168116
|
+
* reported as the default project for a ScriptInfo.
|
|
168117
|
+
*/
|
|
168118
|
+
function ensurePrimaryProjectKind(project) {
|
|
168119
|
+
if (!project || project.projectKind === server.ProjectKind.AutoImportProvider || project.projectKind === server.ProjectKind.Auxiliary) {
|
|
167938
168120
|
return server.Errors.ThrowNoProject();
|
|
167939
168121
|
}
|
|
167940
168122
|
return project;
|
|
@@ -168074,6 +168256,7 @@ var ts;
|
|
|
168074
168256
|
ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
|
|
168075
168257
|
ProjectKind[ProjectKind["External"] = 2] = "External";
|
|
168076
168258
|
ProjectKind[ProjectKind["AutoImportProvider"] = 3] = "AutoImportProvider";
|
|
168259
|
+
ProjectKind[ProjectKind["Auxiliary"] = 4] = "Auxiliary";
|
|
168077
168260
|
})(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));
|
|
168078
168261
|
/* @internal */
|
|
168079
168262
|
function countEachFileTypes(infos, includeSizes) {
|
|
@@ -168099,7 +168282,7 @@ var ts;
|
|
|
168099
168282
|
result.jsxSize += fileSize;
|
|
168100
168283
|
break;
|
|
168101
168284
|
case 3 /* TS */:
|
|
168102
|
-
if (ts.
|
|
168285
|
+
if (ts.isDeclarationFileName(info.fileName)) {
|
|
168103
168286
|
result.dts += 1;
|
|
168104
168287
|
result.dtsSize += fileSize;
|
|
168105
168288
|
}
|
|
@@ -168137,7 +168320,7 @@ var ts;
|
|
|
168137
168320
|
server.allFilesAreJsOrDts = allFilesAreJsOrDts;
|
|
168138
168321
|
/* @internal */
|
|
168139
168322
|
function hasNoTypeScriptSource(fileNames) {
|
|
168140
|
-
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.
|
|
168323
|
+
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.isDeclarationFileName(fileName)) || ts.fileExtensionIs(fileName, ".tsx" /* Tsx */); });
|
|
168141
168324
|
}
|
|
168142
168325
|
server.hasNoTypeScriptSource = hasNoTypeScriptSource;
|
|
168143
168326
|
function isGeneratedFileWatcher(watch) {
|
|
@@ -168541,7 +168724,7 @@ var ts;
|
|
|
168541
168724
|
}
|
|
168542
168725
|
// Update the signature
|
|
168543
168726
|
if (this.builderState && ts.getEmitDeclarations(this.compilerOptions)) {
|
|
168544
|
-
var dtsFiles = outputFiles.filter(function (f) { return ts.
|
|
168727
|
+
var dtsFiles = outputFiles.filter(function (f) { return ts.isDeclarationFileName(f.name); });
|
|
168545
168728
|
if (dtsFiles.length === 1) {
|
|
168546
168729
|
var sourceFile = this.program.getSourceFile(scriptInfo.fileName);
|
|
168547
168730
|
var signature = this.projectService.host.createHash ?
|
|
@@ -168660,6 +168843,10 @@ var ts;
|
|
|
168660
168843
|
this.autoImportProviderHost.close();
|
|
168661
168844
|
}
|
|
168662
168845
|
this.autoImportProviderHost = undefined;
|
|
168846
|
+
if (this.noDtsResolutionProject) {
|
|
168847
|
+
this.noDtsResolutionProject.close();
|
|
168848
|
+
}
|
|
168849
|
+
this.noDtsResolutionProject = undefined;
|
|
168663
168850
|
// signal language service to release source files acquired from document registry
|
|
168664
168851
|
this.languageService.dispose();
|
|
168665
168852
|
this.languageService = undefined;
|
|
@@ -169182,11 +169369,13 @@ var ts;
|
|
|
169182
169369
|
}
|
|
169183
169370
|
};
|
|
169184
169371
|
Project.prototype.setCompilerOptions = function (compilerOptions) {
|
|
169372
|
+
var _a;
|
|
169185
169373
|
if (compilerOptions) {
|
|
169186
169374
|
compilerOptions.allowNonTsExtensions = true;
|
|
169187
169375
|
var oldOptions = this.compilerOptions;
|
|
169188
169376
|
this.compilerOptions = compilerOptions;
|
|
169189
169377
|
this.setInternalCompilerOptionsForEmittingJsFiles();
|
|
169378
|
+
(_a = this.noDtsResolutionProject) === null || _a === void 0 ? void 0 : _a.setCompilerOptions(this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169190
169379
|
if (ts.changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
169191
169380
|
// reset cached unresolved imports if changes in compiler options affected module resolution
|
|
169192
169381
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
@@ -169526,6 +169715,31 @@ var ts;
|
|
|
169526
169715
|
Project.prototype.getIncompleteCompletionsCache = function () {
|
|
169527
169716
|
return this.projectService.getIncompleteCompletionsCache();
|
|
169528
169717
|
};
|
|
169718
|
+
/*@internal*/
|
|
169719
|
+
Project.prototype.getNoDtsResolutionProject = function (rootFileNames) {
|
|
169720
|
+
var _this = this;
|
|
169721
|
+
ts.Debug.assert(this.projectService.serverMode === ts.LanguageServiceMode.Semantic);
|
|
169722
|
+
if (!this.noDtsResolutionProject) {
|
|
169723
|
+
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169724
|
+
}
|
|
169725
|
+
ts.enumerateInsertsAndDeletes(rootFileNames.map(server.toNormalizedPath), this.noDtsResolutionProject.getRootFiles(), ts.getStringComparer(!this.useCaseSensitiveFileNames()), function (pathToAdd) {
|
|
169726
|
+
var info = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(pathToAdd, _this.currentDirectory, _this.noDtsResolutionProject.directoryStructureHost);
|
|
169727
|
+
if (info) {
|
|
169728
|
+
_this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
169729
|
+
}
|
|
169730
|
+
}, function (pathToRemove) {
|
|
169731
|
+
// It may be preferable to remove roots only once project grows to a certain size?
|
|
169732
|
+
var info = _this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
169733
|
+
if (info) {
|
|
169734
|
+
_this.noDtsResolutionProject.removeRoot(info);
|
|
169735
|
+
}
|
|
169736
|
+
});
|
|
169737
|
+
return this.noDtsResolutionProject;
|
|
169738
|
+
};
|
|
169739
|
+
/*@internal*/
|
|
169740
|
+
Project.prototype.getCompilerOptionsForNoDtsResolutionProject = function () {
|
|
169741
|
+
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 });
|
|
169742
|
+
};
|
|
169529
169743
|
return Project;
|
|
169530
169744
|
}());
|
|
169531
169745
|
server.Project = Project;
|
|
@@ -169641,6 +169855,26 @@ var ts;
|
|
|
169641
169855
|
return InferredProject;
|
|
169642
169856
|
}(Project));
|
|
169643
169857
|
server.InferredProject = InferredProject;
|
|
169858
|
+
var AuxiliaryProject = /** @class */ (function (_super) {
|
|
169859
|
+
__extends(AuxiliaryProject, _super);
|
|
169860
|
+
function AuxiliaryProject(projectService, documentRegistry, compilerOptions) {
|
|
169861
|
+
return _super.call(this, projectService.newAuxiliaryProjectName(), ProjectKind.Auxiliary, projectService, documentRegistry,
|
|
169862
|
+
/*hasExplicitListOfFiles*/ false,
|
|
169863
|
+
/*lastFileExceededProgramSize*/ undefined, compilerOptions,
|
|
169864
|
+
/*compileOnSaveEnabled*/ false,
|
|
169865
|
+
/*watchOptions*/ undefined, projectService.host,
|
|
169866
|
+
/*currentDirectory*/ undefined) || this;
|
|
169867
|
+
}
|
|
169868
|
+
AuxiliaryProject.prototype.isOrphan = function () {
|
|
169869
|
+
return true;
|
|
169870
|
+
};
|
|
169871
|
+
/*@internal*/
|
|
169872
|
+
AuxiliaryProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
169873
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
169874
|
+
return;
|
|
169875
|
+
};
|
|
169876
|
+
return AuxiliaryProject;
|
|
169877
|
+
}(Project));
|
|
169644
169878
|
var AutoImportProviderProject = /** @class */ (function (_super) {
|
|
169645
169879
|
__extends(AutoImportProviderProject, _super);
|
|
169646
169880
|
/*@internal*/
|
|
@@ -169792,6 +170026,11 @@ var ts;
|
|
|
169792
170026
|
}
|
|
169793
170027
|
return hasSameSetOfFiles;
|
|
169794
170028
|
};
|
|
170029
|
+
/*@internal*/
|
|
170030
|
+
AutoImportProviderProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170031
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170032
|
+
return;
|
|
170033
|
+
};
|
|
169795
170034
|
AutoImportProviderProject.prototype.hasRoots = function () {
|
|
169796
170035
|
var _a;
|
|
169797
170036
|
return !!((_a = this.rootFileNames) === null || _a === void 0 ? void 0 : _a.length);
|
|
@@ -170477,6 +170716,8 @@ var ts;
|
|
|
170477
170716
|
this.newInferredProjectName = createProjectNameFactoryWithCounter(server.makeInferredProjectName);
|
|
170478
170717
|
/*@internal*/
|
|
170479
170718
|
this.newAutoImportProviderProjectName = createProjectNameFactoryWithCounter(server.makeAutoImportProviderProjectName);
|
|
170719
|
+
/*@internal*/
|
|
170720
|
+
this.newAuxiliaryProjectName = createProjectNameFactoryWithCounter(server.makeAuxiliaryProjectName);
|
|
170480
170721
|
/**
|
|
170481
170722
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
170482
170723
|
*/
|
|
@@ -170680,13 +170921,15 @@ var ts;
|
|
|
170680
170921
|
ProjectService.prototype.delayUpdateProjectGraph = function (project) {
|
|
170681
170922
|
var _this = this;
|
|
170682
170923
|
project.markAsDirty();
|
|
170683
|
-
|
|
170684
|
-
|
|
170685
|
-
|
|
170686
|
-
|
|
170687
|
-
|
|
170688
|
-
|
|
170689
|
-
|
|
170924
|
+
if (project.projectKind !== server.ProjectKind.AutoImportProvider && project.projectKind !== server.ProjectKind.Auxiliary) {
|
|
170925
|
+
var projectName_1 = project.getProjectName();
|
|
170926
|
+
this.pendingProjectUpdates.set(projectName_1, project);
|
|
170927
|
+
this.throttledOperations.schedule(projectName_1, /*delay*/ 250, function () {
|
|
170928
|
+
if (_this.pendingProjectUpdates.delete(projectName_1)) {
|
|
170929
|
+
updateProjectIfDirty(project);
|
|
170930
|
+
}
|
|
170931
|
+
});
|
|
170932
|
+
}
|
|
170690
170933
|
};
|
|
170691
170934
|
/*@internal*/
|
|
170692
170935
|
ProjectService.prototype.hasPendingProjectUpdate = function (project) {
|
|
@@ -172967,7 +173210,7 @@ var ts;
|
|
|
172967
173210
|
var toRemoveScriptInfos = new ts.Map(this.filenameToScriptInfo);
|
|
172968
173211
|
this.filenameToScriptInfo.forEach(function (info) {
|
|
172969
173212
|
// If script info is open or orphan, retain it and its dependencies
|
|
172970
|
-
if (!info.isScriptOpen() && info.isOrphan() && !info.
|
|
173213
|
+
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
172971
173214
|
// Otherwise if there is any source info that is alive, this alive too
|
|
172972
173215
|
if (!info.sourceMapFilePath)
|
|
172973
173216
|
return;
|
|
@@ -174263,6 +174506,9 @@ var ts;
|
|
|
174263
174506
|
_a[server.CommandNames.DefinitionAndBoundSpanFull] = function (request) {
|
|
174264
174507
|
return _this.requiredResponse(_this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
174265
174508
|
},
|
|
174509
|
+
_a[server.CommandNames.FindSourceDefinition] = function (request) {
|
|
174510
|
+
return _this.requiredResponse(_this.findSourceDefinition(request.arguments));
|
|
174511
|
+
},
|
|
174266
174512
|
_a[server.CommandNames.EmitOutput] = function (request) {
|
|
174267
174513
|
return _this.requiredResponse(_this.getEmitOutput(request.arguments));
|
|
174268
174514
|
},
|
|
@@ -175004,7 +175250,7 @@ var ts;
|
|
|
175004
175250
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
175005
175251
|
return definitions.map(function (info) {
|
|
175006
175252
|
var newDocumentSpan = getMappedDocumentSpan(info, project);
|
|
175007
|
-
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name }), info.unverified && { unverified: info.unverified });
|
|
175253
|
+
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 });
|
|
175008
175254
|
});
|
|
175009
175255
|
};
|
|
175010
175256
|
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
|
@@ -175031,6 +175277,152 @@ var ts;
|
|
|
175031
175277
|
textSpan: textSpan,
|
|
175032
175278
|
};
|
|
175033
175279
|
};
|
|
175280
|
+
Session.prototype.findSourceDefinition = function (args) {
|
|
175281
|
+
var _a;
|
|
175282
|
+
var _b = this.getFileAndProject(args), file = _b.file, project = _b.project;
|
|
175283
|
+
var position = this.getPositionInFile(args, file);
|
|
175284
|
+
var unmappedDefinitions = project.getLanguageService().getDefinitionAtPosition(file, position);
|
|
175285
|
+
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || server.emptyArray, project).slice();
|
|
175286
|
+
var needsJsResolution = this.projectService.serverMode === ts.LanguageServiceMode.Semantic && (!ts.some(definitions, function (d) { return server.toNormalizedPath(d.fileName) !== file && !d.isAmbient; }) ||
|
|
175287
|
+
ts.some(definitions, function (d) { return !!d.failedAliasResolution; }));
|
|
175288
|
+
if (needsJsResolution) {
|
|
175289
|
+
var definitionSet_1 = ts.createSet(function (d) { return d.textSpan.start; }, ts.documentSpansEqual);
|
|
175290
|
+
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175291
|
+
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175292
|
+
var ls = noDtsProject.getLanguageService();
|
|
175293
|
+
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; });
|
|
175294
|
+
if (ts.some(jsDefinitions)) {
|
|
175295
|
+
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175296
|
+
var jsDefinition = jsDefinitions_1[_i];
|
|
175297
|
+
if (jsDefinition.unverified) {
|
|
175298
|
+
var refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram());
|
|
175299
|
+
if (ts.some(refined)) {
|
|
175300
|
+
for (var _c = 0, refined_1 = refined; _c < refined_1.length; _c++) {
|
|
175301
|
+
var def = refined_1[_c];
|
|
175302
|
+
definitionSet_1.add(def);
|
|
175303
|
+
}
|
|
175304
|
+
continue;
|
|
175305
|
+
}
|
|
175306
|
+
}
|
|
175307
|
+
definitionSet_1.add(jsDefinition);
|
|
175308
|
+
}
|
|
175309
|
+
}
|
|
175310
|
+
else {
|
|
175311
|
+
var ambientCandidates = definitions.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; });
|
|
175312
|
+
for (var _d = 0, _e = ts.some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain(); _d < _e.length; _d++) {
|
|
175313
|
+
var candidate = _e[_d];
|
|
175314
|
+
var fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
175315
|
+
if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
|
|
175316
|
+
continue;
|
|
175317
|
+
}
|
|
175318
|
+
var noDtsProgram = ls.getProgram();
|
|
175319
|
+
var fileToSearch = ts.Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
175320
|
+
for (var _f = 0, _g = searchForDeclaration(candidate.name, fileToSearch, noDtsProgram); _f < _g.length; _f++) {
|
|
175321
|
+
var match = _g[_f];
|
|
175322
|
+
definitionSet_1.add(match);
|
|
175323
|
+
}
|
|
175324
|
+
}
|
|
175325
|
+
}
|
|
175326
|
+
definitions = ts.arrayFrom(definitionSet_1.values());
|
|
175327
|
+
}
|
|
175328
|
+
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
175329
|
+
return this.mapDefinitionInfo(definitions, project);
|
|
175330
|
+
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
175331
|
+
var _a;
|
|
175332
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(fileName);
|
|
175333
|
+
if (nodeModulesPathParts && fileName.lastIndexOf(ts.nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
175334
|
+
// Second check ensures the fileName only contains one `/node_modules/`. If there's more than one I give up.
|
|
175335
|
+
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
175336
|
+
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
175337
|
+
var compilerOptions = project.getCompilationSettings();
|
|
175338
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175339
|
+
if (!packageJson)
|
|
175340
|
+
return undefined;
|
|
175341
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node12 or nodenext -
|
|
175342
|
+
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175343
|
+
// resolved from the package root under --moduleResolution node
|
|
175344
|
+
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
175345
|
+
// This substring is correct only because we checked for a single `/node_modules/` at the top.
|
|
175346
|
+
var packageNamePathPart = fileName.substring(nodeModulesPathParts.topLevelPackageNameIndex + 1, nodeModulesPathParts.packageRootIndex);
|
|
175347
|
+
var packageName = ts.getPackageNameFromTypesPackageName(ts.unmangleScopedPackageName(packageNamePathPart));
|
|
175348
|
+
var path_1 = project.toPath(fileName);
|
|
175349
|
+
if (entrypoints && ts.some(entrypoints, function (e) { return project.toPath(e) === path_1; })) {
|
|
175350
|
+
// This file was the main entrypoint of a package. Try to resolve that same package name with
|
|
175351
|
+
// the auxiliary project that only resolves to implementation files.
|
|
175352
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile)[0];
|
|
175353
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175354
|
+
}
|
|
175355
|
+
else {
|
|
175356
|
+
// It wasn't the main entrypoint but we are in node_modules. Try a subpath into the package.
|
|
175357
|
+
var pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
175358
|
+
var specifier = packageName + "/" + ts.removeFileExtension(pathToFileInPackage);
|
|
175359
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile)[0];
|
|
175360
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175361
|
+
}
|
|
175362
|
+
}
|
|
175363
|
+
// We're not in node_modules, and we only get to this function if non-dts module resolution failed.
|
|
175364
|
+
// I'm not sure what else I can do here that isn't already covered by that module resolution.
|
|
175365
|
+
return undefined;
|
|
175366
|
+
}
|
|
175367
|
+
// In 'foo.bar./**/baz', if we got not results on 'baz', see if we can get an ambient definition
|
|
175368
|
+
// for 'bar' or 'foo' (in that order) so we can search for declarations of 'baz' later.
|
|
175369
|
+
function getAmbientCandidatesByClimbingAccessChain() {
|
|
175370
|
+
var ls = project.getLanguageService();
|
|
175371
|
+
var program = ls.getProgram();
|
|
175372
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175373
|
+
if ((ts.isStringLiteralLike(initialNode) || ts.isIdentifier(initialNode)) && ts.isAccessExpression(initialNode.parent)) {
|
|
175374
|
+
return ts.forEachNameInAccessChainWalkingLeft(initialNode, function (nameInChain) {
|
|
175375
|
+
var _a;
|
|
175376
|
+
if (nameInChain === initialNode)
|
|
175377
|
+
return undefined;
|
|
175378
|
+
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 ({
|
|
175379
|
+
fileName: d.fileName,
|
|
175380
|
+
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175381
|
+
}); });
|
|
175382
|
+
if (ts.some(candidates)) {
|
|
175383
|
+
return candidates;
|
|
175384
|
+
}
|
|
175385
|
+
}) || server.emptyArray;
|
|
175386
|
+
}
|
|
175387
|
+
return server.emptyArray;
|
|
175388
|
+
}
|
|
175389
|
+
function tryRefineDefinition(definition, program, noDtsProgram) {
|
|
175390
|
+
var _a;
|
|
175391
|
+
var fileToSearch = noDtsProgram.getSourceFile(definition.fileName);
|
|
175392
|
+
if (!fileToSearch) {
|
|
175393
|
+
return undefined;
|
|
175394
|
+
}
|
|
175395
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175396
|
+
var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode);
|
|
175397
|
+
var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* ImportSpecifier */);
|
|
175398
|
+
if (!importSpecifier)
|
|
175399
|
+
return undefined;
|
|
175400
|
+
var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text;
|
|
175401
|
+
return searchForDeclaration(nameToSearch, fileToSearch, noDtsProgram);
|
|
175402
|
+
}
|
|
175403
|
+
function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
|
|
175404
|
+
var matches = ts.FindAllReferences.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
|
|
175405
|
+
return ts.mapDefined(matches, function (match) {
|
|
175406
|
+
var symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
|
|
175407
|
+
var decl = ts.getDeclarationFromName(match);
|
|
175408
|
+
if (symbol && decl) {
|
|
175409
|
+
// I think the last argument to this is supposed to be the start node, but it doesn't seem important.
|
|
175410
|
+
// Callers internal to GoToDefinition already get confused about this.
|
|
175411
|
+
return ts.GoToDefinition.createDefinitionInfo(decl, noDtsProgram.getTypeChecker(), symbol, decl, /*unverified*/ true);
|
|
175412
|
+
}
|
|
175413
|
+
});
|
|
175414
|
+
}
|
|
175415
|
+
function ensureRoot(project, fileName) {
|
|
175416
|
+
var info = project.getScriptInfo(fileName);
|
|
175417
|
+
if (!info)
|
|
175418
|
+
return false;
|
|
175419
|
+
if (!project.containsScriptInfo(info)) {
|
|
175420
|
+
project.addRoot(info);
|
|
175421
|
+
project.updateGraph();
|
|
175422
|
+
}
|
|
175423
|
+
return true;
|
|
175424
|
+
}
|
|
175425
|
+
};
|
|
175034
175426
|
Session.prototype.getEmitOutput = function (args) {
|
|
175035
175427
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
175036
175428
|
if (!project.shouldEmitFile(project.getScriptInfo(file))) {
|
|
@@ -175594,7 +175986,7 @@ var ts;
|
|
|
175594
175986
|
return undefined;
|
|
175595
175987
|
}
|
|
175596
175988
|
var compilationSettings = project.getCompilationSettings();
|
|
175597
|
-
if (!!compilationSettings.noEmit || ts.
|
|
175989
|
+
if (!!compilationSettings.noEmit || ts.isDeclarationFileName(info.fileName) && !dtsChangeCanAffectEmit(compilationSettings)) {
|
|
175598
175990
|
// avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
|
|
175599
175991
|
return undefined;
|
|
175600
175992
|
}
|
|
@@ -176074,7 +176466,7 @@ var ts;
|
|
|
176074
176466
|
else {
|
|
176075
176467
|
var info = this.projectService.getScriptInfo(fileNameInProject); // TODO: GH#18217
|
|
176076
176468
|
if (!info.isScriptOpen()) {
|
|
176077
|
-
if (ts.
|
|
176469
|
+
if (ts.isDeclarationFileName(fileNameInProject)) {
|
|
176078
176470
|
veryLowPriorityFiles.push(fileNameInProject);
|
|
176079
176471
|
}
|
|
176080
176472
|
else {
|