typescript 5.5.0-dev.20240404 → 5.5.0-dev.20240408
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/lib.es2023.intl.d.ts +6 -2
- package/lib/tsc.js +395 -207
- package/lib/typescript.d.ts +1 -2
- package/lib/typescript.js +1574 -235
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -163,6 +163,7 @@ __export(typescript_exports, {
|
|
|
163
163
|
SignatureKind: () => SignatureKind,
|
|
164
164
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
165
165
|
SnippetKind: () => SnippetKind,
|
|
166
|
+
StatisticType: () => StatisticType,
|
|
166
167
|
StructureIsReused: () => StructureIsReused,
|
|
167
168
|
SymbolAccessibility: () => SymbolAccessibility,
|
|
168
169
|
SymbolDisplay: () => ts_SymbolDisplay_exports,
|
|
@@ -411,6 +412,7 @@ __export(typescript_exports, {
|
|
|
411
412
|
createExternalHelpersImportDeclarationIfNeeded: () => createExternalHelpersImportDeclarationIfNeeded,
|
|
412
413
|
createFileDiagnostic: () => createFileDiagnostic,
|
|
413
414
|
createFileDiagnosticFromMessageChain: () => createFileDiagnosticFromMessageChain,
|
|
415
|
+
createFlowNode: () => createFlowNode,
|
|
414
416
|
createForOfBindingStatement: () => createForOfBindingStatement,
|
|
415
417
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
416
418
|
createGetSourceFile: () => createGetSourceFile,
|
|
@@ -542,7 +544,9 @@ __export(typescript_exports, {
|
|
|
542
544
|
escapeSnippetText: () => escapeSnippetText,
|
|
543
545
|
escapeString: () => escapeString,
|
|
544
546
|
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
547
|
+
evaluatorResult: () => evaluatorResult,
|
|
545
548
|
every: () => every,
|
|
549
|
+
executeCommandLine: () => executeCommandLine,
|
|
546
550
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
547
551
|
explainFiles: () => explainFiles,
|
|
548
552
|
explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
|
|
@@ -908,6 +912,7 @@ __export(typescript_exports, {
|
|
|
908
912
|
getNewLineOrDefaultFromHost: () => getNewLineOrDefaultFromHost,
|
|
909
913
|
getNewTargetContainer: () => getNewTargetContainer,
|
|
910
914
|
getNextJSDocCommentLocation: () => getNextJSDocCommentLocation,
|
|
915
|
+
getNodeChildren: () => getNodeChildren,
|
|
911
916
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
912
917
|
getNodeId: () => getNodeId,
|
|
913
918
|
getNodeKind: () => getNodeKind,
|
|
@@ -1230,6 +1235,7 @@ __export(typescript_exports, {
|
|
|
1230
1235
|
isBooleanLiteral: () => isBooleanLiteral,
|
|
1231
1236
|
isBreakOrContinueStatement: () => isBreakOrContinueStatement,
|
|
1232
1237
|
isBreakStatement: () => isBreakStatement,
|
|
1238
|
+
isBuild: () => isBuild,
|
|
1233
1239
|
isBuildInfoFile: () => isBuildInfoFile,
|
|
1234
1240
|
isBuilderProgram: () => isBuilderProgram2,
|
|
1235
1241
|
isBundle: () => isBundle,
|
|
@@ -1761,7 +1767,6 @@ __export(typescript_exports, {
|
|
|
1761
1767
|
isSuperProperty: () => isSuperProperty,
|
|
1762
1768
|
isSupportedSourceFileName: () => isSupportedSourceFileName,
|
|
1763
1769
|
isSwitchStatement: () => isSwitchStatement,
|
|
1764
|
-
isSyntacticallyString: () => isSyntacticallyString,
|
|
1765
1770
|
isSyntaxList: () => isSyntaxList,
|
|
1766
1771
|
isSyntheticExpression: () => isSyntheticExpression,
|
|
1767
1772
|
isSyntheticReference: () => isSyntheticReference,
|
|
@@ -2093,6 +2098,7 @@ __export(typescript_exports, {
|
|
|
2093
2098
|
setInternalEmitFlags: () => setInternalEmitFlags,
|
|
2094
2099
|
setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
|
|
2095
2100
|
setModuleDefaultHelper: () => setModuleDefaultHelper,
|
|
2101
|
+
setNodeChildren: () => setNodeChildren,
|
|
2096
2102
|
setNodeFlags: () => setNodeFlags,
|
|
2097
2103
|
setObjectAllocator: () => setObjectAllocator,
|
|
2098
2104
|
setOriginalNode: () => setOriginalNode,
|
|
@@ -2287,6 +2293,7 @@ __export(typescript_exports, {
|
|
|
2287
2293
|
unorderedRemoveItem: () => unorderedRemoveItem,
|
|
2288
2294
|
unorderedRemoveItemAt: () => unorderedRemoveItemAt,
|
|
2289
2295
|
unreachableCodeIsError: () => unreachableCodeIsError,
|
|
2296
|
+
unsetNodeChildren: () => unsetNodeChildren,
|
|
2290
2297
|
unusedLabelIsError: () => unusedLabelIsError,
|
|
2291
2298
|
unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
|
|
2292
2299
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
@@ -2328,7 +2335,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2328
2335
|
|
|
2329
2336
|
// src/compiler/corePublic.ts
|
|
2330
2337
|
var versionMajorMinor = "5.5";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2338
|
+
var version = `${versionMajorMinor}.0-dev.20240408`;
|
|
2332
2339
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2340
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2341
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4392,6 +4399,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4392
4399
|
attachFlowNodeDebugInfoWorker(flowNode);
|
|
4393
4400
|
}
|
|
4394
4401
|
}
|
|
4402
|
+
return flowNode;
|
|
4395
4403
|
}
|
|
4396
4404
|
Debug2.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo;
|
|
4397
4405
|
let nodeArrayProto;
|
|
@@ -4667,7 +4675,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4667
4675
|
return !!(f.flags & 128 /* SwitchClause */);
|
|
4668
4676
|
}
|
|
4669
4677
|
function hasAntecedents(f) {
|
|
4670
|
-
return !!(f.flags & 12 /* Label */) && !!f.
|
|
4678
|
+
return !!(f.flags & 12 /* Label */) && !!f.antecedent;
|
|
4671
4679
|
}
|
|
4672
4680
|
function hasAntecedent(f) {
|
|
4673
4681
|
return !!(f.flags & hasAntecedentFlags);
|
|
@@ -4716,7 +4724,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4716
4724
|
links[id] = graphNode = { id, flowNode: flowNode2, edges: [], text: "", lane: -1, endLane: -1, level: -1, circular: false };
|
|
4717
4725
|
nodes.push(graphNode);
|
|
4718
4726
|
if (hasAntecedents(flowNode2)) {
|
|
4719
|
-
for (const antecedent of flowNode2.
|
|
4727
|
+
for (const antecedent of flowNode2.antecedent) {
|
|
4720
4728
|
buildGraphEdge(graphNode, antecedent, seen);
|
|
4721
4729
|
}
|
|
4722
4730
|
} else if (hasAntecedent(flowNode2)) {
|
|
@@ -4774,7 +4782,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4774
4782
|
node.endLane = lane;
|
|
4775
4783
|
}
|
|
4776
4784
|
}
|
|
4777
|
-
function
|
|
4785
|
+
function getHeader2(flags) {
|
|
4778
4786
|
if (flags & 2 /* Start */)
|
|
4779
4787
|
return "Start";
|
|
4780
4788
|
if (flags & 4 /* BranchLabel */)
|
|
@@ -4809,18 +4817,15 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4809
4817
|
);
|
|
4810
4818
|
}
|
|
4811
4819
|
function renderFlowNode(flowNode2, circular) {
|
|
4812
|
-
let text =
|
|
4820
|
+
let text = getHeader2(flowNode2.flags);
|
|
4813
4821
|
if (circular) {
|
|
4814
4822
|
text = `${text}#${getDebugFlowNodeId(flowNode2)}`;
|
|
4815
4823
|
}
|
|
4816
|
-
if (
|
|
4817
|
-
if (flowNode2.node) {
|
|
4818
|
-
text += ` (${getNodeText(flowNode2.node)})`;
|
|
4819
|
-
}
|
|
4820
|
-
} else if (isFlowSwitchClause(flowNode2)) {
|
|
4824
|
+
if (isFlowSwitchClause(flowNode2)) {
|
|
4821
4825
|
const clauses = [];
|
|
4822
|
-
|
|
4823
|
-
|
|
4826
|
+
const { switchStatement, clauseStart, clauseEnd } = flowNode2.node;
|
|
4827
|
+
for (let i = clauseStart; i < clauseEnd; i++) {
|
|
4828
|
+
const clause = switchStatement.caseBlock.clauses[i];
|
|
4824
4829
|
if (isDefaultClause(clause)) {
|
|
4825
4830
|
clauses.push("default");
|
|
4826
4831
|
} else {
|
|
@@ -4828,6 +4833,10 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4828
4833
|
}
|
|
4829
4834
|
}
|
|
4830
4835
|
text += ` (${clauses.join(", ")})`;
|
|
4836
|
+
} else if (hasNode(flowNode2)) {
|
|
4837
|
+
if (flowNode2.node) {
|
|
4838
|
+
text += ` (${getNodeText(flowNode2.node)})`;
|
|
4839
|
+
}
|
|
4831
4840
|
}
|
|
4832
4841
|
return circular === "circularity" ? `Circular(${text})` : text;
|
|
4833
4842
|
}
|
|
@@ -13460,6 +13469,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13460
13469
|
return token = 23 /* OpenBracketToken */;
|
|
13461
13470
|
case 93 /* closeBracket */:
|
|
13462
13471
|
return token = 24 /* CloseBracketToken */;
|
|
13472
|
+
case 40 /* openParen */:
|
|
13473
|
+
return token = 21 /* OpenParenToken */;
|
|
13474
|
+
case 41 /* closeParen */:
|
|
13475
|
+
return token = 22 /* CloseParenToken */;
|
|
13463
13476
|
case 60 /* lessThan */:
|
|
13464
13477
|
return token = 30 /* LessThanToken */;
|
|
13465
13478
|
case 62 /* greaterThan */:
|
|
@@ -15549,8 +15562,11 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
15549
15562
|
if (includeJsDoc && hasJSDocNodes(node)) {
|
|
15550
15563
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
15551
15564
|
}
|
|
15552
|
-
if (node.kind === 352 /* SyntaxList */
|
|
15553
|
-
|
|
15565
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
15566
|
+
const first2 = firstOrUndefined(getNodeChildren(node));
|
|
15567
|
+
if (first2) {
|
|
15568
|
+
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
|
|
15569
|
+
}
|
|
15554
15570
|
}
|
|
15555
15571
|
return skipTrivia(
|
|
15556
15572
|
(sourceFile || getSourceFileOfNode(node)).text,
|
|
@@ -21926,79 +21942,81 @@ function replaceFirstStar(s, replacement) {
|
|
|
21926
21942
|
function getNameFromImportAttribute(node) {
|
|
21927
21943
|
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
21928
21944
|
}
|
|
21929
|
-
function isSyntacticallyString
|
|
21930
|
-
|
|
21931
|
-
switch (expr.kind) {
|
|
21932
|
-
case 226 /* BinaryExpression */:
|
|
21933
|
-
const left = expr.left;
|
|
21934
|
-
const right = expr.right;
|
|
21935
|
-
return expr.operatorToken.kind === 40 /* PlusToken */ && (isSyntacticallyString(left) || isSyntacticallyString(right));
|
|
21936
|
-
case 228 /* TemplateExpression */:
|
|
21937
|
-
case 11 /* StringLiteral */:
|
|
21938
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
21939
|
-
return true;
|
|
21940
|
-
}
|
|
21941
|
-
return false;
|
|
21945
|
+
function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false) {
|
|
21946
|
+
return { value, isSyntacticallyString, resolvedOtherFiles };
|
|
21942
21947
|
}
|
|
21943
21948
|
function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
|
|
21944
21949
|
function evaluate(expr, location) {
|
|
21950
|
+
let isSyntacticallyString = false;
|
|
21951
|
+
let resolvedOtherFiles = false;
|
|
21952
|
+
expr = skipParentheses(expr);
|
|
21945
21953
|
switch (expr.kind) {
|
|
21946
21954
|
case 224 /* PrefixUnaryExpression */:
|
|
21947
|
-
const
|
|
21948
|
-
|
|
21955
|
+
const result = evaluate(expr.operand, location);
|
|
21956
|
+
resolvedOtherFiles = result.resolvedOtherFiles;
|
|
21957
|
+
if (typeof result.value === "number") {
|
|
21949
21958
|
switch (expr.operator) {
|
|
21950
21959
|
case 40 /* PlusToken */:
|
|
21951
|
-
return value;
|
|
21960
|
+
return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21952
21961
|
case 41 /* MinusToken */:
|
|
21953
|
-
return -value;
|
|
21962
|
+
return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21954
21963
|
case 55 /* TildeToken */:
|
|
21955
|
-
return ~value;
|
|
21964
|
+
return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21956
21965
|
}
|
|
21957
21966
|
}
|
|
21958
21967
|
break;
|
|
21959
|
-
case 226 /* BinaryExpression */:
|
|
21968
|
+
case 226 /* BinaryExpression */: {
|
|
21960
21969
|
const left = evaluate(expr.left, location);
|
|
21961
21970
|
const right = evaluate(expr.right, location);
|
|
21962
|
-
|
|
21971
|
+
isSyntacticallyString = (left.isSyntacticallyString || right.isSyntacticallyString) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
21972
|
+
resolvedOtherFiles = left.resolvedOtherFiles || right.resolvedOtherFiles;
|
|
21973
|
+
if (typeof left.value === "number" && typeof right.value === "number") {
|
|
21963
21974
|
switch (expr.operatorToken.kind) {
|
|
21964
21975
|
case 52 /* BarToken */:
|
|
21965
|
-
return left | right;
|
|
21976
|
+
return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21966
21977
|
case 51 /* AmpersandToken */:
|
|
21967
|
-
return left & right;
|
|
21978
|
+
return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21968
21979
|
case 49 /* GreaterThanGreaterThanToken */:
|
|
21969
|
-
return left >> right;
|
|
21980
|
+
return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21970
21981
|
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
21971
|
-
return left >>> right;
|
|
21982
|
+
return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21972
21983
|
case 48 /* LessThanLessThanToken */:
|
|
21973
|
-
return left << right;
|
|
21984
|
+
return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21974
21985
|
case 53 /* CaretToken */:
|
|
21975
|
-
return left ^ right;
|
|
21986
|
+
return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21976
21987
|
case 42 /* AsteriskToken */:
|
|
21977
|
-
return left * right;
|
|
21988
|
+
return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21978
21989
|
case 44 /* SlashToken */:
|
|
21979
|
-
return left / right;
|
|
21990
|
+
return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21980
21991
|
case 40 /* PlusToken */:
|
|
21981
|
-
return left + right;
|
|
21992
|
+
return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21982
21993
|
case 41 /* MinusToken */:
|
|
21983
|
-
return left - right;
|
|
21994
|
+
return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21984
21995
|
case 45 /* PercentToken */:
|
|
21985
|
-
return left % right;
|
|
21996
|
+
return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21986
21997
|
case 43 /* AsteriskAsteriskToken */:
|
|
21987
|
-
return left ** right;
|
|
21998
|
+
return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
21988
21999
|
}
|
|
21989
|
-
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
21990
|
-
return
|
|
22000
|
+
} else if ((typeof left.value === "string" || typeof left.value === "number") && (typeof right.value === "string" || typeof right.value === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
22001
|
+
return evaluatorResult(
|
|
22002
|
+
"" + left.value + right.value,
|
|
22003
|
+
isSyntacticallyString,
|
|
22004
|
+
resolvedOtherFiles
|
|
22005
|
+
);
|
|
21991
22006
|
}
|
|
21992
22007
|
break;
|
|
22008
|
+
}
|
|
21993
22009
|
case 11 /* StringLiteral */:
|
|
21994
22010
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
21995
|
-
return
|
|
22011
|
+
return evaluatorResult(
|
|
22012
|
+
expr.text,
|
|
22013
|
+
/*isSyntacticallyString*/
|
|
22014
|
+
true
|
|
22015
|
+
);
|
|
21996
22016
|
case 228 /* TemplateExpression */:
|
|
21997
22017
|
return evaluateTemplateExpression(expr, location);
|
|
21998
22018
|
case 9 /* NumericLiteral */:
|
|
21999
|
-
return +expr.text;
|
|
22000
|
-
case 217 /* ParenthesizedExpression */:
|
|
22001
|
-
return evaluate(expr.expression, location);
|
|
22019
|
+
return evaluatorResult(+expr.text);
|
|
22002
22020
|
case 80 /* Identifier */:
|
|
22003
22021
|
return evaluateEntityNameExpression(expr, location);
|
|
22004
22022
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -22009,19 +22027,36 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
22009
22027
|
case 212 /* ElementAccessExpression */:
|
|
22010
22028
|
return evaluateElementAccessExpression(expr, location);
|
|
22011
22029
|
}
|
|
22012
|
-
return
|
|
22030
|
+
return evaluatorResult(
|
|
22031
|
+
/*value*/
|
|
22032
|
+
void 0,
|
|
22033
|
+
isSyntacticallyString,
|
|
22034
|
+
resolvedOtherFiles
|
|
22035
|
+
);
|
|
22013
22036
|
}
|
|
22014
22037
|
function evaluateTemplateExpression(expr, location) {
|
|
22015
22038
|
let result = expr.head.text;
|
|
22039
|
+
let resolvedOtherFiles = false;
|
|
22016
22040
|
for (const span of expr.templateSpans) {
|
|
22017
|
-
const
|
|
22018
|
-
if (value === void 0) {
|
|
22019
|
-
return
|
|
22041
|
+
const spanResult = evaluate(span.expression, location);
|
|
22042
|
+
if (spanResult.value === void 0) {
|
|
22043
|
+
return evaluatorResult(
|
|
22044
|
+
/*value*/
|
|
22045
|
+
void 0,
|
|
22046
|
+
/*isSyntacticallyString*/
|
|
22047
|
+
true
|
|
22048
|
+
);
|
|
22020
22049
|
}
|
|
22021
|
-
result += value;
|
|
22050
|
+
result += spanResult.value;
|
|
22022
22051
|
result += span.literal.text;
|
|
22052
|
+
resolvedOtherFiles || (resolvedOtherFiles = spanResult.resolvedOtherFiles);
|
|
22023
22053
|
}
|
|
22024
|
-
return
|
|
22054
|
+
return evaluatorResult(
|
|
22055
|
+
result,
|
|
22056
|
+
/*isSyntacticallyString*/
|
|
22057
|
+
true,
|
|
22058
|
+
resolvedOtherFiles
|
|
22059
|
+
);
|
|
22025
22060
|
}
|
|
22026
22061
|
return evaluate;
|
|
22027
22062
|
}
|
|
@@ -26176,7 +26211,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26176
26211
|
}
|
|
26177
26212
|
function createSyntaxList3(children) {
|
|
26178
26213
|
const node = createBaseNode(352 /* SyntaxList */);
|
|
26179
|
-
node
|
|
26214
|
+
setNodeChildren(node, children);
|
|
26180
26215
|
return node;
|
|
26181
26216
|
}
|
|
26182
26217
|
function createNotEmittedStatement(original) {
|
|
@@ -29084,6 +29119,19 @@ function isSyntaxList(n) {
|
|
|
29084
29119
|
return n.kind === 352 /* SyntaxList */;
|
|
29085
29120
|
}
|
|
29086
29121
|
|
|
29122
|
+
// src/compiler/factory/nodeChildren.ts
|
|
29123
|
+
var nodeChildren = /* @__PURE__ */ new WeakMap();
|
|
29124
|
+
function getNodeChildren(node) {
|
|
29125
|
+
return nodeChildren.get(node);
|
|
29126
|
+
}
|
|
29127
|
+
function setNodeChildren(node, children) {
|
|
29128
|
+
nodeChildren.set(node, children);
|
|
29129
|
+
return children;
|
|
29130
|
+
}
|
|
29131
|
+
function unsetNodeChildren(node) {
|
|
29132
|
+
nodeChildren.delete(node);
|
|
29133
|
+
}
|
|
29134
|
+
|
|
29087
29135
|
// src/compiler/factory/utilities.ts
|
|
29088
29136
|
function createEmptyExports(factory2) {
|
|
29089
29137
|
return factory2.createExportDeclaration(
|
|
@@ -37756,9 +37804,7 @@ var IncrementalParser;
|
|
|
37756
37804
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
37757
37805
|
text = oldText.substring(node.pos, node.end);
|
|
37758
37806
|
}
|
|
37759
|
-
|
|
37760
|
-
node._children = void 0;
|
|
37761
|
-
}
|
|
37807
|
+
unsetNodeChildren(node);
|
|
37762
37808
|
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
|
|
37763
37809
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
37764
37810
|
Debug.assert(text === newText.substring(node.pos, node.end));
|
|
@@ -37772,7 +37818,6 @@ var IncrementalParser;
|
|
|
37772
37818
|
checkNodePositions(node, aggressiveChecks);
|
|
37773
37819
|
}
|
|
37774
37820
|
function visitArray2(array) {
|
|
37775
|
-
array._children = void 0;
|
|
37776
37821
|
setTextRangePosEnd(array, array.pos + delta, array.end + delta);
|
|
37777
37822
|
for (const node of array) {
|
|
37778
37823
|
visitNode3(node);
|
|
@@ -37844,7 +37889,7 @@ var IncrementalParser;
|
|
|
37844
37889
|
const fullEnd = child.end;
|
|
37845
37890
|
if (fullEnd >= changeStart) {
|
|
37846
37891
|
child.intersectsChange = true;
|
|
37847
|
-
child
|
|
37892
|
+
unsetNodeChildren(child);
|
|
37848
37893
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
37849
37894
|
forEachChild(child, visitNode3, visitArray2);
|
|
37850
37895
|
if (hasJSDocNodes(child)) {
|
|
@@ -37874,7 +37919,6 @@ var IncrementalParser;
|
|
|
37874
37919
|
const fullEnd = array.end;
|
|
37875
37920
|
if (fullEnd >= changeStart) {
|
|
37876
37921
|
array.intersectsChange = true;
|
|
37877
|
-
array._children = void 0;
|
|
37878
37922
|
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
37879
37923
|
for (const node of array) {
|
|
37880
37924
|
visitNode3(node);
|
|
@@ -44272,9 +44316,8 @@ var ContainerFlags = /* @__PURE__ */ ((ContainerFlags2) => {
|
|
|
44272
44316
|
ContainerFlags2[ContainerFlags2["IsObjectLiteralOrClassExpressionMethodOrAccessor"] = 128] = "IsObjectLiteralOrClassExpressionMethodOrAccessor";
|
|
44273
44317
|
return ContainerFlags2;
|
|
44274
44318
|
})(ContainerFlags || {});
|
|
44275
|
-
function
|
|
44276
|
-
Debug.attachFlowNodeDebugInfo(node);
|
|
44277
|
-
return node;
|
|
44319
|
+
function createFlowNode(flags, node, antecedent) {
|
|
44320
|
+
return Debug.attachFlowNodeDebugInfo({ flags, id: 0, node, antecedent });
|
|
44278
44321
|
}
|
|
44279
44322
|
var binder = /* @__PURE__ */ createBinder();
|
|
44280
44323
|
function bindSourceFile(file, options) {
|
|
@@ -44308,14 +44351,27 @@ function createBinder() {
|
|
|
44308
44351
|
var preSwitchCaseFlow;
|
|
44309
44352
|
var activeLabelList;
|
|
44310
44353
|
var hasExplicitReturn;
|
|
44354
|
+
var hasFlowEffects;
|
|
44311
44355
|
var emitFlags;
|
|
44312
44356
|
var inStrictMode;
|
|
44313
44357
|
var inAssignmentPattern = false;
|
|
44314
44358
|
var symbolCount = 0;
|
|
44315
44359
|
var Symbol47;
|
|
44316
44360
|
var classifiableNames;
|
|
44317
|
-
var unreachableFlow =
|
|
44318
|
-
|
|
44361
|
+
var unreachableFlow = createFlowNode(
|
|
44362
|
+
1 /* Unreachable */,
|
|
44363
|
+
/*node*/
|
|
44364
|
+
void 0,
|
|
44365
|
+
/*antecedent*/
|
|
44366
|
+
void 0
|
|
44367
|
+
);
|
|
44368
|
+
var reportedUnreachableFlow = createFlowNode(
|
|
44369
|
+
1 /* Unreachable */,
|
|
44370
|
+
/*node*/
|
|
44371
|
+
void 0,
|
|
44372
|
+
/*antecedent*/
|
|
44373
|
+
void 0
|
|
44374
|
+
);
|
|
44319
44375
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
44320
44376
|
return bindSourceFile2;
|
|
44321
44377
|
function createDiagnosticForNode2(node, message, ...args) {
|
|
@@ -44367,6 +44423,7 @@ function createBinder() {
|
|
|
44367
44423
|
currentExceptionTarget = void 0;
|
|
44368
44424
|
activeLabelList = void 0;
|
|
44369
44425
|
hasExplicitReturn = false;
|
|
44426
|
+
hasFlowEffects = false;
|
|
44370
44427
|
inAssignmentPattern = false;
|
|
44371
44428
|
emitFlags = 0 /* None */;
|
|
44372
44429
|
}
|
|
@@ -44634,7 +44691,13 @@ function createBinder() {
|
|
|
44634
44691
|
const saveHasExplicitReturn = hasExplicitReturn;
|
|
44635
44692
|
const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
|
|
44636
44693
|
if (!isImmediatelyInvoked) {
|
|
44637
|
-
currentFlow =
|
|
44694
|
+
currentFlow = createFlowNode(
|
|
44695
|
+
2 /* Start */,
|
|
44696
|
+
/*node*/
|
|
44697
|
+
void 0,
|
|
44698
|
+
/*antecedent*/
|
|
44699
|
+
void 0
|
|
44700
|
+
);
|
|
44638
44701
|
if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) {
|
|
44639
44702
|
currentFlow.node = node;
|
|
44640
44703
|
}
|
|
@@ -44824,8 +44887,8 @@ function createBinder() {
|
|
|
44824
44887
|
function isNarrowingExpression(expr) {
|
|
44825
44888
|
switch (expr.kind) {
|
|
44826
44889
|
case 80 /* Identifier */:
|
|
44827
|
-
case 81 /* PrivateIdentifier */:
|
|
44828
44890
|
case 110 /* ThisKeyword */:
|
|
44891
|
+
return true;
|
|
44829
44892
|
case 211 /* PropertyAccessExpression */:
|
|
44830
44893
|
case 212 /* ElementAccessExpression */:
|
|
44831
44894
|
return containsNarrowableReference(expr);
|
|
@@ -44847,7 +44910,22 @@ function createBinder() {
|
|
|
44847
44910
|
return false;
|
|
44848
44911
|
}
|
|
44849
44912
|
function isNarrowableReference(expr) {
|
|
44850
|
-
|
|
44913
|
+
switch (expr.kind) {
|
|
44914
|
+
case 80 /* Identifier */:
|
|
44915
|
+
case 110 /* ThisKeyword */:
|
|
44916
|
+
case 108 /* SuperKeyword */:
|
|
44917
|
+
case 236 /* MetaProperty */:
|
|
44918
|
+
return true;
|
|
44919
|
+
case 211 /* PropertyAccessExpression */:
|
|
44920
|
+
case 217 /* ParenthesizedExpression */:
|
|
44921
|
+
case 235 /* NonNullExpression */:
|
|
44922
|
+
return isNarrowableReference(expr.expression);
|
|
44923
|
+
case 212 /* ElementAccessExpression */:
|
|
44924
|
+
return (isStringOrNumericLiteralLike(expr.argumentExpression) || isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression);
|
|
44925
|
+
case 226 /* BinaryExpression */:
|
|
44926
|
+
return expr.operatorToken.kind === 28 /* CommaToken */ && isNarrowableReference(expr.right) || isAssignmentOperator(expr.operatorToken.kind) && isLeftHandSideExpression(expr.left);
|
|
44927
|
+
}
|
|
44928
|
+
return false;
|
|
44851
44929
|
}
|
|
44852
44930
|
function containsNarrowableReference(expr) {
|
|
44853
44931
|
return isNarrowableReference(expr) || isOptionalChain(expr) && containsNarrowableReference(expr.expression);
|
|
@@ -44904,20 +44982,32 @@ function createBinder() {
|
|
|
44904
44982
|
return containsNarrowableReference(expr);
|
|
44905
44983
|
}
|
|
44906
44984
|
function createBranchLabel() {
|
|
44907
|
-
return
|
|
44985
|
+
return createFlowNode(
|
|
44986
|
+
4 /* BranchLabel */,
|
|
44987
|
+
/*node*/
|
|
44988
|
+
void 0,
|
|
44989
|
+
/*antecedent*/
|
|
44990
|
+
void 0
|
|
44991
|
+
);
|
|
44908
44992
|
}
|
|
44909
44993
|
function createLoopLabel() {
|
|
44910
|
-
return
|
|
44994
|
+
return createFlowNode(
|
|
44995
|
+
8 /* LoopLabel */,
|
|
44996
|
+
/*node*/
|
|
44997
|
+
void 0,
|
|
44998
|
+
/*antecedent*/
|
|
44999
|
+
void 0
|
|
45000
|
+
);
|
|
44911
45001
|
}
|
|
44912
45002
|
function createReduceLabel(target, antecedents, antecedent) {
|
|
44913
|
-
return
|
|
45003
|
+
return createFlowNode(1024 /* ReduceLabel */, { target, antecedents }, antecedent);
|
|
44914
45004
|
}
|
|
44915
45005
|
function setFlowNodeReferenced(flow) {
|
|
44916
45006
|
flow.flags |= flow.flags & 2048 /* Referenced */ ? 4096 /* Shared */ : 2048 /* Referenced */;
|
|
44917
45007
|
}
|
|
44918
45008
|
function addAntecedent(label, antecedent) {
|
|
44919
|
-
if (!(antecedent.flags & 1 /* Unreachable */) && !contains(label.
|
|
44920
|
-
(label.
|
|
45009
|
+
if (!(antecedent.flags & 1 /* Unreachable */) && !contains(label.antecedent, antecedent)) {
|
|
45010
|
+
(label.antecedent || (label.antecedent = [])).push(antecedent);
|
|
44921
45011
|
setFlowNodeReferenced(antecedent);
|
|
44922
45012
|
}
|
|
44923
45013
|
}
|
|
@@ -44935,15 +45025,16 @@ function createBinder() {
|
|
|
44935
45025
|
return antecedent;
|
|
44936
45026
|
}
|
|
44937
45027
|
setFlowNodeReferenced(antecedent);
|
|
44938
|
-
return
|
|
45028
|
+
return createFlowNode(flags, expression, antecedent);
|
|
44939
45029
|
}
|
|
44940
45030
|
function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {
|
|
44941
45031
|
setFlowNodeReferenced(antecedent);
|
|
44942
|
-
return
|
|
45032
|
+
return createFlowNode(128 /* SwitchClause */, { switchStatement, clauseStart, clauseEnd }, antecedent);
|
|
44943
45033
|
}
|
|
44944
45034
|
function createFlowMutation(flags, antecedent, node) {
|
|
44945
45035
|
setFlowNodeReferenced(antecedent);
|
|
44946
|
-
|
|
45036
|
+
hasFlowEffects = true;
|
|
45037
|
+
const result = createFlowNode(flags, node, antecedent);
|
|
44947
45038
|
if (currentExceptionTarget) {
|
|
44948
45039
|
addAntecedent(currentExceptionTarget, result);
|
|
44949
45040
|
}
|
|
@@ -44951,10 +45042,11 @@ function createBinder() {
|
|
|
44951
45042
|
}
|
|
44952
45043
|
function createFlowCall(antecedent, node) {
|
|
44953
45044
|
setFlowNodeReferenced(antecedent);
|
|
44954
|
-
|
|
45045
|
+
hasFlowEffects = true;
|
|
45046
|
+
return createFlowNode(512 /* Call */, node, antecedent);
|
|
44955
45047
|
}
|
|
44956
45048
|
function finishFlowLabel(flow) {
|
|
44957
|
-
const antecedents = flow.
|
|
45049
|
+
const antecedents = flow.antecedent;
|
|
44958
45050
|
if (!antecedents) {
|
|
44959
45051
|
return unreachableFlow;
|
|
44960
45052
|
}
|
|
@@ -45108,6 +45200,7 @@ function createBinder() {
|
|
|
45108
45200
|
}
|
|
45109
45201
|
}
|
|
45110
45202
|
currentFlow = unreachableFlow;
|
|
45203
|
+
hasFlowEffects = true;
|
|
45111
45204
|
}
|
|
45112
45205
|
function findActiveLabel(name) {
|
|
45113
45206
|
for (let label = activeLabelList; label; label = label.next) {
|
|
@@ -45122,6 +45215,7 @@ function createBinder() {
|
|
|
45122
45215
|
if (flowLabel) {
|
|
45123
45216
|
addAntecedent(flowLabel, currentFlow);
|
|
45124
45217
|
currentFlow = unreachableFlow;
|
|
45218
|
+
hasFlowEffects = true;
|
|
45125
45219
|
}
|
|
45126
45220
|
}
|
|
45127
45221
|
function bindBreakOrContinueStatement(node) {
|
|
@@ -45161,19 +45255,19 @@ function createBinder() {
|
|
|
45161
45255
|
currentExceptionTarget = saveExceptionTarget;
|
|
45162
45256
|
if (node.finallyBlock) {
|
|
45163
45257
|
const finallyLabel = createBranchLabel();
|
|
45164
|
-
finallyLabel.
|
|
45258
|
+
finallyLabel.antecedent = concatenate(concatenate(normalExitLabel.antecedent, exceptionLabel.antecedent), returnLabel.antecedent);
|
|
45165
45259
|
currentFlow = finallyLabel;
|
|
45166
45260
|
bind(node.finallyBlock);
|
|
45167
45261
|
if (currentFlow.flags & 1 /* Unreachable */) {
|
|
45168
45262
|
currentFlow = unreachableFlow;
|
|
45169
45263
|
} else {
|
|
45170
|
-
if (currentReturnTarget && returnLabel.
|
|
45171
|
-
addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.
|
|
45264
|
+
if (currentReturnTarget && returnLabel.antecedent) {
|
|
45265
|
+
addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.antecedent, currentFlow));
|
|
45172
45266
|
}
|
|
45173
|
-
if (currentExceptionTarget && exceptionLabel.
|
|
45174
|
-
addAntecedent(currentExceptionTarget, createReduceLabel(finallyLabel, exceptionLabel.
|
|
45267
|
+
if (currentExceptionTarget && exceptionLabel.antecedent) {
|
|
45268
|
+
addAntecedent(currentExceptionTarget, createReduceLabel(finallyLabel, exceptionLabel.antecedent, currentFlow));
|
|
45175
45269
|
}
|
|
45176
|
-
currentFlow = normalExitLabel.
|
|
45270
|
+
currentFlow = normalExitLabel.antecedent ? createReduceLabel(finallyLabel, normalExitLabel.antecedent, currentFlow) : unreachableFlow;
|
|
45177
45271
|
}
|
|
45178
45272
|
} else {
|
|
45179
45273
|
currentFlow = finishFlowLabel(normalExitLabel);
|
|
@@ -45189,7 +45283,7 @@ function createBinder() {
|
|
|
45189
45283
|
bind(node.caseBlock);
|
|
45190
45284
|
addAntecedent(postSwitchLabel, currentFlow);
|
|
45191
45285
|
const hasDefault = forEach(node.caseBlock.clauses, (c) => c.kind === 297 /* DefaultClause */);
|
|
45192
|
-
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.
|
|
45286
|
+
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedent;
|
|
45193
45287
|
if (!hasDefault) {
|
|
45194
45288
|
addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));
|
|
45195
45289
|
}
|
|
@@ -45377,8 +45471,12 @@ function createBinder() {
|
|
|
45377
45471
|
if (isLogicalOrCoalescingBinaryOperator(operator) || isLogicalOrCoalescingAssignmentOperator(operator)) {
|
|
45378
45472
|
if (isTopLevelLogicalExpression(node)) {
|
|
45379
45473
|
const postExpressionLabel = createBranchLabel();
|
|
45474
|
+
const saveCurrentFlow = currentFlow;
|
|
45475
|
+
const saveHasFlowEffects = hasFlowEffects;
|
|
45476
|
+
hasFlowEffects = false;
|
|
45380
45477
|
bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel);
|
|
45381
|
-
currentFlow = finishFlowLabel(postExpressionLabel);
|
|
45478
|
+
currentFlow = hasFlowEffects ? finishFlowLabel(postExpressionLabel) : saveCurrentFlow;
|
|
45479
|
+
hasFlowEffects || (hasFlowEffects = saveHasFlowEffects);
|
|
45382
45480
|
} else {
|
|
45383
45481
|
bindLogicalLikeExpression(node, currentTrueTarget, currentFalseTarget);
|
|
45384
45482
|
}
|
|
@@ -45450,6 +45548,9 @@ function createBinder() {
|
|
|
45450
45548
|
const trueLabel = createBranchLabel();
|
|
45451
45549
|
const falseLabel = createBranchLabel();
|
|
45452
45550
|
const postExpressionLabel = createBranchLabel();
|
|
45551
|
+
const saveCurrentFlow = currentFlow;
|
|
45552
|
+
const saveHasFlowEffects = hasFlowEffects;
|
|
45553
|
+
hasFlowEffects = false;
|
|
45453
45554
|
bindCondition(node.condition, trueLabel, falseLabel);
|
|
45454
45555
|
currentFlow = finishFlowLabel(trueLabel);
|
|
45455
45556
|
bind(node.questionToken);
|
|
@@ -45459,7 +45560,8 @@ function createBinder() {
|
|
|
45459
45560
|
bind(node.colonToken);
|
|
45460
45561
|
bind(node.whenFalse);
|
|
45461
45562
|
addAntecedent(postExpressionLabel, currentFlow);
|
|
45462
|
-
currentFlow = finishFlowLabel(postExpressionLabel);
|
|
45563
|
+
currentFlow = hasFlowEffects ? finishFlowLabel(postExpressionLabel) : saveCurrentFlow;
|
|
45564
|
+
hasFlowEffects || (hasFlowEffects = saveHasFlowEffects);
|
|
45463
45565
|
}
|
|
45464
45566
|
function bindInitializedVariableFlow(node) {
|
|
45465
45567
|
const name = !isOmittedExpression(node) ? node.name : void 0;
|
|
@@ -45571,8 +45673,11 @@ function createBinder() {
|
|
|
45571
45673
|
function bindOptionalChainFlow(node) {
|
|
45572
45674
|
if (isTopLevelLogicalExpression(node)) {
|
|
45573
45675
|
const postExpressionLabel = createBranchLabel();
|
|
45676
|
+
const saveCurrentFlow = currentFlow;
|
|
45677
|
+
const saveHasFlowEffects = hasFlowEffects;
|
|
45574
45678
|
bindOptionalChain(node, postExpressionLabel, postExpressionLabel);
|
|
45575
|
-
currentFlow = finishFlowLabel(postExpressionLabel);
|
|
45679
|
+
currentFlow = hasFlowEffects ? finishFlowLabel(postExpressionLabel) : saveCurrentFlow;
|
|
45680
|
+
hasFlowEffects || (hasFlowEffects = saveHasFlowEffects);
|
|
45576
45681
|
} else {
|
|
45577
45682
|
bindOptionalChain(node, currentTrueTarget, currentFalseTarget);
|
|
45578
45683
|
}
|
|
@@ -45793,7 +45898,13 @@ function createBinder() {
|
|
|
45793
45898
|
const host = typeAlias.parent.parent;
|
|
45794
45899
|
container = getEnclosingContainer(host) || file;
|
|
45795
45900
|
blockScopeContainer = getEnclosingBlockScopeContainer(host) || file;
|
|
45796
|
-
currentFlow =
|
|
45901
|
+
currentFlow = createFlowNode(
|
|
45902
|
+
2 /* Start */,
|
|
45903
|
+
/*node*/
|
|
45904
|
+
void 0,
|
|
45905
|
+
/*antecedent*/
|
|
45906
|
+
void 0
|
|
45907
|
+
);
|
|
45797
45908
|
parent2 = typeAlias;
|
|
45798
45909
|
bind(typeAlias.typeExpression);
|
|
45799
45910
|
const declName = getNameOfDeclaration(typeAlias);
|
|
@@ -45863,7 +45974,13 @@ function createBinder() {
|
|
|
45863
45974
|
const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
|
|
45864
45975
|
container = enclosingContainer || file;
|
|
45865
45976
|
blockScopeContainer = enclosingBlockScopeContainer || file;
|
|
45866
|
-
currentFlow =
|
|
45977
|
+
currentFlow = createFlowNode(
|
|
45978
|
+
2 /* Start */,
|
|
45979
|
+
/*node*/
|
|
45980
|
+
void 0,
|
|
45981
|
+
/*antecedent*/
|
|
45982
|
+
void 0
|
|
45983
|
+
);
|
|
45867
45984
|
parent2 = jsDocImportTag;
|
|
45868
45985
|
bind(jsDocImportTag.importClause);
|
|
45869
45986
|
}
|
|
@@ -52616,7 +52733,7 @@ function createTypeChecker(host) {
|
|
|
52616
52733
|
}
|
|
52617
52734
|
function getMeaningOfEntityNameReference(entityName) {
|
|
52618
52735
|
let meaning;
|
|
52619
|
-
if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
|
|
52736
|
+
if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName) {
|
|
52620
52737
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
52621
52738
|
} else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
|
|
52622
52739
|
meaning = 1920 /* Namespace */;
|
|
@@ -54792,7 +54909,28 @@ function createTypeChecker(host) {
|
|
|
54792
54909
|
return { introducesError, node };
|
|
54793
54910
|
}
|
|
54794
54911
|
const meaning = getMeaningOfEntityNameReference(node);
|
|
54795
|
-
|
|
54912
|
+
let sym;
|
|
54913
|
+
if (isThisIdentifier(leftmost)) {
|
|
54914
|
+
sym = getSymbolOfDeclaration(getThisContainer(
|
|
54915
|
+
leftmost,
|
|
54916
|
+
/*includeArrowFunctions*/
|
|
54917
|
+
false,
|
|
54918
|
+
/*includeClassComputedPropertyName*/
|
|
54919
|
+
false
|
|
54920
|
+
));
|
|
54921
|
+
if (isSymbolAccessible(
|
|
54922
|
+
sym,
|
|
54923
|
+
leftmost,
|
|
54924
|
+
meaning,
|
|
54925
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
54926
|
+
false
|
|
54927
|
+
).accessibility !== 0 /* Accessible */) {
|
|
54928
|
+
introducesError = true;
|
|
54929
|
+
context.tracker.reportInaccessibleThisError();
|
|
54930
|
+
}
|
|
54931
|
+
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
54932
|
+
}
|
|
54933
|
+
sym = resolveEntityName(
|
|
54796
54934
|
leftmost,
|
|
54797
54935
|
meaning,
|
|
54798
54936
|
/*ignoreErrors*/
|
|
@@ -54801,27 +54939,44 @@ function createTypeChecker(host) {
|
|
|
54801
54939
|
true
|
|
54802
54940
|
);
|
|
54803
54941
|
if (sym) {
|
|
54804
|
-
if (
|
|
54942
|
+
if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
|
|
54943
|
+
if (isParameterDeclaration(sym.valueDeclaration)) {
|
|
54944
|
+
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
54945
|
+
}
|
|
54946
|
+
}
|
|
54947
|
+
if (!(sym.flags & 262144 /* TypeParameter */) && // Type parameters are visible in the curent context if they are are resolvable
|
|
54948
|
+
!isDeclarationName(node) && isSymbolAccessible(
|
|
54805
54949
|
sym,
|
|
54806
54950
|
context.enclosingDeclaration,
|
|
54807
54951
|
meaning,
|
|
54808
54952
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54809
54953
|
false
|
|
54810
54954
|
).accessibility !== 0 /* Accessible */) {
|
|
54811
|
-
|
|
54812
|
-
introducesError = true;
|
|
54813
|
-
}
|
|
54955
|
+
introducesError = true;
|
|
54814
54956
|
} else {
|
|
54815
54957
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
54816
54958
|
}
|
|
54817
|
-
|
|
54959
|
+
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
54960
|
+
}
|
|
54961
|
+
return { introducesError, node };
|
|
54962
|
+
function attachSymbolToLeftmostIdentifier(node2) {
|
|
54963
|
+
if (node2 === leftmost) {
|
|
54818
54964
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
54819
|
-
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(
|
|
54965
|
+
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
|
|
54820
54966
|
name.symbol = sym;
|
|
54821
|
-
return
|
|
54967
|
+
return setTextRange(setEmitFlags(setOriginalNode(name, node2), 16777216 /* NoAsciiEscaping */), node2);
|
|
54822
54968
|
}
|
|
54969
|
+
const updated = visitEachChild(
|
|
54970
|
+
node2,
|
|
54971
|
+
(c) => attachSymbolToLeftmostIdentifier(c),
|
|
54972
|
+
/*context*/
|
|
54973
|
+
void 0
|
|
54974
|
+
);
|
|
54975
|
+
if (updated !== node2) {
|
|
54976
|
+
setTextRange(updated, node2);
|
|
54977
|
+
}
|
|
54978
|
+
return updated;
|
|
54823
54979
|
}
|
|
54824
|
-
return { introducesError, node };
|
|
54825
54980
|
}
|
|
54826
54981
|
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
54827
54982
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
@@ -54982,11 +55137,12 @@ function createTypeChecker(host) {
|
|
|
54982
55137
|
return visited;
|
|
54983
55138
|
}
|
|
54984
55139
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
55140
|
+
if (isDeclarationName(node)) {
|
|
55141
|
+
return node;
|
|
55142
|
+
}
|
|
54985
55143
|
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
54986
55144
|
hadError = hadError || introducesError;
|
|
54987
|
-
|
|
54988
|
-
return result;
|
|
54989
|
-
}
|
|
55145
|
+
return result;
|
|
54990
55146
|
}
|
|
54991
55147
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
54992
55148
|
const visited = visitEachChild(
|
|
@@ -57156,6 +57312,9 @@ function createTypeChecker(host) {
|
|
|
57156
57312
|
}
|
|
57157
57313
|
}
|
|
57158
57314
|
if (isParameter(declaration)) {
|
|
57315
|
+
if (!declaration.symbol) {
|
|
57316
|
+
return;
|
|
57317
|
+
}
|
|
57159
57318
|
const func = declaration.parent;
|
|
57160
57319
|
if (func.kind === 178 /* SetAccessor */ && hasBindableName(func)) {
|
|
57161
57320
|
const getter = getDeclarationOfKind(getSymbolOfDeclaration(declaration.parent), 177 /* GetAccessor */);
|
|
@@ -58515,7 +58674,7 @@ function createTypeChecker(host) {
|
|
|
58515
58674
|
for (const member of declaration.members) {
|
|
58516
58675
|
if (hasBindableName(member)) {
|
|
58517
58676
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
58518
|
-
const value = getEnumMemberValue(member);
|
|
58677
|
+
const value = getEnumMemberValue(member).value;
|
|
58519
58678
|
const memberType = getFreshTypeOfLiteralType(
|
|
58520
58679
|
value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol)
|
|
58521
58680
|
);
|
|
@@ -65651,8 +65810,8 @@ function createTypeChecker(host) {
|
|
|
65651
65810
|
}
|
|
65652
65811
|
return false;
|
|
65653
65812
|
}
|
|
65654
|
-
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
|
|
65655
|
-
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
|
|
65813
|
+
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */)).value;
|
|
65814
|
+
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */)).value;
|
|
65656
65815
|
if (sourceValue !== targetValue) {
|
|
65657
65816
|
const sourceIsString = typeof sourceValue === "string";
|
|
65658
65817
|
const targetIsString = typeof targetValue === "string";
|
|
@@ -70534,7 +70693,7 @@ function createTypeChecker(host) {
|
|
|
70534
70693
|
return false;
|
|
70535
70694
|
}
|
|
70536
70695
|
function getFlowNodeId(flow) {
|
|
70537
|
-
if (
|
|
70696
|
+
if (flow.id <= 0) {
|
|
70538
70697
|
flow.id = nextFlowId;
|
|
70539
70698
|
nextFlowId++;
|
|
70540
70699
|
}
|
|
@@ -71169,33 +71328,34 @@ function createTypeChecker(host) {
|
|
|
71169
71328
|
}
|
|
71170
71329
|
flow = flow.antecedent;
|
|
71171
71330
|
} else if (flags & 4 /* BranchLabel */) {
|
|
71172
|
-
return some(flow.
|
|
71331
|
+
return some(flow.antecedent, (f) => isReachableFlowNodeWorker(
|
|
71173
71332
|
f,
|
|
71174
71333
|
/*noCacheCheck*/
|
|
71175
71334
|
false
|
|
71176
71335
|
));
|
|
71177
71336
|
} else if (flags & 8 /* LoopLabel */) {
|
|
71178
|
-
const antecedents = flow.
|
|
71337
|
+
const antecedents = flow.antecedent;
|
|
71179
71338
|
if (antecedents === void 0 || antecedents.length === 0) {
|
|
71180
71339
|
return false;
|
|
71181
71340
|
}
|
|
71182
71341
|
flow = antecedents[0];
|
|
71183
71342
|
} else if (flags & 128 /* SwitchClause */) {
|
|
71184
|
-
|
|
71343
|
+
const data = flow.node;
|
|
71344
|
+
if (data.clauseStart === data.clauseEnd && isExhaustiveSwitchStatement(data.switchStatement)) {
|
|
71185
71345
|
return false;
|
|
71186
71346
|
}
|
|
71187
71347
|
flow = flow.antecedent;
|
|
71188
71348
|
} else if (flags & 1024 /* ReduceLabel */) {
|
|
71189
71349
|
lastFlowNode = void 0;
|
|
71190
|
-
const target = flow.target;
|
|
71191
|
-
const saveAntecedents = target.
|
|
71192
|
-
target.
|
|
71350
|
+
const target = flow.node.target;
|
|
71351
|
+
const saveAntecedents = target.antecedent;
|
|
71352
|
+
target.antecedent = flow.node.antecedents;
|
|
71193
71353
|
const result = isReachableFlowNodeWorker(
|
|
71194
71354
|
flow.antecedent,
|
|
71195
71355
|
/*noCacheCheck*/
|
|
71196
71356
|
false
|
|
71197
71357
|
);
|
|
71198
|
-
target.
|
|
71358
|
+
target.antecedent = saveAntecedents;
|
|
71199
71359
|
return result;
|
|
71200
71360
|
} else {
|
|
71201
71361
|
return !(flags & 1 /* Unreachable */);
|
|
@@ -71225,23 +71385,23 @@ function createTypeChecker(host) {
|
|
|
71225
71385
|
}
|
|
71226
71386
|
flow = flow.antecedent;
|
|
71227
71387
|
} else if (flags & 4 /* BranchLabel */) {
|
|
71228
|
-
return every(flow.
|
|
71388
|
+
return every(flow.antecedent, (f) => isPostSuperFlowNode(
|
|
71229
71389
|
f,
|
|
71230
71390
|
/*noCacheCheck*/
|
|
71231
71391
|
false
|
|
71232
71392
|
));
|
|
71233
71393
|
} else if (flags & 8 /* LoopLabel */) {
|
|
71234
|
-
flow = flow.
|
|
71394
|
+
flow = flow.antecedent[0];
|
|
71235
71395
|
} else if (flags & 1024 /* ReduceLabel */) {
|
|
71236
|
-
const target = flow.target;
|
|
71237
|
-
const saveAntecedents = target.
|
|
71238
|
-
target.
|
|
71396
|
+
const target = flow.node.target;
|
|
71397
|
+
const saveAntecedents = target.antecedent;
|
|
71398
|
+
target.antecedent = flow.node.antecedents;
|
|
71239
71399
|
const result = isPostSuperFlowNode(
|
|
71240
71400
|
flow.antecedent,
|
|
71241
71401
|
/*noCacheCheck*/
|
|
71242
71402
|
false
|
|
71243
71403
|
);
|
|
71244
|
-
target.
|
|
71404
|
+
target.antecedent = saveAntecedents;
|
|
71245
71405
|
return result;
|
|
71246
71406
|
} else {
|
|
71247
71407
|
return !!(flags & 1 /* Unreachable */);
|
|
@@ -71333,8 +71493,8 @@ function createTypeChecker(host) {
|
|
|
71333
71493
|
} else if (flags & 128 /* SwitchClause */) {
|
|
71334
71494
|
type = getTypeAtSwitchClause(flow);
|
|
71335
71495
|
} else if (flags & 12 /* Label */) {
|
|
71336
|
-
if (flow.
|
|
71337
|
-
flow = flow.
|
|
71496
|
+
if (flow.antecedent.length === 1) {
|
|
71497
|
+
flow = flow.antecedent[0];
|
|
71338
71498
|
continue;
|
|
71339
71499
|
}
|
|
71340
71500
|
type = flags & 4 /* BranchLabel */ ? getTypeAtFlowBranchLabel(flow) : getTypeAtFlowLoopLabel(flow);
|
|
@@ -71345,11 +71505,11 @@ function createTypeChecker(host) {
|
|
|
71345
71505
|
continue;
|
|
71346
71506
|
}
|
|
71347
71507
|
} else if (flags & 1024 /* ReduceLabel */) {
|
|
71348
|
-
const target = flow.target;
|
|
71349
|
-
const saveAntecedents = target.
|
|
71350
|
-
target.
|
|
71508
|
+
const target = flow.node.target;
|
|
71509
|
+
const saveAntecedents = target.antecedent;
|
|
71510
|
+
target.antecedent = flow.node.antecedents;
|
|
71351
71511
|
type = getTypeAtFlowNode(flow.antecedent);
|
|
71352
|
-
target.
|
|
71512
|
+
target.antecedent = saveAntecedents;
|
|
71353
71513
|
} else if (flags & 2 /* Start */) {
|
|
71354
71514
|
const container = flow.node;
|
|
71355
71515
|
if (container && container !== flowContainer && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
|
|
@@ -71503,26 +71663,26 @@ function createTypeChecker(host) {
|
|
|
71503
71663
|
return createFlowType(narrowedType, isIncomplete(flowType));
|
|
71504
71664
|
}
|
|
71505
71665
|
function getTypeAtSwitchClause(flow) {
|
|
71506
|
-
const expr = skipParentheses(flow.switchStatement.expression);
|
|
71666
|
+
const expr = skipParentheses(flow.node.switchStatement.expression);
|
|
71507
71667
|
const flowType = getTypeAtFlowNode(flow.antecedent);
|
|
71508
71668
|
let type = getTypeFromFlowType(flowType);
|
|
71509
71669
|
if (isMatchingReference(reference, expr)) {
|
|
71510
|
-
type = narrowTypeBySwitchOnDiscriminant(type, flow.
|
|
71670
|
+
type = narrowTypeBySwitchOnDiscriminant(type, flow.node);
|
|
71511
71671
|
} else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
|
|
71512
|
-
type = narrowTypeBySwitchOnTypeOf(type, flow.
|
|
71672
|
+
type = narrowTypeBySwitchOnTypeOf(type, flow.node);
|
|
71513
71673
|
} else if (expr.kind === 112 /* TrueKeyword */) {
|
|
71514
|
-
type = narrowTypeBySwitchOnTrue(type, flow.
|
|
71674
|
+
type = narrowTypeBySwitchOnTrue(type, flow.node);
|
|
71515
71675
|
} else {
|
|
71516
71676
|
if (strictNullChecks) {
|
|
71517
71677
|
if (optionalChainContainsReference(expr, reference)) {
|
|
71518
|
-
type = narrowTypeBySwitchOptionalChainContainment(type, flow.
|
|
71678
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)));
|
|
71519
71679
|
} else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) {
|
|
71520
|
-
type = narrowTypeBySwitchOptionalChainContainment(type, flow.
|
|
71680
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined"));
|
|
71521
71681
|
}
|
|
71522
71682
|
}
|
|
71523
71683
|
const access = getDiscriminantPropertyAccess(expr, type);
|
|
71524
71684
|
if (access) {
|
|
71525
|
-
type = narrowTypeBySwitchOnDiscriminantProperty(type, access, flow.
|
|
71685
|
+
type = narrowTypeBySwitchOnDiscriminantProperty(type, access, flow.node);
|
|
71526
71686
|
}
|
|
71527
71687
|
}
|
|
71528
71688
|
return createFlowType(type, isIncomplete(flowType));
|
|
@@ -71532,8 +71692,8 @@ function createTypeChecker(host) {
|
|
|
71532
71692
|
let subtypeReduction = false;
|
|
71533
71693
|
let seenIncomplete = false;
|
|
71534
71694
|
let bypassFlow;
|
|
71535
|
-
for (const antecedent of flow.
|
|
71536
|
-
if (!bypassFlow && antecedent.flags & 128 /* SwitchClause */ && antecedent.clauseStart === antecedent.clauseEnd) {
|
|
71695
|
+
for (const antecedent of flow.antecedent) {
|
|
71696
|
+
if (!bypassFlow && antecedent.flags & 128 /* SwitchClause */ && antecedent.node.clauseStart === antecedent.node.clauseEnd) {
|
|
71537
71697
|
bypassFlow = antecedent;
|
|
71538
71698
|
continue;
|
|
71539
71699
|
}
|
|
@@ -71553,7 +71713,7 @@ function createTypeChecker(host) {
|
|
|
71553
71713
|
if (bypassFlow) {
|
|
71554
71714
|
const flowType = getTypeAtFlowNode(bypassFlow);
|
|
71555
71715
|
const type = getTypeFromFlowType(flowType);
|
|
71556
|
-
if (!(type.flags & 131072 /* Never */) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) {
|
|
71716
|
+
if (!(type.flags & 131072 /* Never */) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.node.switchStatement)) {
|
|
71557
71717
|
if (type === declaredType && declaredType === initialType) {
|
|
71558
71718
|
return type;
|
|
71559
71719
|
}
|
|
@@ -71591,7 +71751,7 @@ function createTypeChecker(host) {
|
|
|
71591
71751
|
const antecedentTypes = [];
|
|
71592
71752
|
let subtypeReduction = false;
|
|
71593
71753
|
let firstAntecedentType;
|
|
71594
|
-
for (const antecedent of flow.
|
|
71754
|
+
for (const antecedent of flow.antecedent) {
|
|
71595
71755
|
let flowType;
|
|
71596
71756
|
if (!firstAntecedentType) {
|
|
71597
71757
|
flowType = firstAntecedentType = getTypeAtFlowNode(antecedent);
|
|
@@ -71715,15 +71875,15 @@ function createTypeChecker(host) {
|
|
|
71715
71875
|
}
|
|
71716
71876
|
return narrowTypeByDiscriminant(type, access, (t) => narrowTypeByEquality(t, operator, value, assumeTrue));
|
|
71717
71877
|
}
|
|
71718
|
-
function narrowTypeBySwitchOnDiscriminantProperty(type, access,
|
|
71719
|
-
if (clauseStart < clauseEnd && type.flags & 1048576 /* Union */ && getKeyPropertyName(type) === getAccessedPropertyName(access)) {
|
|
71720
|
-
const clauseTypes = getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd);
|
|
71878
|
+
function narrowTypeBySwitchOnDiscriminantProperty(type, access, data) {
|
|
71879
|
+
if (data.clauseStart < data.clauseEnd && type.flags & 1048576 /* Union */ && getKeyPropertyName(type) === getAccessedPropertyName(access)) {
|
|
71880
|
+
const clauseTypes = getSwitchClauseTypes(data.switchStatement).slice(data.clauseStart, data.clauseEnd);
|
|
71721
71881
|
const candidate = getUnionType(map(clauseTypes, (t) => getConstituentTypeForKeyType(type, t) || unknownType));
|
|
71722
71882
|
if (candidate !== unknownType) {
|
|
71723
71883
|
return candidate;
|
|
71724
71884
|
}
|
|
71725
71885
|
}
|
|
71726
|
-
return narrowTypeByDiscriminant(type, access, (t) => narrowTypeBySwitchOnDiscriminant(t,
|
|
71886
|
+
return narrowTypeByDiscriminant(type, access, (t) => narrowTypeBySwitchOnDiscriminant(t, data));
|
|
71727
71887
|
}
|
|
71728
71888
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
71729
71889
|
if (isMatchingReference(reference, expr)) {
|
|
@@ -71968,11 +72128,11 @@ function createTypeChecker(host) {
|
|
|
71968
72128
|
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
|
|
71969
72129
|
return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getAdjustedTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
|
|
71970
72130
|
}
|
|
71971
|
-
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
|
|
72131
|
+
function narrowTypeBySwitchOptionalChainContainment(type, { switchStatement, clauseStart, clauseEnd }, clauseCheck) {
|
|
71972
72132
|
const everyClauseChecks = clauseStart !== clauseEnd && every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
|
|
71973
72133
|
return everyClauseChecks ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
71974
72134
|
}
|
|
71975
|
-
function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) {
|
|
72135
|
+
function narrowTypeBySwitchOnDiscriminant(type, { switchStatement, clauseStart, clauseEnd }) {
|
|
71976
72136
|
const switchTypes = getSwitchClauseTypes(switchStatement);
|
|
71977
72137
|
if (!switchTypes.length) {
|
|
71978
72138
|
return type;
|
|
@@ -72045,7 +72205,7 @@ function createTypeChecker(host) {
|
|
|
72045
72205
|
)
|
|
72046
72206
|
));
|
|
72047
72207
|
}
|
|
72048
|
-
function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
72208
|
+
function narrowTypeBySwitchOnTypeOf(type, { switchStatement, clauseStart, clauseEnd }) {
|
|
72049
72209
|
const witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
|
|
72050
72210
|
if (!witnesses) {
|
|
72051
72211
|
return type;
|
|
@@ -72059,7 +72219,7 @@ function createTypeChecker(host) {
|
|
|
72059
72219
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
72060
72220
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
72061
72221
|
}
|
|
72062
|
-
function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
|
|
72222
|
+
function narrowTypeBySwitchOnTrue(type, { switchStatement, clauseStart, clauseEnd }) {
|
|
72063
72223
|
const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
|
|
72064
72224
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
72065
72225
|
for (let i = 0; i < clauseStart; i++) {
|
|
@@ -79353,20 +79513,18 @@ function createTypeChecker(host) {
|
|
|
79353
79513
|
});
|
|
79354
79514
|
}
|
|
79355
79515
|
function checkIfExpressionRefinesParameter(func, expr, param, initType) {
|
|
79356
|
-
const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode ||
|
|
79357
|
-
|
|
79358
|
-
|
|
79359
|
-
|
|
79360
|
-
|
|
79361
|
-
|
|
79516
|
+
const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || createFlowNode(
|
|
79517
|
+
2 /* Start */,
|
|
79518
|
+
/*node*/
|
|
79519
|
+
void 0,
|
|
79520
|
+
/*antecedent*/
|
|
79521
|
+
void 0
|
|
79522
|
+
);
|
|
79523
|
+
const trueCondition = createFlowNode(32 /* TrueCondition */, expr, antecedent);
|
|
79362
79524
|
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
79363
79525
|
if (trueType2 === initType)
|
|
79364
79526
|
return void 0;
|
|
79365
|
-
const falseCondition =
|
|
79366
|
-
flags: 64 /* FalseCondition */,
|
|
79367
|
-
antecedent,
|
|
79368
|
-
node: expr
|
|
79369
|
-
};
|
|
79527
|
+
const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent);
|
|
79370
79528
|
const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
|
|
79371
79529
|
return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
|
|
79372
79530
|
}
|
|
@@ -80760,7 +80918,7 @@ function createTypeChecker(host) {
|
|
|
80760
80918
|
) || unknownType, isTemplateLiteralContextualType)) {
|
|
80761
80919
|
return getTemplateLiteralType(texts, types);
|
|
80762
80920
|
}
|
|
80763
|
-
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
|
|
80921
|
+
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node).value;
|
|
80764
80922
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
80765
80923
|
}
|
|
80766
80924
|
function isTemplateLiteralContextualType(type) {
|
|
@@ -85665,14 +85823,14 @@ function createTypeChecker(host) {
|
|
|
85665
85823
|
let autoValue = 0;
|
|
85666
85824
|
let previous;
|
|
85667
85825
|
for (const member of node.members) {
|
|
85668
|
-
const
|
|
85669
|
-
getNodeLinks(member).enumMemberValue =
|
|
85670
|
-
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
85826
|
+
const result = computeEnumMemberValue(member, autoValue, previous);
|
|
85827
|
+
getNodeLinks(member).enumMemberValue = result;
|
|
85828
|
+
autoValue = typeof result.value === "number" ? result.value + 1 : void 0;
|
|
85671
85829
|
previous = member;
|
|
85672
85830
|
}
|
|
85673
85831
|
}
|
|
85674
85832
|
}
|
|
85675
|
-
function
|
|
85833
|
+
function computeEnumMemberValue(member, autoValue, previous) {
|
|
85676
85834
|
if (isComputedNonLiteralName(member.name)) {
|
|
85677
85835
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
85678
85836
|
} else {
|
|
@@ -85682,34 +85840,43 @@ function createTypeChecker(host) {
|
|
|
85682
85840
|
}
|
|
85683
85841
|
}
|
|
85684
85842
|
if (member.initializer) {
|
|
85685
|
-
return
|
|
85843
|
+
return computeConstantEnumMemberValue(member);
|
|
85686
85844
|
}
|
|
85687
85845
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
85688
|
-
return
|
|
85846
|
+
return evaluatorResult(
|
|
85847
|
+
/*value*/
|
|
85848
|
+
void 0
|
|
85849
|
+
);
|
|
85689
85850
|
}
|
|
85690
85851
|
if (autoValue === void 0) {
|
|
85691
85852
|
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
85692
|
-
return
|
|
85693
|
-
|
|
85694
|
-
|
|
85695
|
-
error2(
|
|
85696
|
-
member.name,
|
|
85697
|
-
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
85853
|
+
return evaluatorResult(
|
|
85854
|
+
/*value*/
|
|
85855
|
+
void 0
|
|
85698
85856
|
);
|
|
85699
85857
|
}
|
|
85700
|
-
|
|
85858
|
+
if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer)) {
|
|
85859
|
+
const prevValue = getEnumMemberValue(previous);
|
|
85860
|
+
if (!(typeof prevValue.value === "number" && !prevValue.resolvedOtherFiles)) {
|
|
85861
|
+
error2(
|
|
85862
|
+
member.name,
|
|
85863
|
+
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
85864
|
+
);
|
|
85865
|
+
}
|
|
85866
|
+
}
|
|
85867
|
+
return evaluatorResult(autoValue);
|
|
85701
85868
|
}
|
|
85702
|
-
function
|
|
85869
|
+
function computeConstantEnumMemberValue(member) {
|
|
85703
85870
|
const isConstEnum = isEnumConst(member.parent);
|
|
85704
85871
|
const initializer = member.initializer;
|
|
85705
|
-
const
|
|
85706
|
-
if (value !== void 0) {
|
|
85707
|
-
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
85872
|
+
const result = evaluate(initializer, member);
|
|
85873
|
+
if (result.value !== void 0) {
|
|
85874
|
+
if (isConstEnum && typeof result.value === "number" && !isFinite(result.value)) {
|
|
85708
85875
|
error2(
|
|
85709
85876
|
initializer,
|
|
85710
|
-
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
85877
|
+
isNaN(result.value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
85711
85878
|
);
|
|
85712
|
-
} else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString
|
|
85879
|
+
} else if (getIsolatedModules(compilerOptions) && typeof result.value === "string" && !result.isSyntacticallyString) {
|
|
85713
85880
|
error2(
|
|
85714
85881
|
initializer,
|
|
85715
85882
|
Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
|
|
@@ -85723,19 +85890,7 @@ function createTypeChecker(host) {
|
|
|
85723
85890
|
} else {
|
|
85724
85891
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
85725
85892
|
}
|
|
85726
|
-
return
|
|
85727
|
-
}
|
|
85728
|
-
function isSyntacticallyNumericConstant(expr) {
|
|
85729
|
-
expr = skipOuterExpressions(expr);
|
|
85730
|
-
switch (expr.kind) {
|
|
85731
|
-
case 224 /* PrefixUnaryExpression */:
|
|
85732
|
-
return isSyntacticallyNumericConstant(expr.operand);
|
|
85733
|
-
case 226 /* BinaryExpression */:
|
|
85734
|
-
return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
|
|
85735
|
-
case 9 /* NumericLiteral */:
|
|
85736
|
-
return true;
|
|
85737
|
-
}
|
|
85738
|
-
return false;
|
|
85893
|
+
return result;
|
|
85739
85894
|
}
|
|
85740
85895
|
function evaluateEntityNameExpression(expr, location) {
|
|
85741
85896
|
const symbol = resolveEntityName(
|
|
@@ -85745,7 +85900,10 @@ function createTypeChecker(host) {
|
|
|
85745
85900
|
true
|
|
85746
85901
|
);
|
|
85747
85902
|
if (!symbol)
|
|
85748
|
-
return
|
|
85903
|
+
return evaluatorResult(
|
|
85904
|
+
/*value*/
|
|
85905
|
+
void 0
|
|
85906
|
+
);
|
|
85749
85907
|
if (expr.kind === 80 /* Identifier */) {
|
|
85750
85908
|
const identifier = expr;
|
|
85751
85909
|
if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
|
|
@@ -85754,7 +85912,11 @@ function createTypeChecker(host) {
|
|
|
85754
85912
|
/*diagnostic*/
|
|
85755
85913
|
void 0
|
|
85756
85914
|
)) {
|
|
85757
|
-
return
|
|
85915
|
+
return evaluatorResult(
|
|
85916
|
+
+identifier.escapedText,
|
|
85917
|
+
/*isSyntacticallyString*/
|
|
85918
|
+
false
|
|
85919
|
+
);
|
|
85758
85920
|
}
|
|
85759
85921
|
}
|
|
85760
85922
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
@@ -85763,9 +85925,23 @@ function createTypeChecker(host) {
|
|
|
85763
85925
|
if (isConstantVariable(symbol)) {
|
|
85764
85926
|
const declaration = symbol.valueDeclaration;
|
|
85765
85927
|
if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
85766
|
-
|
|
85928
|
+
const result = evaluate(declaration.initializer, declaration);
|
|
85929
|
+
if (location && getSourceFileOfNode(location) !== getSourceFileOfNode(declaration)) {
|
|
85930
|
+
return evaluatorResult(
|
|
85931
|
+
result.value,
|
|
85932
|
+
/*isSyntacticallyString*/
|
|
85933
|
+
false,
|
|
85934
|
+
/*resolvedOtherFiles*/
|
|
85935
|
+
true
|
|
85936
|
+
);
|
|
85937
|
+
}
|
|
85938
|
+
return result;
|
|
85767
85939
|
}
|
|
85768
85940
|
}
|
|
85941
|
+
return evaluatorResult(
|
|
85942
|
+
/*value*/
|
|
85943
|
+
void 0
|
|
85944
|
+
);
|
|
85769
85945
|
}
|
|
85770
85946
|
function evaluateElementAccessExpression(expr, location) {
|
|
85771
85947
|
const root = expr.expression;
|
|
@@ -85780,20 +85956,31 @@ function createTypeChecker(host) {
|
|
|
85780
85956
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
85781
85957
|
const member = rootSymbol.exports.get(name);
|
|
85782
85958
|
if (member) {
|
|
85959
|
+
Debug.assert(getSourceFileOfNode(member.valueDeclaration) === getSourceFileOfNode(rootSymbol.valueDeclaration));
|
|
85783
85960
|
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
85784
85961
|
}
|
|
85785
85962
|
}
|
|
85786
85963
|
}
|
|
85964
|
+
return evaluatorResult(
|
|
85965
|
+
/*value*/
|
|
85966
|
+
void 0
|
|
85967
|
+
);
|
|
85787
85968
|
}
|
|
85788
85969
|
function evaluateEnumMember(expr, symbol, location) {
|
|
85789
85970
|
const declaration = symbol.valueDeclaration;
|
|
85790
85971
|
if (!declaration || declaration === location) {
|
|
85791
85972
|
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
85792
|
-
return
|
|
85973
|
+
return evaluatorResult(
|
|
85974
|
+
/*value*/
|
|
85975
|
+
void 0
|
|
85976
|
+
);
|
|
85793
85977
|
}
|
|
85794
85978
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
85795
85979
|
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
85796
|
-
return
|
|
85980
|
+
return evaluatorResult(
|
|
85981
|
+
/*value*/
|
|
85982
|
+
0
|
|
85983
|
+
);
|
|
85797
85984
|
}
|
|
85798
85985
|
return getEnumMemberValue(declaration);
|
|
85799
85986
|
}
|
|
@@ -87934,7 +88121,10 @@ function createTypeChecker(host) {
|
|
|
87934
88121
|
}
|
|
87935
88122
|
function getEnumMemberValue(node) {
|
|
87936
88123
|
computeEnumMemberValues(node.parent);
|
|
87937
|
-
return getNodeLinks(node).enumMemberValue
|
|
88124
|
+
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
88125
|
+
/*value*/
|
|
88126
|
+
void 0
|
|
88127
|
+
);
|
|
87938
88128
|
}
|
|
87939
88129
|
function canHaveConstantValue(node) {
|
|
87940
88130
|
switch (node.kind) {
|
|
@@ -87947,13 +88137,13 @@ function createTypeChecker(host) {
|
|
|
87947
88137
|
}
|
|
87948
88138
|
function getConstantValue2(node) {
|
|
87949
88139
|
if (node.kind === 306 /* EnumMember */) {
|
|
87950
|
-
return getEnumMemberValue(node);
|
|
88140
|
+
return getEnumMemberValue(node).value;
|
|
87951
88141
|
}
|
|
87952
88142
|
const symbol = getNodeLinks(node).resolvedSymbol;
|
|
87953
88143
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
87954
88144
|
const member = symbol.valueDeclaration;
|
|
87955
88145
|
if (isEnumConst(member.parent)) {
|
|
87956
|
-
return getEnumMemberValue(member);
|
|
88146
|
+
return getEnumMemberValue(member).value;
|
|
87957
88147
|
}
|
|
87958
88148
|
}
|
|
87959
88149
|
return void 0;
|
|
@@ -88328,6 +88518,10 @@ function createTypeChecker(host) {
|
|
|
88328
88518
|
const node = getParseTreeNode(nodeIn, canHaveConstantValue);
|
|
88329
88519
|
return node ? getConstantValue2(node) : void 0;
|
|
88330
88520
|
},
|
|
88521
|
+
getEnumMemberValue: (nodeIn) => {
|
|
88522
|
+
const node = getParseTreeNode(nodeIn, isEnumMember);
|
|
88523
|
+
return node ? getEnumMemberValue(node) : void 0;
|
|
88524
|
+
},
|
|
88331
88525
|
collectLinkedAliases,
|
|
88332
88526
|
getReferencedValueDeclaration,
|
|
88333
88527
|
getReferencedValueDeclarations,
|
|
@@ -94733,7 +94927,8 @@ function transformTypeScript(context) {
|
|
|
94733
94927
|
/*generateNameForComputedPropertyName*/
|
|
94734
94928
|
false
|
|
94735
94929
|
);
|
|
94736
|
-
const
|
|
94930
|
+
const evaluated = resolver.getEnumMemberValue(member);
|
|
94931
|
+
const valueExpression = transformEnumMemberDeclarationValue(member, evaluated == null ? void 0 : evaluated.value);
|
|
94737
94932
|
const innerAssignment = factory2.createAssignment(
|
|
94738
94933
|
factory2.createElementAccessExpression(
|
|
94739
94934
|
currentNamespaceContainerName,
|
|
@@ -94741,7 +94936,7 @@ function transformTypeScript(context) {
|
|
|
94741
94936
|
),
|
|
94742
94937
|
valueExpression
|
|
94743
94938
|
);
|
|
94744
|
-
const outerAssignment =
|
|
94939
|
+
const outerAssignment = typeof (evaluated == null ? void 0 : evaluated.value) === "string" || (evaluated == null ? void 0 : evaluated.isSyntacticallyString) ? innerAssignment : factory2.createAssignment(
|
|
94745
94940
|
factory2.createElementAccessExpression(
|
|
94746
94941
|
currentNamespaceContainerName,
|
|
94747
94942
|
innerAssignment
|
|
@@ -94758,10 +94953,9 @@ function transformTypeScript(context) {
|
|
|
94758
94953
|
member
|
|
94759
94954
|
);
|
|
94760
94955
|
}
|
|
94761
|
-
function transformEnumMemberDeclarationValue(member) {
|
|
94762
|
-
|
|
94763
|
-
|
|
94764
|
-
return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-value)) : factory2.createNumericLiteral(value);
|
|
94956
|
+
function transformEnumMemberDeclarationValue(member, constantValue) {
|
|
94957
|
+
if (constantValue !== void 0) {
|
|
94958
|
+
return typeof constantValue === "string" ? factory2.createStringLiteral(constantValue) : constantValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-constantValue)) : factory2.createNumericLiteral(constantValue);
|
|
94765
94959
|
} else {
|
|
94766
94960
|
enableSubstitutionForNonQualifiedEnumMembers();
|
|
94767
94961
|
if (member.initializer) {
|
|
@@ -116112,6 +116306,7 @@ var notImplementedResolver = {
|
|
|
116112
116306
|
isEntityNameVisible: notImplemented,
|
|
116113
116307
|
// Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant
|
|
116114
116308
|
getConstantValue: notImplemented,
|
|
116309
|
+
getEnumMemberValue: notImplemented,
|
|
116115
116310
|
getReferencedValueDeclaration: notImplemented,
|
|
116116
116311
|
getReferencedValueDeclarations: notImplemented,
|
|
116117
116312
|
getTypeReferenceSerializationKind: notImplemented,
|
|
@@ -131131,6 +131326,1123 @@ function verboseReportProjectStatus(state, configFileName, status) {
|
|
|
131131
131326
|
}
|
|
131132
131327
|
}
|
|
131133
131328
|
|
|
131329
|
+
// src/compiler/executeCommandLine.ts
|
|
131330
|
+
var StatisticType = /* @__PURE__ */ ((StatisticType2) => {
|
|
131331
|
+
StatisticType2[StatisticType2["time"] = 0] = "time";
|
|
131332
|
+
StatisticType2[StatisticType2["count"] = 1] = "count";
|
|
131333
|
+
StatisticType2[StatisticType2["memory"] = 2] = "memory";
|
|
131334
|
+
return StatisticType2;
|
|
131335
|
+
})(StatisticType || {});
|
|
131336
|
+
function countLines(program) {
|
|
131337
|
+
const counts2 = getCountsMap();
|
|
131338
|
+
forEach(program.getSourceFiles(), (file) => {
|
|
131339
|
+
const key = getCountKey(program, file);
|
|
131340
|
+
const lineCount = getLineStarts(file).length;
|
|
131341
|
+
counts2.set(key, counts2.get(key) + lineCount);
|
|
131342
|
+
});
|
|
131343
|
+
return counts2;
|
|
131344
|
+
}
|
|
131345
|
+
function getCountsMap() {
|
|
131346
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
131347
|
+
counts2.set("Library", 0);
|
|
131348
|
+
counts2.set("Definitions", 0);
|
|
131349
|
+
counts2.set("TypeScript", 0);
|
|
131350
|
+
counts2.set("JavaScript", 0);
|
|
131351
|
+
counts2.set("JSON", 0);
|
|
131352
|
+
counts2.set("Other", 0);
|
|
131353
|
+
return counts2;
|
|
131354
|
+
}
|
|
131355
|
+
function getCountKey(program, file) {
|
|
131356
|
+
if (program.isSourceFileDefaultLibrary(file)) {
|
|
131357
|
+
return "Library";
|
|
131358
|
+
} else if (file.isDeclarationFile) {
|
|
131359
|
+
return "Definitions";
|
|
131360
|
+
}
|
|
131361
|
+
const path = file.path;
|
|
131362
|
+
if (fileExtensionIsOneOf(path, supportedTSExtensionsFlat)) {
|
|
131363
|
+
return "TypeScript";
|
|
131364
|
+
} else if (fileExtensionIsOneOf(path, supportedJSExtensionsFlat)) {
|
|
131365
|
+
return "JavaScript";
|
|
131366
|
+
} else if (fileExtensionIs(path, ".json" /* Json */)) {
|
|
131367
|
+
return "JSON";
|
|
131368
|
+
} else {
|
|
131369
|
+
return "Other";
|
|
131370
|
+
}
|
|
131371
|
+
}
|
|
131372
|
+
function updateReportDiagnostic(sys2, existing, options) {
|
|
131373
|
+
return shouldBePretty(sys2, options) ? createDiagnosticReporter(
|
|
131374
|
+
sys2,
|
|
131375
|
+
/*pretty*/
|
|
131376
|
+
true
|
|
131377
|
+
) : existing;
|
|
131378
|
+
}
|
|
131379
|
+
function defaultIsPretty(sys2) {
|
|
131380
|
+
return !!sys2.writeOutputIsTTY && sys2.writeOutputIsTTY() && !sys2.getEnvironmentVariable("NO_COLOR");
|
|
131381
|
+
}
|
|
131382
|
+
function shouldBePretty(sys2, options) {
|
|
131383
|
+
if (!options || typeof options.pretty === "undefined") {
|
|
131384
|
+
return defaultIsPretty(sys2);
|
|
131385
|
+
}
|
|
131386
|
+
return options.pretty;
|
|
131387
|
+
}
|
|
131388
|
+
function getOptionsForHelp(commandLine) {
|
|
131389
|
+
return !!commandLine.options.all ? sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
|
|
131390
|
+
}
|
|
131391
|
+
function printVersion(sys2) {
|
|
131392
|
+
sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine);
|
|
131393
|
+
}
|
|
131394
|
+
function createColors(sys2) {
|
|
131395
|
+
const showColors = defaultIsPretty(sys2);
|
|
131396
|
+
if (!showColors) {
|
|
131397
|
+
return {
|
|
131398
|
+
bold: (str) => str,
|
|
131399
|
+
blue: (str) => str,
|
|
131400
|
+
blueBackground: (str) => str,
|
|
131401
|
+
brightWhite: (str) => str
|
|
131402
|
+
};
|
|
131403
|
+
}
|
|
131404
|
+
function bold(str) {
|
|
131405
|
+
return `\x1B[1m${str}\x1B[22m`;
|
|
131406
|
+
}
|
|
131407
|
+
const isWindows = sys2.getEnvironmentVariable("OS") && sys2.getEnvironmentVariable("OS").toLowerCase().includes("windows");
|
|
131408
|
+
const isWindowsTerminal = sys2.getEnvironmentVariable("WT_SESSION");
|
|
131409
|
+
const isVSCode = sys2.getEnvironmentVariable("TERM_PROGRAM") && sys2.getEnvironmentVariable("TERM_PROGRAM") === "vscode";
|
|
131410
|
+
function blue(str) {
|
|
131411
|
+
if (isWindows && !isWindowsTerminal && !isVSCode) {
|
|
131412
|
+
return brightWhite(str);
|
|
131413
|
+
}
|
|
131414
|
+
return `\x1B[94m${str}\x1B[39m`;
|
|
131415
|
+
}
|
|
131416
|
+
const supportsRicherColors = sys2.getEnvironmentVariable("COLORTERM") === "truecolor" || sys2.getEnvironmentVariable("TERM") === "xterm-256color";
|
|
131417
|
+
function blueBackground(str) {
|
|
131418
|
+
if (supportsRicherColors) {
|
|
131419
|
+
return `\x1B[48;5;68m${str}\x1B[39;49m`;
|
|
131420
|
+
} else {
|
|
131421
|
+
return `\x1B[44m${str}\x1B[39;49m`;
|
|
131422
|
+
}
|
|
131423
|
+
}
|
|
131424
|
+
function brightWhite(str) {
|
|
131425
|
+
return `\x1B[97m${str}\x1B[39m`;
|
|
131426
|
+
}
|
|
131427
|
+
return {
|
|
131428
|
+
bold,
|
|
131429
|
+
blue,
|
|
131430
|
+
brightWhite,
|
|
131431
|
+
blueBackground
|
|
131432
|
+
};
|
|
131433
|
+
}
|
|
131434
|
+
function getDisplayNameTextOfOption(option) {
|
|
131435
|
+
return `--${option.name}${option.shortName ? `, -${option.shortName}` : ""}`;
|
|
131436
|
+
}
|
|
131437
|
+
function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight) {
|
|
131438
|
+
var _a;
|
|
131439
|
+
const text = [];
|
|
131440
|
+
const colors = createColors(sys2);
|
|
131441
|
+
const name = getDisplayNameTextOfOption(option);
|
|
131442
|
+
const valueCandidates = getValueCandidate(option);
|
|
131443
|
+
const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : formatDefaultValue(
|
|
131444
|
+
option.defaultValueDescription,
|
|
131445
|
+
option.type === "list" || option.type === "listOrElement" ? option.element.type : option.type
|
|
131446
|
+
);
|
|
131447
|
+
const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? void 0 : _a.call(sys2)) ?? 0;
|
|
131448
|
+
if (terminalWidth >= 80) {
|
|
131449
|
+
let description3 = "";
|
|
131450
|
+
if (option.description) {
|
|
131451
|
+
description3 = getDiagnosticText(option.description);
|
|
131452
|
+
}
|
|
131453
|
+
text.push(...getPrettyOutput(
|
|
131454
|
+
name,
|
|
131455
|
+
description3,
|
|
131456
|
+
rightAlignOfLeft,
|
|
131457
|
+
leftAlignOfRight,
|
|
131458
|
+
terminalWidth,
|
|
131459
|
+
/*colorLeft*/
|
|
131460
|
+
true
|
|
131461
|
+
), sys2.newLine);
|
|
131462
|
+
if (showAdditionalInfoOutput(valueCandidates, option)) {
|
|
131463
|
+
if (valueCandidates) {
|
|
131464
|
+
text.push(...getPrettyOutput(
|
|
131465
|
+
valueCandidates.valueType,
|
|
131466
|
+
valueCandidates.possibleValues,
|
|
131467
|
+
rightAlignOfLeft,
|
|
131468
|
+
leftAlignOfRight,
|
|
131469
|
+
terminalWidth,
|
|
131470
|
+
/*colorLeft*/
|
|
131471
|
+
false
|
|
131472
|
+
), sys2.newLine);
|
|
131473
|
+
}
|
|
131474
|
+
if (defaultValueDescription) {
|
|
131475
|
+
text.push(...getPrettyOutput(
|
|
131476
|
+
getDiagnosticText(Diagnostics.default_Colon),
|
|
131477
|
+
defaultValueDescription,
|
|
131478
|
+
rightAlignOfLeft,
|
|
131479
|
+
leftAlignOfRight,
|
|
131480
|
+
terminalWidth,
|
|
131481
|
+
/*colorLeft*/
|
|
131482
|
+
false
|
|
131483
|
+
), sys2.newLine);
|
|
131484
|
+
}
|
|
131485
|
+
}
|
|
131486
|
+
text.push(sys2.newLine);
|
|
131487
|
+
} else {
|
|
131488
|
+
text.push(colors.blue(name), sys2.newLine);
|
|
131489
|
+
if (option.description) {
|
|
131490
|
+
const description3 = getDiagnosticText(option.description);
|
|
131491
|
+
text.push(description3);
|
|
131492
|
+
}
|
|
131493
|
+
text.push(sys2.newLine);
|
|
131494
|
+
if (showAdditionalInfoOutput(valueCandidates, option)) {
|
|
131495
|
+
if (valueCandidates) {
|
|
131496
|
+
text.push(`${valueCandidates.valueType} ${valueCandidates.possibleValues}`);
|
|
131497
|
+
}
|
|
131498
|
+
if (defaultValueDescription) {
|
|
131499
|
+
if (valueCandidates)
|
|
131500
|
+
text.push(sys2.newLine);
|
|
131501
|
+
const diagType = getDiagnosticText(Diagnostics.default_Colon);
|
|
131502
|
+
text.push(`${diagType} ${defaultValueDescription}`);
|
|
131503
|
+
}
|
|
131504
|
+
text.push(sys2.newLine);
|
|
131505
|
+
}
|
|
131506
|
+
text.push(sys2.newLine);
|
|
131507
|
+
}
|
|
131508
|
+
return text;
|
|
131509
|
+
function formatDefaultValue(defaultValue, type) {
|
|
131510
|
+
return defaultValue !== void 0 && typeof type === "object" ? arrayFrom(type.entries()).filter(([, value]) => value === defaultValue).map(([name2]) => name2).join("/") : String(defaultValue);
|
|
131511
|
+
}
|
|
131512
|
+
function showAdditionalInfoOutput(valueCandidates2, option2) {
|
|
131513
|
+
const ignoreValues = ["string"];
|
|
131514
|
+
const ignoredDescriptions = [void 0, "false", "n/a"];
|
|
131515
|
+
const defaultValueDescription2 = option2.defaultValueDescription;
|
|
131516
|
+
if (option2.category === Diagnostics.Command_line_Options)
|
|
131517
|
+
return false;
|
|
131518
|
+
if (contains(ignoreValues, valueCandidates2 == null ? void 0 : valueCandidates2.possibleValues) && contains(ignoredDescriptions, defaultValueDescription2)) {
|
|
131519
|
+
return false;
|
|
131520
|
+
}
|
|
131521
|
+
return true;
|
|
131522
|
+
}
|
|
131523
|
+
function getPrettyOutput(left, right, rightAlignOfLeft2, leftAlignOfRight2, terminalWidth2, colorLeft) {
|
|
131524
|
+
const res = [];
|
|
131525
|
+
let isFirstLine = true;
|
|
131526
|
+
let remainRight = right;
|
|
131527
|
+
const rightCharacterNumber = terminalWidth2 - leftAlignOfRight2;
|
|
131528
|
+
while (remainRight.length > 0) {
|
|
131529
|
+
let curLeft = "";
|
|
131530
|
+
if (isFirstLine) {
|
|
131531
|
+
curLeft = left.padStart(rightAlignOfLeft2);
|
|
131532
|
+
curLeft = curLeft.padEnd(leftAlignOfRight2);
|
|
131533
|
+
curLeft = colorLeft ? colors.blue(curLeft) : curLeft;
|
|
131534
|
+
} else {
|
|
131535
|
+
curLeft = "".padStart(leftAlignOfRight2);
|
|
131536
|
+
}
|
|
131537
|
+
const curRight = remainRight.substr(0, rightCharacterNumber);
|
|
131538
|
+
remainRight = remainRight.slice(rightCharacterNumber);
|
|
131539
|
+
res.push(`${curLeft}${curRight}`);
|
|
131540
|
+
isFirstLine = false;
|
|
131541
|
+
}
|
|
131542
|
+
return res;
|
|
131543
|
+
}
|
|
131544
|
+
function getValueCandidate(option2) {
|
|
131545
|
+
if (option2.type === "object") {
|
|
131546
|
+
return void 0;
|
|
131547
|
+
}
|
|
131548
|
+
return {
|
|
131549
|
+
valueType: getValueType(option2),
|
|
131550
|
+
possibleValues: getPossibleValues(option2)
|
|
131551
|
+
};
|
|
131552
|
+
function getValueType(option3) {
|
|
131553
|
+
Debug.assert(option3.type !== "listOrElement");
|
|
131554
|
+
switch (option3.type) {
|
|
131555
|
+
case "string":
|
|
131556
|
+
case "number":
|
|
131557
|
+
case "boolean":
|
|
131558
|
+
return getDiagnosticText(Diagnostics.type_Colon);
|
|
131559
|
+
case "list":
|
|
131560
|
+
return getDiagnosticText(Diagnostics.one_or_more_Colon);
|
|
131561
|
+
default:
|
|
131562
|
+
return getDiagnosticText(Diagnostics.one_of_Colon);
|
|
131563
|
+
}
|
|
131564
|
+
}
|
|
131565
|
+
function getPossibleValues(option3) {
|
|
131566
|
+
let possibleValues;
|
|
131567
|
+
switch (option3.type) {
|
|
131568
|
+
case "string":
|
|
131569
|
+
case "number":
|
|
131570
|
+
case "boolean":
|
|
131571
|
+
possibleValues = option3.type;
|
|
131572
|
+
break;
|
|
131573
|
+
case "list":
|
|
131574
|
+
case "listOrElement":
|
|
131575
|
+
possibleValues = getPossibleValues(option3.element);
|
|
131576
|
+
break;
|
|
131577
|
+
case "object":
|
|
131578
|
+
possibleValues = "";
|
|
131579
|
+
break;
|
|
131580
|
+
default:
|
|
131581
|
+
const inverted = {};
|
|
131582
|
+
option3.type.forEach((value, name2) => {
|
|
131583
|
+
var _a2;
|
|
131584
|
+
if (!((_a2 = option3.deprecatedKeys) == null ? void 0 : _a2.has(name2))) {
|
|
131585
|
+
(inverted[value] || (inverted[value] = [])).push(name2);
|
|
131586
|
+
}
|
|
131587
|
+
});
|
|
131588
|
+
return Object.entries(inverted).map(([, synonyms]) => synonyms.join("/")).join(", ");
|
|
131589
|
+
}
|
|
131590
|
+
return possibleValues;
|
|
131591
|
+
}
|
|
131592
|
+
}
|
|
131593
|
+
}
|
|
131594
|
+
function generateGroupOptionOutput(sys2, optionsList) {
|
|
131595
|
+
let maxLength2 = 0;
|
|
131596
|
+
for (const option of optionsList) {
|
|
131597
|
+
const curLength = getDisplayNameTextOfOption(option).length;
|
|
131598
|
+
maxLength2 = maxLength2 > curLength ? maxLength2 : curLength;
|
|
131599
|
+
}
|
|
131600
|
+
const rightAlignOfLeftPart = maxLength2 + 2;
|
|
131601
|
+
const leftAlignOfRightPart = rightAlignOfLeftPart + 2;
|
|
131602
|
+
let lines = [];
|
|
131603
|
+
for (const option of optionsList) {
|
|
131604
|
+
const tmp = generateOptionOutput(sys2, option, rightAlignOfLeftPart, leftAlignOfRightPart);
|
|
131605
|
+
lines = [...lines, ...tmp];
|
|
131606
|
+
}
|
|
131607
|
+
if (lines[lines.length - 2] !== sys2.newLine) {
|
|
131608
|
+
lines.push(sys2.newLine);
|
|
131609
|
+
}
|
|
131610
|
+
return lines;
|
|
131611
|
+
}
|
|
131612
|
+
function generateSectionOptionsOutput(sys2, sectionName, options, subCategory, beforeOptionsDescription, afterOptionsDescription) {
|
|
131613
|
+
let res = [];
|
|
131614
|
+
res.push(createColors(sys2).bold(sectionName) + sys2.newLine + sys2.newLine);
|
|
131615
|
+
if (beforeOptionsDescription) {
|
|
131616
|
+
res.push(beforeOptionsDescription + sys2.newLine + sys2.newLine);
|
|
131617
|
+
}
|
|
131618
|
+
if (!subCategory) {
|
|
131619
|
+
res = [...res, ...generateGroupOptionOutput(sys2, options)];
|
|
131620
|
+
if (afterOptionsDescription) {
|
|
131621
|
+
res.push(afterOptionsDescription + sys2.newLine + sys2.newLine);
|
|
131622
|
+
}
|
|
131623
|
+
return res;
|
|
131624
|
+
}
|
|
131625
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
131626
|
+
for (const option of options) {
|
|
131627
|
+
if (!option.category) {
|
|
131628
|
+
continue;
|
|
131629
|
+
}
|
|
131630
|
+
const curCategory = getDiagnosticText(option.category);
|
|
131631
|
+
const optionsOfCurCategory = categoryMap.get(curCategory) ?? [];
|
|
131632
|
+
optionsOfCurCategory.push(option);
|
|
131633
|
+
categoryMap.set(curCategory, optionsOfCurCategory);
|
|
131634
|
+
}
|
|
131635
|
+
categoryMap.forEach((value, key) => {
|
|
131636
|
+
res.push(`### ${key}${sys2.newLine}${sys2.newLine}`);
|
|
131637
|
+
res = [...res, ...generateGroupOptionOutput(sys2, value)];
|
|
131638
|
+
});
|
|
131639
|
+
if (afterOptionsDescription) {
|
|
131640
|
+
res.push(afterOptionsDescription + sys2.newLine + sys2.newLine);
|
|
131641
|
+
}
|
|
131642
|
+
return res;
|
|
131643
|
+
}
|
|
131644
|
+
function printEasyHelp(sys2, simpleOptions) {
|
|
131645
|
+
const colors = createColors(sys2);
|
|
131646
|
+
let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
|
|
131647
|
+
output.push(colors.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys2.newLine + sys2.newLine);
|
|
131648
|
+
example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
|
|
131649
|
+
example("tsc app.ts util.ts", Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
|
|
131650
|
+
example("tsc -b", Diagnostics.Build_a_composite_project_in_the_working_directory);
|
|
131651
|
+
example("tsc --init", Diagnostics.Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory);
|
|
131652
|
+
example("tsc -p ./path/to/tsconfig.json", Diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path);
|
|
131653
|
+
example("tsc --help --all", Diagnostics.An_expanded_version_of_this_information_showing_all_possible_compiler_options);
|
|
131654
|
+
example(["tsc --noEmit", "tsc --target esnext"], Diagnostics.Compiles_the_current_project_with_additional_settings);
|
|
131655
|
+
const cliCommands = simpleOptions.filter((opt) => opt.isCommandLineOnly || opt.category === Diagnostics.Command_line_Options);
|
|
131656
|
+
const configOpts = simpleOptions.filter((opt) => !contains(cliCommands, opt));
|
|
131657
|
+
output = [
|
|
131658
|
+
...output,
|
|
131659
|
+
...generateSectionOptionsOutput(
|
|
131660
|
+
sys2,
|
|
131661
|
+
getDiagnosticText(Diagnostics.COMMAND_LINE_FLAGS),
|
|
131662
|
+
cliCommands,
|
|
131663
|
+
/*subCategory*/
|
|
131664
|
+
false,
|
|
131665
|
+
/*beforeOptionsDescription*/
|
|
131666
|
+
void 0,
|
|
131667
|
+
/*afterOptionsDescription*/
|
|
131668
|
+
void 0
|
|
131669
|
+
),
|
|
131670
|
+
...generateSectionOptionsOutput(
|
|
131671
|
+
sys2,
|
|
131672
|
+
getDiagnosticText(Diagnostics.COMMON_COMPILER_OPTIONS),
|
|
131673
|
+
configOpts,
|
|
131674
|
+
/*subCategory*/
|
|
131675
|
+
false,
|
|
131676
|
+
/*beforeOptionsDescription*/
|
|
131677
|
+
void 0,
|
|
131678
|
+
formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc")
|
|
131679
|
+
)
|
|
131680
|
+
];
|
|
131681
|
+
for (const line of output) {
|
|
131682
|
+
sys2.write(line);
|
|
131683
|
+
}
|
|
131684
|
+
function example(ex, desc) {
|
|
131685
|
+
const examples = typeof ex === "string" ? [ex] : ex;
|
|
131686
|
+
for (const example2 of examples) {
|
|
131687
|
+
output.push(" " + colors.blue(example2) + sys2.newLine);
|
|
131688
|
+
}
|
|
131689
|
+
output.push(" " + getDiagnosticText(desc) + sys2.newLine + sys2.newLine);
|
|
131690
|
+
}
|
|
131691
|
+
}
|
|
131692
|
+
function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
|
|
131693
|
+
let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
|
|
131694
|
+
output = [...output, ...generateSectionOptionsOutput(
|
|
131695
|
+
sys2,
|
|
131696
|
+
getDiagnosticText(Diagnostics.ALL_COMPILER_OPTIONS),
|
|
131697
|
+
compilerOptions,
|
|
131698
|
+
/*subCategory*/
|
|
131699
|
+
true,
|
|
131700
|
+
/*beforeOptionsDescription*/
|
|
131701
|
+
void 0,
|
|
131702
|
+
formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc")
|
|
131703
|
+
)];
|
|
131704
|
+
output = [...output, ...generateSectionOptionsOutput(
|
|
131705
|
+
sys2,
|
|
131706
|
+
getDiagnosticText(Diagnostics.WATCH_OPTIONS),
|
|
131707
|
+
watchOptions,
|
|
131708
|
+
/*subCategory*/
|
|
131709
|
+
false,
|
|
131710
|
+
getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon)
|
|
131711
|
+
)];
|
|
131712
|
+
output = [...output, ...generateSectionOptionsOutput(
|
|
131713
|
+
sys2,
|
|
131714
|
+
getDiagnosticText(Diagnostics.BUILD_OPTIONS),
|
|
131715
|
+
buildOptions,
|
|
131716
|
+
/*subCategory*/
|
|
131717
|
+
false,
|
|
131718
|
+
formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
|
|
131719
|
+
)];
|
|
131720
|
+
for (const line of output) {
|
|
131721
|
+
sys2.write(line);
|
|
131722
|
+
}
|
|
131723
|
+
}
|
|
131724
|
+
function printBuildHelp(sys2, buildOptions) {
|
|
131725
|
+
let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
|
|
131726
|
+
output = [...output, ...generateSectionOptionsOutput(
|
|
131727
|
+
sys2,
|
|
131728
|
+
getDiagnosticText(Diagnostics.BUILD_OPTIONS),
|
|
131729
|
+
buildOptions,
|
|
131730
|
+
/*subCategory*/
|
|
131731
|
+
false,
|
|
131732
|
+
formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
|
|
131733
|
+
)];
|
|
131734
|
+
for (const line of output) {
|
|
131735
|
+
sys2.write(line);
|
|
131736
|
+
}
|
|
131737
|
+
}
|
|
131738
|
+
function getHeader(sys2, message) {
|
|
131739
|
+
var _a;
|
|
131740
|
+
const colors = createColors(sys2);
|
|
131741
|
+
const header = [];
|
|
131742
|
+
const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? void 0 : _a.call(sys2)) ?? 0;
|
|
131743
|
+
const tsIconLength = 5;
|
|
131744
|
+
const tsIconFirstLine = colors.blueBackground("".padStart(tsIconLength));
|
|
131745
|
+
const tsIconSecondLine = colors.blueBackground(colors.brightWhite("TS ".padStart(tsIconLength)));
|
|
131746
|
+
if (terminalWidth >= message.length + tsIconLength) {
|
|
131747
|
+
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
|
131748
|
+
const leftAlign = rightAlign - tsIconLength;
|
|
131749
|
+
header.push(message.padEnd(leftAlign) + tsIconFirstLine + sys2.newLine);
|
|
131750
|
+
header.push("".padStart(leftAlign) + tsIconSecondLine + sys2.newLine);
|
|
131751
|
+
} else {
|
|
131752
|
+
header.push(message + sys2.newLine);
|
|
131753
|
+
header.push(sys2.newLine);
|
|
131754
|
+
}
|
|
131755
|
+
return header;
|
|
131756
|
+
}
|
|
131757
|
+
function printHelp(sys2, commandLine) {
|
|
131758
|
+
if (!commandLine.options.all) {
|
|
131759
|
+
printEasyHelp(sys2, getOptionsForHelp(commandLine));
|
|
131760
|
+
} else {
|
|
131761
|
+
printAllHelp(sys2, getOptionsForHelp(commandLine), optionsForBuild, optionsForWatch);
|
|
131762
|
+
}
|
|
131763
|
+
}
|
|
131764
|
+
function executeCommandLineWorker(sys2, cb, commandLine) {
|
|
131765
|
+
let reportDiagnostic = createDiagnosticReporter(sys2);
|
|
131766
|
+
if (commandLine.options.build) {
|
|
131767
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
|
|
131768
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131769
|
+
}
|
|
131770
|
+
let configFileName;
|
|
131771
|
+
if (commandLine.options.locale) {
|
|
131772
|
+
validateLocaleAndSetLanguage(commandLine.options.locale, sys2, commandLine.errors);
|
|
131773
|
+
}
|
|
131774
|
+
if (commandLine.errors.length > 0) {
|
|
131775
|
+
commandLine.errors.forEach(reportDiagnostic);
|
|
131776
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131777
|
+
}
|
|
131778
|
+
if (commandLine.options.init) {
|
|
131779
|
+
writeConfigFile(sys2, reportDiagnostic, commandLine.options, commandLine.fileNames);
|
|
131780
|
+
return sys2.exit(0 /* Success */);
|
|
131781
|
+
}
|
|
131782
|
+
if (commandLine.options.version) {
|
|
131783
|
+
printVersion(sys2);
|
|
131784
|
+
return sys2.exit(0 /* Success */);
|
|
131785
|
+
}
|
|
131786
|
+
if (commandLine.options.help || commandLine.options.all) {
|
|
131787
|
+
printHelp(sys2, commandLine);
|
|
131788
|
+
return sys2.exit(0 /* Success */);
|
|
131789
|
+
}
|
|
131790
|
+
if (commandLine.options.watch && commandLine.options.listFilesOnly) {
|
|
131791
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Options_0_and_1_cannot_be_combined, "watch", "listFilesOnly"));
|
|
131792
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131793
|
+
}
|
|
131794
|
+
if (commandLine.options.project) {
|
|
131795
|
+
if (commandLine.fileNames.length !== 0) {
|
|
131796
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
|
|
131797
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131798
|
+
}
|
|
131799
|
+
const fileOrDirectory = normalizePath(commandLine.options.project);
|
|
131800
|
+
if (!fileOrDirectory || sys2.directoryExists(fileOrDirectory)) {
|
|
131801
|
+
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
|
131802
|
+
if (!sys2.fileExists(configFileName)) {
|
|
131803
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project));
|
|
131804
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131805
|
+
}
|
|
131806
|
+
} else {
|
|
131807
|
+
configFileName = fileOrDirectory;
|
|
131808
|
+
if (!sys2.fileExists(configFileName)) {
|
|
131809
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project));
|
|
131810
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131811
|
+
}
|
|
131812
|
+
}
|
|
131813
|
+
} else if (commandLine.fileNames.length === 0) {
|
|
131814
|
+
const searchPath = normalizePath(sys2.getCurrentDirectory());
|
|
131815
|
+
configFileName = findConfigFile(searchPath, (fileName) => sys2.fileExists(fileName));
|
|
131816
|
+
}
|
|
131817
|
+
if (commandLine.fileNames.length === 0 && !configFileName) {
|
|
131818
|
+
if (commandLine.options.showConfig) {
|
|
131819
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys2.getCurrentDirectory())));
|
|
131820
|
+
} else {
|
|
131821
|
+
printVersion(sys2);
|
|
131822
|
+
printHelp(sys2, commandLine);
|
|
131823
|
+
}
|
|
131824
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131825
|
+
}
|
|
131826
|
+
const currentDirectory = sys2.getCurrentDirectory();
|
|
131827
|
+
const commandLineOptions = convertToOptionsWithAbsolutePaths(
|
|
131828
|
+
commandLine.options,
|
|
131829
|
+
(fileName) => getNormalizedAbsolutePath(fileName, currentDirectory)
|
|
131830
|
+
);
|
|
131831
|
+
if (configFileName) {
|
|
131832
|
+
const extendedConfigCache = /* @__PURE__ */ new Map();
|
|
131833
|
+
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys2, reportDiagnostic);
|
|
131834
|
+
if (commandLineOptions.showConfig) {
|
|
131835
|
+
if (configParseResult.errors.length !== 0) {
|
|
131836
|
+
reportDiagnostic = updateReportDiagnostic(
|
|
131837
|
+
sys2,
|
|
131838
|
+
reportDiagnostic,
|
|
131839
|
+
configParseResult.options
|
|
131840
|
+
);
|
|
131841
|
+
configParseResult.errors.forEach(reportDiagnostic);
|
|
131842
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131843
|
+
}
|
|
131844
|
+
sys2.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys2), null, 4) + sys2.newLine);
|
|
131845
|
+
return sys2.exit(0 /* Success */);
|
|
131846
|
+
}
|
|
131847
|
+
reportDiagnostic = updateReportDiagnostic(
|
|
131848
|
+
sys2,
|
|
131849
|
+
reportDiagnostic,
|
|
131850
|
+
configParseResult.options
|
|
131851
|
+
);
|
|
131852
|
+
if (isWatchSet(configParseResult.options)) {
|
|
131853
|
+
if (reportWatchModeWithoutSysSupport(sys2, reportDiagnostic))
|
|
131854
|
+
return;
|
|
131855
|
+
return createWatchOfConfigFile(
|
|
131856
|
+
sys2,
|
|
131857
|
+
cb,
|
|
131858
|
+
reportDiagnostic,
|
|
131859
|
+
configParseResult,
|
|
131860
|
+
commandLineOptions,
|
|
131861
|
+
commandLine.watchOptions,
|
|
131862
|
+
extendedConfigCache
|
|
131863
|
+
);
|
|
131864
|
+
} else if (isIncrementalCompilation(configParseResult.options)) {
|
|
131865
|
+
performIncrementalCompilation2(
|
|
131866
|
+
sys2,
|
|
131867
|
+
cb,
|
|
131868
|
+
reportDiagnostic,
|
|
131869
|
+
configParseResult
|
|
131870
|
+
);
|
|
131871
|
+
} else {
|
|
131872
|
+
performCompilation(
|
|
131873
|
+
sys2,
|
|
131874
|
+
cb,
|
|
131875
|
+
reportDiagnostic,
|
|
131876
|
+
configParseResult
|
|
131877
|
+
);
|
|
131878
|
+
}
|
|
131879
|
+
} else {
|
|
131880
|
+
if (commandLineOptions.showConfig) {
|
|
131881
|
+
sys2.write(JSON.stringify(convertToTSConfig(commandLine, combinePaths(currentDirectory, "tsconfig.json"), sys2), null, 4) + sys2.newLine);
|
|
131882
|
+
return sys2.exit(0 /* Success */);
|
|
131883
|
+
}
|
|
131884
|
+
reportDiagnostic = updateReportDiagnostic(
|
|
131885
|
+
sys2,
|
|
131886
|
+
reportDiagnostic,
|
|
131887
|
+
commandLineOptions
|
|
131888
|
+
);
|
|
131889
|
+
if (isWatchSet(commandLineOptions)) {
|
|
131890
|
+
if (reportWatchModeWithoutSysSupport(sys2, reportDiagnostic))
|
|
131891
|
+
return;
|
|
131892
|
+
return createWatchOfFilesAndCompilerOptions(
|
|
131893
|
+
sys2,
|
|
131894
|
+
cb,
|
|
131895
|
+
reportDiagnostic,
|
|
131896
|
+
commandLine.fileNames,
|
|
131897
|
+
commandLineOptions,
|
|
131898
|
+
commandLine.watchOptions
|
|
131899
|
+
);
|
|
131900
|
+
} else if (isIncrementalCompilation(commandLineOptions)) {
|
|
131901
|
+
performIncrementalCompilation2(
|
|
131902
|
+
sys2,
|
|
131903
|
+
cb,
|
|
131904
|
+
reportDiagnostic,
|
|
131905
|
+
{ ...commandLine, options: commandLineOptions }
|
|
131906
|
+
);
|
|
131907
|
+
} else {
|
|
131908
|
+
performCompilation(
|
|
131909
|
+
sys2,
|
|
131910
|
+
cb,
|
|
131911
|
+
reportDiagnostic,
|
|
131912
|
+
{ ...commandLine, options: commandLineOptions }
|
|
131913
|
+
);
|
|
131914
|
+
}
|
|
131915
|
+
}
|
|
131916
|
+
}
|
|
131917
|
+
function isBuild(commandLineArgs) {
|
|
131918
|
+
if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === 45 /* minus */) {
|
|
131919
|
+
const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase();
|
|
131920
|
+
return firstOption === "build" || firstOption === "b";
|
|
131921
|
+
}
|
|
131922
|
+
return false;
|
|
131923
|
+
}
|
|
131924
|
+
function executeCommandLine(system, cb, commandLineArgs) {
|
|
131925
|
+
if (isBuild(commandLineArgs)) {
|
|
131926
|
+
const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
|
|
131927
|
+
if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {
|
|
131928
|
+
system.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuild(
|
|
131929
|
+
system,
|
|
131930
|
+
cb,
|
|
131931
|
+
buildOptions,
|
|
131932
|
+
watchOptions,
|
|
131933
|
+
projects,
|
|
131934
|
+
errors
|
|
131935
|
+
));
|
|
131936
|
+
} else {
|
|
131937
|
+
return performBuild(
|
|
131938
|
+
system,
|
|
131939
|
+
cb,
|
|
131940
|
+
buildOptions,
|
|
131941
|
+
watchOptions,
|
|
131942
|
+
projects,
|
|
131943
|
+
errors
|
|
131944
|
+
);
|
|
131945
|
+
}
|
|
131946
|
+
}
|
|
131947
|
+
const commandLine = parseCommandLine(commandLineArgs, (path) => system.readFile(path));
|
|
131948
|
+
if (commandLine.options.generateCpuProfile && system.enableCPUProfiler) {
|
|
131949
|
+
system.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker(
|
|
131950
|
+
system,
|
|
131951
|
+
cb,
|
|
131952
|
+
commandLine
|
|
131953
|
+
));
|
|
131954
|
+
} else {
|
|
131955
|
+
return executeCommandLineWorker(system, cb, commandLine);
|
|
131956
|
+
}
|
|
131957
|
+
}
|
|
131958
|
+
function reportWatchModeWithoutSysSupport(sys2, reportDiagnostic) {
|
|
131959
|
+
if (!sys2.watchFile || !sys2.watchDirectory) {
|
|
131960
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
|
|
131961
|
+
sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131962
|
+
return true;
|
|
131963
|
+
}
|
|
131964
|
+
return false;
|
|
131965
|
+
}
|
|
131966
|
+
var defaultJSDocParsingMode = 2 /* ParseForTypeErrors */;
|
|
131967
|
+
function performBuild(sys2, cb, buildOptions, watchOptions, projects, errors) {
|
|
131968
|
+
const reportDiagnostic = updateReportDiagnostic(
|
|
131969
|
+
sys2,
|
|
131970
|
+
createDiagnosticReporter(sys2),
|
|
131971
|
+
buildOptions
|
|
131972
|
+
);
|
|
131973
|
+
if (buildOptions.locale) {
|
|
131974
|
+
validateLocaleAndSetLanguage(buildOptions.locale, sys2, errors);
|
|
131975
|
+
}
|
|
131976
|
+
if (errors.length > 0) {
|
|
131977
|
+
errors.forEach(reportDiagnostic);
|
|
131978
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131979
|
+
}
|
|
131980
|
+
if (buildOptions.help) {
|
|
131981
|
+
printVersion(sys2);
|
|
131982
|
+
printBuildHelp(sys2, buildOpts);
|
|
131983
|
+
return sys2.exit(0 /* Success */);
|
|
131984
|
+
}
|
|
131985
|
+
if (projects.length === 0) {
|
|
131986
|
+
printVersion(sys2);
|
|
131987
|
+
printBuildHelp(sys2, buildOpts);
|
|
131988
|
+
return sys2.exit(0 /* Success */);
|
|
131989
|
+
}
|
|
131990
|
+
if (!sys2.getModifiedTime || !sys2.setModifiedTime || buildOptions.clean && !sys2.deleteFile) {
|
|
131991
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build"));
|
|
131992
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
131993
|
+
}
|
|
131994
|
+
if (buildOptions.watch) {
|
|
131995
|
+
if (reportWatchModeWithoutSysSupport(sys2, reportDiagnostic))
|
|
131996
|
+
return;
|
|
131997
|
+
const buildHost2 = createSolutionBuilderWithWatchHost(
|
|
131998
|
+
sys2,
|
|
131999
|
+
/*createProgram*/
|
|
132000
|
+
void 0,
|
|
132001
|
+
reportDiagnostic,
|
|
132002
|
+
createBuilderStatusReporter(sys2, shouldBePretty(sys2, buildOptions)),
|
|
132003
|
+
createWatchStatusReporter2(sys2, buildOptions)
|
|
132004
|
+
);
|
|
132005
|
+
buildHost2.jsDocParsingMode = defaultJSDocParsingMode;
|
|
132006
|
+
const solutionPerformance2 = enableSolutionPerformance(sys2, buildOptions);
|
|
132007
|
+
updateSolutionBuilderHost(sys2, cb, buildHost2, solutionPerformance2);
|
|
132008
|
+
const onWatchStatusChange = buildHost2.onWatchStatusChange;
|
|
132009
|
+
let reportBuildStatistics = false;
|
|
132010
|
+
buildHost2.onWatchStatusChange = (d, newLine, options, errorCount) => {
|
|
132011
|
+
onWatchStatusChange == null ? void 0 : onWatchStatusChange(d, newLine, options, errorCount);
|
|
132012
|
+
if (reportBuildStatistics && (d.code === Diagnostics.Found_0_errors_Watching_for_file_changes.code || d.code === Diagnostics.Found_1_error_Watching_for_file_changes.code)) {
|
|
132013
|
+
reportSolutionBuilderTimes(builder2, solutionPerformance2);
|
|
132014
|
+
}
|
|
132015
|
+
};
|
|
132016
|
+
const builder2 = createSolutionBuilderWithWatch(buildHost2, projects, buildOptions, watchOptions);
|
|
132017
|
+
builder2.build();
|
|
132018
|
+
reportSolutionBuilderTimes(builder2, solutionPerformance2);
|
|
132019
|
+
reportBuildStatistics = true;
|
|
132020
|
+
return builder2;
|
|
132021
|
+
}
|
|
132022
|
+
const buildHost = createSolutionBuilderHost(
|
|
132023
|
+
sys2,
|
|
132024
|
+
/*createProgram*/
|
|
132025
|
+
void 0,
|
|
132026
|
+
reportDiagnostic,
|
|
132027
|
+
createBuilderStatusReporter(sys2, shouldBePretty(sys2, buildOptions)),
|
|
132028
|
+
createReportErrorSummary(sys2, buildOptions)
|
|
132029
|
+
);
|
|
132030
|
+
buildHost.jsDocParsingMode = defaultJSDocParsingMode;
|
|
132031
|
+
const solutionPerformance = enableSolutionPerformance(sys2, buildOptions);
|
|
132032
|
+
updateSolutionBuilderHost(sys2, cb, buildHost, solutionPerformance);
|
|
132033
|
+
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
|
132034
|
+
const exitStatus = buildOptions.clean ? builder.clean() : builder.build();
|
|
132035
|
+
reportSolutionBuilderTimes(builder, solutionPerformance);
|
|
132036
|
+
dumpTracingLegend();
|
|
132037
|
+
return sys2.exit(exitStatus);
|
|
132038
|
+
}
|
|
132039
|
+
function createReportErrorSummary(sys2, options) {
|
|
132040
|
+
return shouldBePretty(sys2, options) ? (errorCount, filesInError) => sys2.write(getErrorSummaryText(errorCount, filesInError, sys2.newLine, sys2)) : void 0;
|
|
132041
|
+
}
|
|
132042
|
+
function performCompilation(sys2, cb, reportDiagnostic, config) {
|
|
132043
|
+
const { fileNames, options, projectReferences } = config;
|
|
132044
|
+
const host = createCompilerHostWorker(
|
|
132045
|
+
options,
|
|
132046
|
+
/*setParentNodes*/
|
|
132047
|
+
void 0,
|
|
132048
|
+
sys2
|
|
132049
|
+
);
|
|
132050
|
+
host.jsDocParsingMode = defaultJSDocParsingMode;
|
|
132051
|
+
const currentDirectory = host.getCurrentDirectory();
|
|
132052
|
+
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
132053
|
+
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, currentDirectory, getCanonicalFileName));
|
|
132054
|
+
enableStatisticsAndTracing(
|
|
132055
|
+
sys2,
|
|
132056
|
+
options,
|
|
132057
|
+
/*isBuildMode*/
|
|
132058
|
+
false
|
|
132059
|
+
);
|
|
132060
|
+
const programOptions = {
|
|
132061
|
+
rootNames: fileNames,
|
|
132062
|
+
options,
|
|
132063
|
+
projectReferences,
|
|
132064
|
+
host,
|
|
132065
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config)
|
|
132066
|
+
};
|
|
132067
|
+
const program = createProgram(programOptions);
|
|
132068
|
+
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
|
132069
|
+
program,
|
|
132070
|
+
reportDiagnostic,
|
|
132071
|
+
(s) => sys2.write(s + sys2.newLine),
|
|
132072
|
+
createReportErrorSummary(sys2, options)
|
|
132073
|
+
);
|
|
132074
|
+
reportStatistics(
|
|
132075
|
+
sys2,
|
|
132076
|
+
program,
|
|
132077
|
+
/*solutionPerformance*/
|
|
132078
|
+
void 0
|
|
132079
|
+
);
|
|
132080
|
+
cb(program);
|
|
132081
|
+
return sys2.exit(exitStatus);
|
|
132082
|
+
}
|
|
132083
|
+
function performIncrementalCompilation2(sys2, cb, reportDiagnostic, config) {
|
|
132084
|
+
const { options, fileNames, projectReferences } = config;
|
|
132085
|
+
enableStatisticsAndTracing(
|
|
132086
|
+
sys2,
|
|
132087
|
+
options,
|
|
132088
|
+
/*isBuildMode*/
|
|
132089
|
+
false
|
|
132090
|
+
);
|
|
132091
|
+
const host = createIncrementalCompilerHost(options, sys2);
|
|
132092
|
+
host.jsDocParsingMode = defaultJSDocParsingMode;
|
|
132093
|
+
const exitStatus = performIncrementalCompilation({
|
|
132094
|
+
host,
|
|
132095
|
+
system: sys2,
|
|
132096
|
+
rootNames: fileNames,
|
|
132097
|
+
options,
|
|
132098
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
|
|
132099
|
+
projectReferences,
|
|
132100
|
+
reportDiagnostic,
|
|
132101
|
+
reportErrorSummary: createReportErrorSummary(sys2, options),
|
|
132102
|
+
afterProgramEmitAndDiagnostics: (builderProgram) => {
|
|
132103
|
+
reportStatistics(
|
|
132104
|
+
sys2,
|
|
132105
|
+
builderProgram.getProgram(),
|
|
132106
|
+
/*solutionPerformance*/
|
|
132107
|
+
void 0
|
|
132108
|
+
);
|
|
132109
|
+
cb(builderProgram);
|
|
132110
|
+
}
|
|
132111
|
+
});
|
|
132112
|
+
return sys2.exit(exitStatus);
|
|
132113
|
+
}
|
|
132114
|
+
function updateSolutionBuilderHost(sys2, cb, buildHost, solutionPerformance) {
|
|
132115
|
+
updateCreateProgram(
|
|
132116
|
+
sys2,
|
|
132117
|
+
buildHost,
|
|
132118
|
+
/*isBuildMode*/
|
|
132119
|
+
true
|
|
132120
|
+
);
|
|
132121
|
+
buildHost.afterProgramEmitAndDiagnostics = (program) => {
|
|
132122
|
+
reportStatistics(sys2, program.getProgram(), solutionPerformance);
|
|
132123
|
+
cb(program);
|
|
132124
|
+
};
|
|
132125
|
+
}
|
|
132126
|
+
function updateCreateProgram(sys2, host, isBuildMode) {
|
|
132127
|
+
const compileUsingBuilder = host.createProgram;
|
|
132128
|
+
host.createProgram = (rootNames, options, host2, oldProgram, configFileParsingDiagnostics, projectReferences) => {
|
|
132129
|
+
Debug.assert(rootNames !== void 0 || options === void 0 && !!oldProgram);
|
|
132130
|
+
if (options !== void 0) {
|
|
132131
|
+
enableStatisticsAndTracing(sys2, options, isBuildMode);
|
|
132132
|
+
}
|
|
132133
|
+
return compileUsingBuilder(rootNames, options, host2, oldProgram, configFileParsingDiagnostics, projectReferences);
|
|
132134
|
+
};
|
|
132135
|
+
}
|
|
132136
|
+
function updateWatchCompilationHost(sys2, cb, watchCompilerHost) {
|
|
132137
|
+
watchCompilerHost.jsDocParsingMode = defaultJSDocParsingMode;
|
|
132138
|
+
updateCreateProgram(
|
|
132139
|
+
sys2,
|
|
132140
|
+
watchCompilerHost,
|
|
132141
|
+
/*isBuildMode*/
|
|
132142
|
+
false
|
|
132143
|
+
);
|
|
132144
|
+
const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
|
|
132145
|
+
watchCompilerHost.afterProgramCreate = (builderProgram) => {
|
|
132146
|
+
emitFilesUsingBuilder(builderProgram);
|
|
132147
|
+
reportStatistics(
|
|
132148
|
+
sys2,
|
|
132149
|
+
builderProgram.getProgram(),
|
|
132150
|
+
/*solutionPerformance*/
|
|
132151
|
+
void 0
|
|
132152
|
+
);
|
|
132153
|
+
cb(builderProgram);
|
|
132154
|
+
};
|
|
132155
|
+
}
|
|
132156
|
+
function createWatchStatusReporter2(sys2, options) {
|
|
132157
|
+
return createWatchStatusReporter(sys2, shouldBePretty(sys2, options));
|
|
132158
|
+
}
|
|
132159
|
+
function createWatchOfConfigFile(system, cb, reportDiagnostic, configParseResult, optionsToExtend, watchOptionsToExtend, extendedConfigCache) {
|
|
132160
|
+
const watchCompilerHost = createWatchCompilerHostOfConfigFile({
|
|
132161
|
+
configFileName: configParseResult.options.configFilePath,
|
|
132162
|
+
optionsToExtend,
|
|
132163
|
+
watchOptionsToExtend,
|
|
132164
|
+
system,
|
|
132165
|
+
reportDiagnostic,
|
|
132166
|
+
reportWatchStatus: createWatchStatusReporter2(system, configParseResult.options)
|
|
132167
|
+
});
|
|
132168
|
+
updateWatchCompilationHost(system, cb, watchCompilerHost);
|
|
132169
|
+
watchCompilerHost.configFileParsingResult = configParseResult;
|
|
132170
|
+
watchCompilerHost.extendedConfigCache = extendedConfigCache;
|
|
132171
|
+
return createWatchProgram(watchCompilerHost);
|
|
132172
|
+
}
|
|
132173
|
+
function createWatchOfFilesAndCompilerOptions(system, cb, reportDiagnostic, rootFiles, options, watchOptions) {
|
|
132174
|
+
const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions({
|
|
132175
|
+
rootFiles,
|
|
132176
|
+
options,
|
|
132177
|
+
watchOptions,
|
|
132178
|
+
system,
|
|
132179
|
+
reportDiagnostic,
|
|
132180
|
+
reportWatchStatus: createWatchStatusReporter2(system, options)
|
|
132181
|
+
});
|
|
132182
|
+
updateWatchCompilationHost(system, cb, watchCompilerHost);
|
|
132183
|
+
return createWatchProgram(watchCompilerHost);
|
|
132184
|
+
}
|
|
132185
|
+
function enableSolutionPerformance(system, options) {
|
|
132186
|
+
if (system === sys && options.extendedDiagnostics) {
|
|
132187
|
+
enable();
|
|
132188
|
+
return createSolutionPerfomrance();
|
|
132189
|
+
}
|
|
132190
|
+
}
|
|
132191
|
+
function createSolutionPerfomrance() {
|
|
132192
|
+
let statistics;
|
|
132193
|
+
return {
|
|
132194
|
+
addAggregateStatistic,
|
|
132195
|
+
forEachAggregateStatistics: forEachAggreateStatistics,
|
|
132196
|
+
clear: clear2
|
|
132197
|
+
};
|
|
132198
|
+
function addAggregateStatistic(s) {
|
|
132199
|
+
const existing = statistics == null ? void 0 : statistics.get(s.name);
|
|
132200
|
+
if (existing) {
|
|
132201
|
+
if (existing.type === 2 /* memory */)
|
|
132202
|
+
existing.value = Math.max(existing.value, s.value);
|
|
132203
|
+
else
|
|
132204
|
+
existing.value += s.value;
|
|
132205
|
+
} else {
|
|
132206
|
+
(statistics ?? (statistics = /* @__PURE__ */ new Map())).set(s.name, s);
|
|
132207
|
+
}
|
|
132208
|
+
}
|
|
132209
|
+
function forEachAggreateStatistics(cb) {
|
|
132210
|
+
statistics == null ? void 0 : statistics.forEach(cb);
|
|
132211
|
+
}
|
|
132212
|
+
function clear2() {
|
|
132213
|
+
statistics = void 0;
|
|
132214
|
+
}
|
|
132215
|
+
}
|
|
132216
|
+
function reportSolutionBuilderTimes(builder, solutionPerformance) {
|
|
132217
|
+
if (!solutionPerformance)
|
|
132218
|
+
return;
|
|
132219
|
+
if (!isEnabled()) {
|
|
132220
|
+
sys.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
|
|
132221
|
+
return;
|
|
132222
|
+
}
|
|
132223
|
+
const statistics = [];
|
|
132224
|
+
statistics.push(
|
|
132225
|
+
{ name: "Projects in scope", value: getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: 1 /* count */ }
|
|
132226
|
+
);
|
|
132227
|
+
reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built");
|
|
132228
|
+
reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates");
|
|
132229
|
+
reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated");
|
|
132230
|
+
solutionPerformance.forEachAggregateStatistics((s) => {
|
|
132231
|
+
s.name = `Aggregate ${s.name}`;
|
|
132232
|
+
statistics.push(s);
|
|
132233
|
+
});
|
|
132234
|
+
forEachMeasure((name, duration) => {
|
|
132235
|
+
if (isSolutionMarkOrMeasure(name))
|
|
132236
|
+
statistics.push({ name: `${getNameFromSolutionBuilderMarkOrMeasure(name)} time`, value: duration, type: 0 /* time */ });
|
|
132237
|
+
});
|
|
132238
|
+
disable();
|
|
132239
|
+
enable();
|
|
132240
|
+
solutionPerformance.clear();
|
|
132241
|
+
reportAllStatistics(sys, statistics);
|
|
132242
|
+
function reportSolutionBuilderCountStatistic(name) {
|
|
132243
|
+
const value = getCount(name);
|
|
132244
|
+
if (value) {
|
|
132245
|
+
statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value, type: 1 /* count */ });
|
|
132246
|
+
}
|
|
132247
|
+
}
|
|
132248
|
+
function getNameFromSolutionBuilderMarkOrMeasure(name) {
|
|
132249
|
+
return name.replace("SolutionBuilder::", "");
|
|
132250
|
+
}
|
|
132251
|
+
}
|
|
132252
|
+
function canReportDiagnostics(system, compilerOptions) {
|
|
132253
|
+
return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
|
|
132254
|
+
}
|
|
132255
|
+
function canTrace(system, compilerOptions) {
|
|
132256
|
+
return system === sys && compilerOptions.generateTrace;
|
|
132257
|
+
}
|
|
132258
|
+
function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
|
|
132259
|
+
if (canReportDiagnostics(system, compilerOptions)) {
|
|
132260
|
+
enable(system);
|
|
132261
|
+
}
|
|
132262
|
+
if (canTrace(system, compilerOptions)) {
|
|
132263
|
+
startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
|
|
132264
|
+
}
|
|
132265
|
+
}
|
|
132266
|
+
function isSolutionMarkOrMeasure(name) {
|
|
132267
|
+
return startsWith(name, "SolutionBuilder::");
|
|
132268
|
+
}
|
|
132269
|
+
function reportStatistics(sys2, program, solutionPerformance) {
|
|
132270
|
+
var _a;
|
|
132271
|
+
const compilerOptions = program.getCompilerOptions();
|
|
132272
|
+
if (canTrace(sys2, compilerOptions)) {
|
|
132273
|
+
(_a = tracing) == null ? void 0 : _a.stopTracing();
|
|
132274
|
+
}
|
|
132275
|
+
let statistics;
|
|
132276
|
+
if (canReportDiagnostics(sys2, compilerOptions)) {
|
|
132277
|
+
statistics = [];
|
|
132278
|
+
const memoryUsed = sys2.getMemoryUsage ? sys2.getMemoryUsage() : -1;
|
|
132279
|
+
reportCountStatistic("Files", program.getSourceFiles().length);
|
|
132280
|
+
const lineCounts = countLines(program);
|
|
132281
|
+
if (compilerOptions.extendedDiagnostics) {
|
|
132282
|
+
for (const [key, value] of lineCounts.entries()) {
|
|
132283
|
+
reportCountStatistic("Lines of " + key, value);
|
|
132284
|
+
}
|
|
132285
|
+
} else {
|
|
132286
|
+
reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count) => sum + count, 0));
|
|
132287
|
+
}
|
|
132288
|
+
reportCountStatistic("Identifiers", program.getIdentifierCount());
|
|
132289
|
+
reportCountStatistic("Symbols", program.getSymbolCount());
|
|
132290
|
+
reportCountStatistic("Types", program.getTypeCount());
|
|
132291
|
+
reportCountStatistic("Instantiations", program.getInstantiationCount());
|
|
132292
|
+
if (memoryUsed >= 0) {
|
|
132293
|
+
reportStatisticalValue(
|
|
132294
|
+
{ name: "Memory used", value: memoryUsed, type: 2 /* memory */ },
|
|
132295
|
+
/*aggregate*/
|
|
132296
|
+
true
|
|
132297
|
+
);
|
|
132298
|
+
}
|
|
132299
|
+
const isPerformanceEnabled = isEnabled();
|
|
132300
|
+
const programTime = isPerformanceEnabled ? getDuration("Program") : 0;
|
|
132301
|
+
const bindTime = isPerformanceEnabled ? getDuration("Bind") : 0;
|
|
132302
|
+
const checkTime = isPerformanceEnabled ? getDuration("Check") : 0;
|
|
132303
|
+
const emitTime = isPerformanceEnabled ? getDuration("Emit") : 0;
|
|
132304
|
+
if (compilerOptions.extendedDiagnostics) {
|
|
132305
|
+
const caches = program.getRelationCacheSizes();
|
|
132306
|
+
reportCountStatistic("Assignability cache size", caches.assignable);
|
|
132307
|
+
reportCountStatistic("Identity cache size", caches.identity);
|
|
132308
|
+
reportCountStatistic("Subtype cache size", caches.subtype);
|
|
132309
|
+
reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
|
|
132310
|
+
if (isPerformanceEnabled) {
|
|
132311
|
+
forEachMeasure((name, duration) => {
|
|
132312
|
+
if (!isSolutionMarkOrMeasure(name))
|
|
132313
|
+
reportTimeStatistic(
|
|
132314
|
+
`${name} time`,
|
|
132315
|
+
duration,
|
|
132316
|
+
/*aggregate*/
|
|
132317
|
+
true
|
|
132318
|
+
);
|
|
132319
|
+
});
|
|
132320
|
+
}
|
|
132321
|
+
} else if (isPerformanceEnabled) {
|
|
132322
|
+
reportTimeStatistic(
|
|
132323
|
+
"I/O read",
|
|
132324
|
+
getDuration("I/O Read"),
|
|
132325
|
+
/*aggregate*/
|
|
132326
|
+
true
|
|
132327
|
+
);
|
|
132328
|
+
reportTimeStatistic(
|
|
132329
|
+
"I/O write",
|
|
132330
|
+
getDuration("I/O Write"),
|
|
132331
|
+
/*aggregate*/
|
|
132332
|
+
true
|
|
132333
|
+
);
|
|
132334
|
+
reportTimeStatistic(
|
|
132335
|
+
"Parse time",
|
|
132336
|
+
programTime,
|
|
132337
|
+
/*aggregate*/
|
|
132338
|
+
true
|
|
132339
|
+
);
|
|
132340
|
+
reportTimeStatistic(
|
|
132341
|
+
"Bind time",
|
|
132342
|
+
bindTime,
|
|
132343
|
+
/*aggregate*/
|
|
132344
|
+
true
|
|
132345
|
+
);
|
|
132346
|
+
reportTimeStatistic(
|
|
132347
|
+
"Check time",
|
|
132348
|
+
checkTime,
|
|
132349
|
+
/*aggregate*/
|
|
132350
|
+
true
|
|
132351
|
+
);
|
|
132352
|
+
reportTimeStatistic(
|
|
132353
|
+
"Emit time",
|
|
132354
|
+
emitTime,
|
|
132355
|
+
/*aggregate*/
|
|
132356
|
+
true
|
|
132357
|
+
);
|
|
132358
|
+
}
|
|
132359
|
+
if (isPerformanceEnabled) {
|
|
132360
|
+
reportTimeStatistic(
|
|
132361
|
+
"Total time",
|
|
132362
|
+
programTime + bindTime + checkTime + emitTime,
|
|
132363
|
+
/*aggregate*/
|
|
132364
|
+
false
|
|
132365
|
+
);
|
|
132366
|
+
}
|
|
132367
|
+
reportAllStatistics(sys2, statistics);
|
|
132368
|
+
if (!isPerformanceEnabled) {
|
|
132369
|
+
sys2.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
|
|
132370
|
+
} else {
|
|
132371
|
+
if (solutionPerformance) {
|
|
132372
|
+
forEachMeasure((name) => {
|
|
132373
|
+
if (!isSolutionMarkOrMeasure(name))
|
|
132374
|
+
clearMeasures(name);
|
|
132375
|
+
});
|
|
132376
|
+
forEachMark((name) => {
|
|
132377
|
+
if (!isSolutionMarkOrMeasure(name))
|
|
132378
|
+
clearMarks(name);
|
|
132379
|
+
});
|
|
132380
|
+
} else {
|
|
132381
|
+
disable();
|
|
132382
|
+
}
|
|
132383
|
+
}
|
|
132384
|
+
}
|
|
132385
|
+
function reportStatisticalValue(s, aggregate) {
|
|
132386
|
+
statistics.push(s);
|
|
132387
|
+
if (aggregate)
|
|
132388
|
+
solutionPerformance == null ? void 0 : solutionPerformance.addAggregateStatistic(s);
|
|
132389
|
+
}
|
|
132390
|
+
function reportCountStatistic(name, count) {
|
|
132391
|
+
reportStatisticalValue(
|
|
132392
|
+
{ name, value: count, type: 1 /* count */ },
|
|
132393
|
+
/*aggregate*/
|
|
132394
|
+
true
|
|
132395
|
+
);
|
|
132396
|
+
}
|
|
132397
|
+
function reportTimeStatistic(name, time, aggregate) {
|
|
132398
|
+
reportStatisticalValue({ name, value: time, type: 0 /* time */ }, aggregate);
|
|
132399
|
+
}
|
|
132400
|
+
}
|
|
132401
|
+
function reportAllStatistics(sys2, statistics) {
|
|
132402
|
+
let nameSize = 0;
|
|
132403
|
+
let valueSize = 0;
|
|
132404
|
+
for (const s of statistics) {
|
|
132405
|
+
if (s.name.length > nameSize) {
|
|
132406
|
+
nameSize = s.name.length;
|
|
132407
|
+
}
|
|
132408
|
+
const value = statisticValue(s);
|
|
132409
|
+
if (value.length > valueSize) {
|
|
132410
|
+
valueSize = value.length;
|
|
132411
|
+
}
|
|
132412
|
+
}
|
|
132413
|
+
for (const s of statistics) {
|
|
132414
|
+
sys2.write(`${s.name}:`.padEnd(nameSize + 2) + statisticValue(s).toString().padStart(valueSize) + sys2.newLine);
|
|
132415
|
+
}
|
|
132416
|
+
}
|
|
132417
|
+
function statisticValue(s) {
|
|
132418
|
+
switch (s.type) {
|
|
132419
|
+
case 1 /* count */:
|
|
132420
|
+
return "" + s.value;
|
|
132421
|
+
case 0 /* time */:
|
|
132422
|
+
return (s.value / 1e3).toFixed(2) + "s";
|
|
132423
|
+
case 2 /* memory */:
|
|
132424
|
+
return Math.round(s.value / 1e3) + "K";
|
|
132425
|
+
default:
|
|
132426
|
+
Debug.assertNever(s.type);
|
|
132427
|
+
}
|
|
132428
|
+
}
|
|
132429
|
+
function writeConfigFile(sys2, reportDiagnostic, options, fileNames) {
|
|
132430
|
+
const currentDirectory = sys2.getCurrentDirectory();
|
|
132431
|
+
const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
|
|
132432
|
+
if (sys2.fileExists(file)) {
|
|
132433
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
|
|
132434
|
+
} else {
|
|
132435
|
+
sys2.writeFile(file, generateTSConfig(options, fileNames, sys2.newLine));
|
|
132436
|
+
const output = [sys2.newLine, ...getHeader(sys2, "Created a new tsconfig.json with:")];
|
|
132437
|
+
output.push(getCompilerOptionsDiffValue(options, sys2.newLine) + sys2.newLine + sys2.newLine);
|
|
132438
|
+
output.push(`You can learn more at https://aka.ms/tsconfig` + sys2.newLine);
|
|
132439
|
+
for (const line of output) {
|
|
132440
|
+
sys2.write(line);
|
|
132441
|
+
}
|
|
132442
|
+
}
|
|
132443
|
+
return;
|
|
132444
|
+
}
|
|
132445
|
+
|
|
131134
132446
|
// src/jsTyping/_namespaces/ts.JsTyping.ts
|
|
131135
132447
|
var ts_JsTyping_exports = {};
|
|
131136
132448
|
__export(ts_JsTyping_exports, {
|
|
@@ -144486,11 +145798,14 @@ var NodeObject = class {
|
|
|
144486
145798
|
constructor(kind, pos, end) {
|
|
144487
145799
|
this.pos = pos;
|
|
144488
145800
|
this.end = end;
|
|
145801
|
+
this.kind = kind;
|
|
145802
|
+
this.id = 0;
|
|
144489
145803
|
this.flags = 0 /* None */;
|
|
144490
145804
|
this.modifierFlagsCache = 0 /* None */;
|
|
144491
145805
|
this.transformFlags = 0 /* None */;
|
|
144492
145806
|
this.parent = void 0;
|
|
144493
|
-
this.
|
|
145807
|
+
this.original = void 0;
|
|
145808
|
+
this.emitNode = void 0;
|
|
144494
145809
|
}
|
|
144495
145810
|
assertHasRealPosition(message) {
|
|
144496
145811
|
Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation");
|
|
@@ -144541,7 +145856,7 @@ var NodeObject = class {
|
|
|
144541
145856
|
}
|
|
144542
145857
|
getChildren(sourceFile) {
|
|
144543
145858
|
this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
|
|
144544
|
-
return this
|
|
145859
|
+
return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
|
|
144545
145860
|
}
|
|
144546
145861
|
getFirstToken(sourceFile) {
|
|
144547
145862
|
this.assertHasRealPosition();
|
|
@@ -144617,24 +145932,27 @@ function addSyntheticNodes(nodes, pos, end, parent2) {
|
|
|
144617
145932
|
}
|
|
144618
145933
|
function createSyntaxList(nodes, parent2) {
|
|
144619
145934
|
const list = createNode(352 /* SyntaxList */, nodes.pos, nodes.end, parent2);
|
|
144620
|
-
|
|
145935
|
+
const children = [];
|
|
144621
145936
|
let pos = nodes.pos;
|
|
144622
145937
|
for (const node of nodes) {
|
|
144623
|
-
addSyntheticNodes(
|
|
144624
|
-
|
|
145938
|
+
addSyntheticNodes(children, pos, node.pos, parent2);
|
|
145939
|
+
children.push(node);
|
|
144625
145940
|
pos = node.end;
|
|
144626
145941
|
}
|
|
144627
|
-
addSyntheticNodes(
|
|
145942
|
+
addSyntheticNodes(children, pos, nodes.end, parent2);
|
|
145943
|
+
setNodeChildren(list, children);
|
|
144628
145944
|
return list;
|
|
144629
145945
|
}
|
|
144630
145946
|
var TokenOrIdentifierObject = class {
|
|
144631
|
-
constructor(pos, end) {
|
|
145947
|
+
constructor(kind, pos, end) {
|
|
144632
145948
|
this.pos = pos;
|
|
144633
145949
|
this.end = end;
|
|
145950
|
+
this.kind = kind;
|
|
145951
|
+
this.id = 0;
|
|
144634
145952
|
this.flags = 0 /* None */;
|
|
144635
|
-
this.modifierFlagsCache = 0 /* None */;
|
|
144636
145953
|
this.transformFlags = 0 /* None */;
|
|
144637
145954
|
this.parent = void 0;
|
|
145955
|
+
this.emitNode = void 0;
|
|
144638
145956
|
}
|
|
144639
145957
|
getSourceFile() {
|
|
144640
145958
|
return getSourceFileOfNode(this);
|
|
@@ -144687,10 +146005,20 @@ var TokenOrIdentifierObject = class {
|
|
|
144687
146005
|
};
|
|
144688
146006
|
var SymbolObject = class {
|
|
144689
146007
|
constructor(flags, name) {
|
|
144690
|
-
this.id = 0;
|
|
144691
|
-
this.mergeId = 0;
|
|
144692
146008
|
this.flags = flags;
|
|
144693
146009
|
this.escapedName = name;
|
|
146010
|
+
this.declarations = void 0;
|
|
146011
|
+
this.valueDeclaration = void 0;
|
|
146012
|
+
this.id = 0;
|
|
146013
|
+
this.mergeId = 0;
|
|
146014
|
+
this.parent = void 0;
|
|
146015
|
+
this.members = void 0;
|
|
146016
|
+
this.exports = void 0;
|
|
146017
|
+
this.exportSymbol = void 0;
|
|
146018
|
+
this.constEnumOnlyModule = void 0;
|
|
146019
|
+
this.isReferenced = void 0;
|
|
146020
|
+
this.lastAssignmentPos = void 0;
|
|
146021
|
+
this.links = void 0;
|
|
144694
146022
|
}
|
|
144695
146023
|
getFlags() {
|
|
144696
146024
|
return this.flags;
|
|
@@ -144770,34 +146098,29 @@ var SymbolObject = class {
|
|
|
144770
146098
|
};
|
|
144771
146099
|
var TokenObject = class extends TokenOrIdentifierObject {
|
|
144772
146100
|
constructor(kind, pos, end) {
|
|
144773
|
-
super(pos, end);
|
|
144774
|
-
this.kind = kind;
|
|
146101
|
+
super(kind, pos, end);
|
|
144775
146102
|
}
|
|
144776
146103
|
};
|
|
144777
146104
|
var IdentifierObject = class extends TokenOrIdentifierObject {
|
|
144778
|
-
constructor(
|
|
144779
|
-
super(pos, end);
|
|
144780
|
-
this.kind = 80 /* Identifier */;
|
|
146105
|
+
constructor(kind, pos, end) {
|
|
146106
|
+
super(kind, pos, end);
|
|
144781
146107
|
}
|
|
144782
146108
|
get text() {
|
|
144783
146109
|
return idText(this);
|
|
144784
146110
|
}
|
|
144785
146111
|
};
|
|
144786
|
-
IdentifierObject.prototype.kind = 80 /* Identifier */;
|
|
144787
146112
|
var PrivateIdentifierObject = class extends TokenOrIdentifierObject {
|
|
144788
|
-
constructor(
|
|
144789
|
-
super(pos, end);
|
|
144790
|
-
this.kind = 81 /* PrivateIdentifier */;
|
|
146113
|
+
constructor(kind, pos, end) {
|
|
146114
|
+
super(kind, pos, end);
|
|
144791
146115
|
}
|
|
144792
146116
|
get text() {
|
|
144793
146117
|
return idText(this);
|
|
144794
146118
|
}
|
|
144795
146119
|
};
|
|
144796
|
-
PrivateIdentifierObject.prototype.kind = 81 /* PrivateIdentifier */;
|
|
144797
146120
|
var TypeObject = class {
|
|
144798
146121
|
constructor(checker, flags) {
|
|
144799
|
-
this.checker = checker;
|
|
144800
146122
|
this.flags = flags;
|
|
146123
|
+
this.checker = checker;
|
|
144801
146124
|
}
|
|
144802
146125
|
getFlags() {
|
|
144803
146126
|
return this.flags;
|
|
@@ -144887,8 +146210,8 @@ var TypeObject = class {
|
|
|
144887
146210
|
var SignatureObject = class {
|
|
144888
146211
|
// same
|
|
144889
146212
|
constructor(checker, flags) {
|
|
144890
|
-
this.checker = checker;
|
|
144891
146213
|
this.flags = flags;
|
|
146214
|
+
this.checker = checker;
|
|
144892
146215
|
}
|
|
144893
146216
|
getDeclaration() {
|
|
144894
146217
|
return this.declaration;
|
|
@@ -144984,7 +146307,6 @@ function findBaseOfDeclaration(checker, declaration, cb) {
|
|
|
144984
146307
|
var SourceFileObject = class extends NodeObject {
|
|
144985
146308
|
constructor(kind, pos, end) {
|
|
144986
146309
|
super(kind, pos, end);
|
|
144987
|
-
this.kind = 307 /* SourceFile */;
|
|
144988
146310
|
}
|
|
144989
146311
|
update(newText, textChangeRange) {
|
|
144990
146312
|
return updateSourceFile(this, newText, textChangeRange);
|
|
@@ -145135,7 +146457,7 @@ var SourceMapSourceObject = class {
|
|
|
145135
146457
|
constructor(fileName, text, skipTrivia2) {
|
|
145136
146458
|
this.fileName = fileName;
|
|
145137
146459
|
this.text = text;
|
|
145138
|
-
this.skipTrivia = skipTrivia2;
|
|
146460
|
+
this.skipTrivia = skipTrivia2 || ((pos) => pos);
|
|
145139
146461
|
}
|
|
145140
146462
|
getLineAndCharacterOfPosition(pos) {
|
|
145141
146463
|
return getLineAndCharacterOfPosition(this, pos);
|
|
@@ -145778,6 +147100,9 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
145778
147100
|
function shouldGetType(sourceFile, node, position) {
|
|
145779
147101
|
switch (node.kind) {
|
|
145780
147102
|
case 80 /* Identifier */:
|
|
147103
|
+
if (node.flags & 16777216 /* JSDoc */ && !isInJSFile(node) && (node.parent.kind === 171 /* PropertySignature */ && node.parent.name === node || findAncestor(node, (n) => n.kind === 169 /* Parameter */))) {
|
|
147104
|
+
return false;
|
|
147105
|
+
}
|
|
145781
147106
|
return !isLabelName(node) && !isTagName(node) && !isConstTypeReference(node.parent);
|
|
145782
147107
|
case 211 /* PropertyAccessExpression */:
|
|
145783
147108
|
case 166 /* QualifiedName */:
|
|
@@ -173826,6 +175151,7 @@ __export(ts_exports2, {
|
|
|
173826
175151
|
SignatureKind: () => SignatureKind,
|
|
173827
175152
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
173828
175153
|
SnippetKind: () => SnippetKind,
|
|
175154
|
+
StatisticType: () => StatisticType,
|
|
173829
175155
|
StructureIsReused: () => StructureIsReused,
|
|
173830
175156
|
SymbolAccessibility: () => SymbolAccessibility,
|
|
173831
175157
|
SymbolDisplay: () => ts_SymbolDisplay_exports,
|
|
@@ -174074,6 +175400,7 @@ __export(ts_exports2, {
|
|
|
174074
175400
|
createExternalHelpersImportDeclarationIfNeeded: () => createExternalHelpersImportDeclarationIfNeeded,
|
|
174075
175401
|
createFileDiagnostic: () => createFileDiagnostic,
|
|
174076
175402
|
createFileDiagnosticFromMessageChain: () => createFileDiagnosticFromMessageChain,
|
|
175403
|
+
createFlowNode: () => createFlowNode,
|
|
174077
175404
|
createForOfBindingStatement: () => createForOfBindingStatement,
|
|
174078
175405
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
174079
175406
|
createGetSourceFile: () => createGetSourceFile,
|
|
@@ -174205,7 +175532,9 @@ __export(ts_exports2, {
|
|
|
174205
175532
|
escapeSnippetText: () => escapeSnippetText,
|
|
174206
175533
|
escapeString: () => escapeString,
|
|
174207
175534
|
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
175535
|
+
evaluatorResult: () => evaluatorResult,
|
|
174208
175536
|
every: () => every,
|
|
175537
|
+
executeCommandLine: () => executeCommandLine,
|
|
174209
175538
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
174210
175539
|
explainFiles: () => explainFiles,
|
|
174211
175540
|
explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
|
|
@@ -174571,6 +175900,7 @@ __export(ts_exports2, {
|
|
|
174571
175900
|
getNewLineOrDefaultFromHost: () => getNewLineOrDefaultFromHost,
|
|
174572
175901
|
getNewTargetContainer: () => getNewTargetContainer,
|
|
174573
175902
|
getNextJSDocCommentLocation: () => getNextJSDocCommentLocation,
|
|
175903
|
+
getNodeChildren: () => getNodeChildren,
|
|
174574
175904
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
174575
175905
|
getNodeId: () => getNodeId,
|
|
174576
175906
|
getNodeKind: () => getNodeKind,
|
|
@@ -174893,6 +176223,7 @@ __export(ts_exports2, {
|
|
|
174893
176223
|
isBooleanLiteral: () => isBooleanLiteral,
|
|
174894
176224
|
isBreakOrContinueStatement: () => isBreakOrContinueStatement,
|
|
174895
176225
|
isBreakStatement: () => isBreakStatement,
|
|
176226
|
+
isBuild: () => isBuild,
|
|
174896
176227
|
isBuildInfoFile: () => isBuildInfoFile,
|
|
174897
176228
|
isBuilderProgram: () => isBuilderProgram2,
|
|
174898
176229
|
isBundle: () => isBundle,
|
|
@@ -175424,7 +176755,6 @@ __export(ts_exports2, {
|
|
|
175424
176755
|
isSuperProperty: () => isSuperProperty,
|
|
175425
176756
|
isSupportedSourceFileName: () => isSupportedSourceFileName,
|
|
175426
176757
|
isSwitchStatement: () => isSwitchStatement,
|
|
175427
|
-
isSyntacticallyString: () => isSyntacticallyString,
|
|
175428
176758
|
isSyntaxList: () => isSyntaxList,
|
|
175429
176759
|
isSyntheticExpression: () => isSyntheticExpression,
|
|
175430
176760
|
isSyntheticReference: () => isSyntheticReference,
|
|
@@ -175756,6 +177086,7 @@ __export(ts_exports2, {
|
|
|
175756
177086
|
setInternalEmitFlags: () => setInternalEmitFlags,
|
|
175757
177087
|
setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
|
|
175758
177088
|
setModuleDefaultHelper: () => setModuleDefaultHelper,
|
|
177089
|
+
setNodeChildren: () => setNodeChildren,
|
|
175759
177090
|
setNodeFlags: () => setNodeFlags,
|
|
175760
177091
|
setObjectAllocator: () => setObjectAllocator,
|
|
175761
177092
|
setOriginalNode: () => setOriginalNode,
|
|
@@ -175950,6 +177281,7 @@ __export(ts_exports2, {
|
|
|
175950
177281
|
unorderedRemoveItem: () => unorderedRemoveItem,
|
|
175951
177282
|
unorderedRemoveItemAt: () => unorderedRemoveItemAt,
|
|
175952
177283
|
unreachableCodeIsError: () => unreachableCodeIsError,
|
|
177284
|
+
unsetNodeChildren: () => unsetNodeChildren,
|
|
175953
177285
|
unusedLabelIsError: () => unusedLabelIsError,
|
|
175954
177286
|
unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
|
|
175955
177287
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
@@ -188042,6 +189374,7 @@ if (typeof console !== "undefined") {
|
|
|
188042
189374
|
SignatureKind,
|
|
188043
189375
|
SmartSelectionRange,
|
|
188044
189376
|
SnippetKind,
|
|
189377
|
+
StatisticType,
|
|
188045
189378
|
StructureIsReused,
|
|
188046
189379
|
SymbolAccessibility,
|
|
188047
189380
|
SymbolDisplay,
|
|
@@ -188290,6 +189623,7 @@ if (typeof console !== "undefined") {
|
|
|
188290
189623
|
createExternalHelpersImportDeclarationIfNeeded,
|
|
188291
189624
|
createFileDiagnostic,
|
|
188292
189625
|
createFileDiagnosticFromMessageChain,
|
|
189626
|
+
createFlowNode,
|
|
188293
189627
|
createForOfBindingStatement,
|
|
188294
189628
|
createGetCanonicalFileName,
|
|
188295
189629
|
createGetSourceFile,
|
|
@@ -188421,7 +189755,9 @@ if (typeof console !== "undefined") {
|
|
|
188421
189755
|
escapeSnippetText,
|
|
188422
189756
|
escapeString,
|
|
188423
189757
|
escapeTemplateSubstitution,
|
|
189758
|
+
evaluatorResult,
|
|
188424
189759
|
every,
|
|
189760
|
+
executeCommandLine,
|
|
188425
189761
|
expandPreOrPostfixIncrementOrDecrementExpression,
|
|
188426
189762
|
explainFiles,
|
|
188427
189763
|
explainIfFileIsRedirectAndImpliedFormat,
|
|
@@ -188787,6 +190123,7 @@ if (typeof console !== "undefined") {
|
|
|
188787
190123
|
getNewLineOrDefaultFromHost,
|
|
188788
190124
|
getNewTargetContainer,
|
|
188789
190125
|
getNextJSDocCommentLocation,
|
|
190126
|
+
getNodeChildren,
|
|
188790
190127
|
getNodeForGeneratedName,
|
|
188791
190128
|
getNodeId,
|
|
188792
190129
|
getNodeKind,
|
|
@@ -189109,6 +190446,7 @@ if (typeof console !== "undefined") {
|
|
|
189109
190446
|
isBooleanLiteral,
|
|
189110
190447
|
isBreakOrContinueStatement,
|
|
189111
190448
|
isBreakStatement,
|
|
190449
|
+
isBuild,
|
|
189112
190450
|
isBuildInfoFile,
|
|
189113
190451
|
isBuilderProgram,
|
|
189114
190452
|
isBundle,
|
|
@@ -189640,7 +190978,6 @@ if (typeof console !== "undefined") {
|
|
|
189640
190978
|
isSuperProperty,
|
|
189641
190979
|
isSupportedSourceFileName,
|
|
189642
190980
|
isSwitchStatement,
|
|
189643
|
-
isSyntacticallyString,
|
|
189644
190981
|
isSyntaxList,
|
|
189645
190982
|
isSyntheticExpression,
|
|
189646
190983
|
isSyntheticReference,
|
|
@@ -189972,6 +191309,7 @@ if (typeof console !== "undefined") {
|
|
|
189972
191309
|
setInternalEmitFlags,
|
|
189973
191310
|
setLocalizedDiagnosticMessages,
|
|
189974
191311
|
setModuleDefaultHelper,
|
|
191312
|
+
setNodeChildren,
|
|
189975
191313
|
setNodeFlags,
|
|
189976
191314
|
setObjectAllocator,
|
|
189977
191315
|
setOriginalNode,
|
|
@@ -190166,6 +191504,7 @@ if (typeof console !== "undefined") {
|
|
|
190166
191504
|
unorderedRemoveItem,
|
|
190167
191505
|
unorderedRemoveItemAt,
|
|
190168
191506
|
unreachableCodeIsError,
|
|
191507
|
+
unsetNodeChildren,
|
|
190169
191508
|
unusedLabelIsError,
|
|
190170
191509
|
unwrapInnermostStatementOfLabel,
|
|
190171
191510
|
updateErrorForNoInputFiles,
|