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