@typescript-deploys/pr-build 5.5.0-pr-58065-2 → 5.5.0-pr-58045-49
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 +220 -153
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +268 -190
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240404`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -11747,8 +11747,11 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
11747
11747
|
if (includeJsDoc && hasJSDocNodes(node)) {
|
|
11748
11748
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
11749
11749
|
}
|
|
11750
|
-
if (node.kind === 352 /* SyntaxList */
|
|
11751
|
-
|
|
11750
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
11751
|
+
const first2 = firstOrUndefined(getNodeChildren(node));
|
|
11752
|
+
if (first2) {
|
|
11753
|
+
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
|
|
11754
|
+
}
|
|
11752
11755
|
}
|
|
11753
11756
|
return skipTrivia(
|
|
11754
11757
|
(sourceFile || getSourceFileOfNode(node)).text,
|
|
@@ -17687,79 +17690,81 @@ function replaceFirstStar(s, replacement) {
|
|
|
17687
17690
|
function getNameFromImportAttribute(node) {
|
|
17688
17691
|
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
17689
17692
|
}
|
|
17690
|
-
function isSyntacticallyString
|
|
17691
|
-
|
|
17692
|
-
switch (expr.kind) {
|
|
17693
|
-
case 226 /* BinaryExpression */:
|
|
17694
|
-
const left = expr.left;
|
|
17695
|
-
const right = expr.right;
|
|
17696
|
-
return expr.operatorToken.kind === 40 /* PlusToken */ && (isSyntacticallyString(left) || isSyntacticallyString(right));
|
|
17697
|
-
case 228 /* TemplateExpression */:
|
|
17698
|
-
case 11 /* StringLiteral */:
|
|
17699
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
17700
|
-
return true;
|
|
17701
|
-
}
|
|
17702
|
-
return false;
|
|
17693
|
+
function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false) {
|
|
17694
|
+
return { value, isSyntacticallyString, resolvedOtherFiles };
|
|
17703
17695
|
}
|
|
17704
17696
|
function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
|
|
17705
17697
|
function evaluate(expr, location) {
|
|
17698
|
+
let isSyntacticallyString = false;
|
|
17699
|
+
let resolvedOtherFiles = false;
|
|
17700
|
+
expr = skipParentheses(expr);
|
|
17706
17701
|
switch (expr.kind) {
|
|
17707
17702
|
case 224 /* PrefixUnaryExpression */:
|
|
17708
|
-
const
|
|
17709
|
-
|
|
17703
|
+
const result = evaluate(expr.operand, location);
|
|
17704
|
+
resolvedOtherFiles = result.resolvedOtherFiles;
|
|
17705
|
+
if (typeof result.value === "number") {
|
|
17710
17706
|
switch (expr.operator) {
|
|
17711
17707
|
case 40 /* PlusToken */:
|
|
17712
|
-
return value;
|
|
17708
|
+
return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17713
17709
|
case 41 /* MinusToken */:
|
|
17714
|
-
return -value;
|
|
17710
|
+
return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17715
17711
|
case 55 /* TildeToken */:
|
|
17716
|
-
return ~value;
|
|
17712
|
+
return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17717
17713
|
}
|
|
17718
17714
|
}
|
|
17719
17715
|
break;
|
|
17720
|
-
case 226 /* BinaryExpression */:
|
|
17716
|
+
case 226 /* BinaryExpression */: {
|
|
17721
17717
|
const left = evaluate(expr.left, location);
|
|
17722
17718
|
const right = evaluate(expr.right, location);
|
|
17723
|
-
|
|
17719
|
+
isSyntacticallyString = (left.isSyntacticallyString || right.isSyntacticallyString) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
17720
|
+
resolvedOtherFiles = left.resolvedOtherFiles || right.resolvedOtherFiles;
|
|
17721
|
+
if (typeof left.value === "number" && typeof right.value === "number") {
|
|
17724
17722
|
switch (expr.operatorToken.kind) {
|
|
17725
17723
|
case 52 /* BarToken */:
|
|
17726
|
-
return left | right;
|
|
17724
|
+
return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17727
17725
|
case 51 /* AmpersandToken */:
|
|
17728
|
-
return left & right;
|
|
17726
|
+
return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17729
17727
|
case 49 /* GreaterThanGreaterThanToken */:
|
|
17730
|
-
return left >> right;
|
|
17728
|
+
return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17731
17729
|
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
17732
|
-
return left >>> right;
|
|
17730
|
+
return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17733
17731
|
case 48 /* LessThanLessThanToken */:
|
|
17734
|
-
return left << right;
|
|
17732
|
+
return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17735
17733
|
case 53 /* CaretToken */:
|
|
17736
|
-
return left ^ right;
|
|
17734
|
+
return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17737
17735
|
case 42 /* AsteriskToken */:
|
|
17738
|
-
return left * right;
|
|
17736
|
+
return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17739
17737
|
case 44 /* SlashToken */:
|
|
17740
|
-
return left / right;
|
|
17738
|
+
return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17741
17739
|
case 40 /* PlusToken */:
|
|
17742
|
-
return left + right;
|
|
17740
|
+
return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17743
17741
|
case 41 /* MinusToken */:
|
|
17744
|
-
return left - right;
|
|
17742
|
+
return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17745
17743
|
case 45 /* PercentToken */:
|
|
17746
|
-
return left % right;
|
|
17744
|
+
return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17747
17745
|
case 43 /* AsteriskAsteriskToken */:
|
|
17748
|
-
return left ** right;
|
|
17746
|
+
return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
17749
17747
|
}
|
|
17750
|
-
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
17751
|
-
return
|
|
17748
|
+
} else if ((typeof left.value === "string" || typeof left.value === "number") && (typeof right.value === "string" || typeof right.value === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
17749
|
+
return evaluatorResult(
|
|
17750
|
+
"" + left.value + right.value,
|
|
17751
|
+
isSyntacticallyString,
|
|
17752
|
+
resolvedOtherFiles
|
|
17753
|
+
);
|
|
17752
17754
|
}
|
|
17753
17755
|
break;
|
|
17756
|
+
}
|
|
17754
17757
|
case 11 /* StringLiteral */:
|
|
17755
17758
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
17756
|
-
return
|
|
17759
|
+
return evaluatorResult(
|
|
17760
|
+
expr.text,
|
|
17761
|
+
/*isSyntacticallyString*/
|
|
17762
|
+
true
|
|
17763
|
+
);
|
|
17757
17764
|
case 228 /* TemplateExpression */:
|
|
17758
17765
|
return evaluateTemplateExpression(expr, location);
|
|
17759
17766
|
case 9 /* NumericLiteral */:
|
|
17760
|
-
return +expr.text;
|
|
17761
|
-
case 217 /* ParenthesizedExpression */:
|
|
17762
|
-
return evaluate(expr.expression, location);
|
|
17767
|
+
return evaluatorResult(+expr.text);
|
|
17763
17768
|
case 80 /* Identifier */:
|
|
17764
17769
|
return evaluateEntityNameExpression(expr, location);
|
|
17765
17770
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -17770,19 +17775,36 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
17770
17775
|
case 212 /* ElementAccessExpression */:
|
|
17771
17776
|
return evaluateElementAccessExpression(expr, location);
|
|
17772
17777
|
}
|
|
17773
|
-
return
|
|
17778
|
+
return evaluatorResult(
|
|
17779
|
+
/*value*/
|
|
17780
|
+
void 0,
|
|
17781
|
+
isSyntacticallyString,
|
|
17782
|
+
resolvedOtherFiles
|
|
17783
|
+
);
|
|
17774
17784
|
}
|
|
17775
17785
|
function evaluateTemplateExpression(expr, location) {
|
|
17776
17786
|
let result = expr.head.text;
|
|
17787
|
+
let resolvedOtherFiles = false;
|
|
17777
17788
|
for (const span of expr.templateSpans) {
|
|
17778
|
-
const
|
|
17779
|
-
if (value === void 0) {
|
|
17780
|
-
return
|
|
17789
|
+
const spanResult = evaluate(span.expression, location);
|
|
17790
|
+
if (spanResult.value === void 0) {
|
|
17791
|
+
return evaluatorResult(
|
|
17792
|
+
/*value*/
|
|
17793
|
+
void 0,
|
|
17794
|
+
/*isSyntacticallyString*/
|
|
17795
|
+
true
|
|
17796
|
+
);
|
|
17781
17797
|
}
|
|
17782
|
-
result += value;
|
|
17798
|
+
result += spanResult.value;
|
|
17783
17799
|
result += span.literal.text;
|
|
17800
|
+
resolvedOtherFiles || (resolvedOtherFiles = spanResult.resolvedOtherFiles);
|
|
17784
17801
|
}
|
|
17785
|
-
return
|
|
17802
|
+
return evaluatorResult(
|
|
17803
|
+
result,
|
|
17804
|
+
/*isSyntacticallyString*/
|
|
17805
|
+
true,
|
|
17806
|
+
resolvedOtherFiles
|
|
17807
|
+
);
|
|
17786
17808
|
}
|
|
17787
17809
|
return evaluate;
|
|
17788
17810
|
}
|
|
@@ -21926,7 +21948,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21926
21948
|
}
|
|
21927
21949
|
function createSyntaxList(children) {
|
|
21928
21950
|
const node = createBaseNode(352 /* SyntaxList */);
|
|
21929
|
-
node
|
|
21951
|
+
setNodeChildren(node, children);
|
|
21930
21952
|
return node;
|
|
21931
21953
|
}
|
|
21932
21954
|
function createNotEmittedStatement(original) {
|
|
@@ -24703,6 +24725,19 @@ function isJSDocImportTag(node) {
|
|
|
24703
24725
|
return node.kind === 351 /* JSDocImportTag */;
|
|
24704
24726
|
}
|
|
24705
24727
|
|
|
24728
|
+
// src/compiler/factory/nodeChildren.ts
|
|
24729
|
+
var nodeChildren = /* @__PURE__ */ new WeakMap();
|
|
24730
|
+
function getNodeChildren(node) {
|
|
24731
|
+
return nodeChildren.get(node);
|
|
24732
|
+
}
|
|
24733
|
+
function setNodeChildren(node, children) {
|
|
24734
|
+
nodeChildren.set(node, children);
|
|
24735
|
+
return children;
|
|
24736
|
+
}
|
|
24737
|
+
function unsetNodeChildren(node) {
|
|
24738
|
+
nodeChildren.delete(node);
|
|
24739
|
+
}
|
|
24740
|
+
|
|
24706
24741
|
// src/compiler/factory/utilities.ts
|
|
24707
24742
|
function createEmptyExports(factory2) {
|
|
24708
24743
|
return factory2.createExportDeclaration(
|
|
@@ -33334,9 +33369,7 @@ var IncrementalParser;
|
|
|
33334
33369
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
33335
33370
|
text = oldText.substring(node.pos, node.end);
|
|
33336
33371
|
}
|
|
33337
|
-
|
|
33338
|
-
node._children = void 0;
|
|
33339
|
-
}
|
|
33372
|
+
unsetNodeChildren(node);
|
|
33340
33373
|
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
|
|
33341
33374
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
33342
33375
|
Debug.assert(text === newText.substring(node.pos, node.end));
|
|
@@ -33350,7 +33383,6 @@ var IncrementalParser;
|
|
|
33350
33383
|
checkNodePositions(node, aggressiveChecks);
|
|
33351
33384
|
}
|
|
33352
33385
|
function visitArray2(array) {
|
|
33353
|
-
array._children = void 0;
|
|
33354
33386
|
setTextRangePosEnd(array, array.pos + delta, array.end + delta);
|
|
33355
33387
|
for (const node of array) {
|
|
33356
33388
|
visitNode3(node);
|
|
@@ -33422,7 +33454,7 @@ var IncrementalParser;
|
|
|
33422
33454
|
const fullEnd = child.end;
|
|
33423
33455
|
if (fullEnd >= changeStart) {
|
|
33424
33456
|
child.intersectsChange = true;
|
|
33425
|
-
child
|
|
33457
|
+
unsetNodeChildren(child);
|
|
33426
33458
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
33427
33459
|
forEachChild(child, visitNode3, visitArray2);
|
|
33428
33460
|
if (hasJSDocNodes(child)) {
|
|
@@ -33452,7 +33484,6 @@ var IncrementalParser;
|
|
|
33452
33484
|
const fullEnd = array.end;
|
|
33453
33485
|
if (fullEnd >= changeStart) {
|
|
33454
33486
|
array.intersectsChange = true;
|
|
33455
|
-
array._children = void 0;
|
|
33456
33487
|
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
33457
33488
|
for (const node of array) {
|
|
33458
33489
|
visitNode3(node);
|
|
@@ -43542,6 +43573,7 @@ function createTypeChecker(host) {
|
|
|
43542
43573
|
isArgumentsSymbol: (symbol) => symbol === argumentsSymbol,
|
|
43543
43574
|
isUnknownSymbol: (symbol) => symbol === unknownSymbol,
|
|
43544
43575
|
getMergedSymbol,
|
|
43576
|
+
symbolIsValue,
|
|
43545
43577
|
getDiagnostics,
|
|
43546
43578
|
getGlobalDiagnostics,
|
|
43547
43579
|
getRecursionIdentity,
|
|
@@ -49934,7 +49966,16 @@ function createTypeChecker(host) {
|
|
|
49934
49966
|
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
49935
49967
|
}
|
|
49936
49968
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
49937
|
-
|
|
49969
|
+
if (!(getObjectFlags(type) & 4 /* Reference */))
|
|
49970
|
+
return true;
|
|
49971
|
+
if (!isTypeReferenceNode(existing))
|
|
49972
|
+
return true;
|
|
49973
|
+
void getTypeFromTypeReference(existing);
|
|
49974
|
+
const symbol = getNodeLinks(existing).resolvedSymbol;
|
|
49975
|
+
const existingTarget = symbol && getDeclaredTypeOfSymbol(symbol);
|
|
49976
|
+
if (!existingTarget || existingTarget !== type.target)
|
|
49977
|
+
return true;
|
|
49978
|
+
return length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
49938
49979
|
}
|
|
49939
49980
|
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
49940
49981
|
while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
|
|
@@ -50039,14 +50080,27 @@ function createTypeChecker(host) {
|
|
|
50039
50080
|
} else {
|
|
50040
50081
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
50041
50082
|
}
|
|
50042
|
-
|
|
50083
|
+
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
50084
|
+
}
|
|
50085
|
+
return { introducesError, node };
|
|
50086
|
+
function attachSymbolToLeftmostIdentifier(node2) {
|
|
50087
|
+
if (node2 === leftmost) {
|
|
50043
50088
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
50044
|
-
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(
|
|
50089
|
+
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
|
|
50045
50090
|
name.symbol = sym;
|
|
50046
|
-
return
|
|
50091
|
+
return setTextRange(setEmitFlags(setOriginalNode(name, node2), 16777216 /* NoAsciiEscaping */), node2);
|
|
50047
50092
|
}
|
|
50093
|
+
const updated = visitEachChild(
|
|
50094
|
+
node2,
|
|
50095
|
+
(c) => attachSymbolToLeftmostIdentifier(c),
|
|
50096
|
+
/*context*/
|
|
50097
|
+
void 0
|
|
50098
|
+
);
|
|
50099
|
+
if (updated !== node2) {
|
|
50100
|
+
setTextRange(updated, node2);
|
|
50101
|
+
}
|
|
50102
|
+
return updated;
|
|
50048
50103
|
}
|
|
50049
|
-
return { introducesError, node };
|
|
50050
50104
|
}
|
|
50051
50105
|
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
50052
50106
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
@@ -50207,11 +50261,12 @@ function createTypeChecker(host) {
|
|
|
50207
50261
|
return visited;
|
|
50208
50262
|
}
|
|
50209
50263
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
50264
|
+
if (isDeclarationName(node)) {
|
|
50265
|
+
return node;
|
|
50266
|
+
}
|
|
50210
50267
|
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
50211
50268
|
hadError = hadError || introducesError;
|
|
50212
|
-
|
|
50213
|
-
return result;
|
|
50214
|
-
}
|
|
50269
|
+
return result;
|
|
50215
50270
|
}
|
|
50216
50271
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
50217
50272
|
const visited = visitEachChild(
|
|
@@ -53740,7 +53795,7 @@ function createTypeChecker(host) {
|
|
|
53740
53795
|
for (const member of declaration.members) {
|
|
53741
53796
|
if (hasBindableName(member)) {
|
|
53742
53797
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
53743
|
-
const value = getEnumMemberValue(member);
|
|
53798
|
+
const value = getEnumMemberValue(member).value;
|
|
53744
53799
|
const memberType = getFreshTypeOfLiteralType(
|
|
53745
53800
|
value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol)
|
|
53746
53801
|
);
|
|
@@ -60876,8 +60931,8 @@ function createTypeChecker(host) {
|
|
|
60876
60931
|
}
|
|
60877
60932
|
return false;
|
|
60878
60933
|
}
|
|
60879
|
-
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
|
|
60880
|
-
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
|
|
60934
|
+
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */)).value;
|
|
60935
|
+
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */)).value;
|
|
60881
60936
|
if (sourceValue !== targetValue) {
|
|
60882
60937
|
const sourceIsString = typeof sourceValue === "string";
|
|
60883
60938
|
const targetIsString = typeof targetValue === "string";
|
|
@@ -75985,7 +76040,7 @@ function createTypeChecker(host) {
|
|
|
75985
76040
|
) || unknownType, isTemplateLiteralContextualType)) {
|
|
75986
76041
|
return getTemplateLiteralType(texts, types);
|
|
75987
76042
|
}
|
|
75988
|
-
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
|
|
76043
|
+
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node).value;
|
|
75989
76044
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
75990
76045
|
}
|
|
75991
76046
|
function isTemplateLiteralContextualType(type) {
|
|
@@ -80890,14 +80945,14 @@ function createTypeChecker(host) {
|
|
|
80890
80945
|
let autoValue = 0;
|
|
80891
80946
|
let previous;
|
|
80892
80947
|
for (const member of node.members) {
|
|
80893
|
-
const
|
|
80894
|
-
getNodeLinks(member).enumMemberValue =
|
|
80895
|
-
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
80948
|
+
const result = computeEnumMemberValue(member, autoValue, previous);
|
|
80949
|
+
getNodeLinks(member).enumMemberValue = result;
|
|
80950
|
+
autoValue = typeof result.value === "number" ? result.value + 1 : void 0;
|
|
80896
80951
|
previous = member;
|
|
80897
80952
|
}
|
|
80898
80953
|
}
|
|
80899
80954
|
}
|
|
80900
|
-
function
|
|
80955
|
+
function computeEnumMemberValue(member, autoValue, previous) {
|
|
80901
80956
|
if (isComputedNonLiteralName(member.name)) {
|
|
80902
80957
|
error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
80903
80958
|
} else {
|
|
@@ -80907,34 +80962,43 @@ function createTypeChecker(host) {
|
|
|
80907
80962
|
}
|
|
80908
80963
|
}
|
|
80909
80964
|
if (member.initializer) {
|
|
80910
|
-
return
|
|
80965
|
+
return computeConstantEnumMemberValue(member);
|
|
80911
80966
|
}
|
|
80912
80967
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
80913
|
-
return
|
|
80968
|
+
return evaluatorResult(
|
|
80969
|
+
/*value*/
|
|
80970
|
+
void 0
|
|
80971
|
+
);
|
|
80914
80972
|
}
|
|
80915
80973
|
if (autoValue === void 0) {
|
|
80916
80974
|
error(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
80917
|
-
return
|
|
80918
|
-
|
|
80919
|
-
|
|
80920
|
-
error(
|
|
80921
|
-
member.name,
|
|
80922
|
-
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
80975
|
+
return evaluatorResult(
|
|
80976
|
+
/*value*/
|
|
80977
|
+
void 0
|
|
80923
80978
|
);
|
|
80924
80979
|
}
|
|
80925
|
-
|
|
80980
|
+
if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer)) {
|
|
80981
|
+
const prevValue = getEnumMemberValue(previous);
|
|
80982
|
+
if (!(typeof prevValue.value === "number" && !prevValue.resolvedOtherFiles)) {
|
|
80983
|
+
error(
|
|
80984
|
+
member.name,
|
|
80985
|
+
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
80986
|
+
);
|
|
80987
|
+
}
|
|
80988
|
+
}
|
|
80989
|
+
return evaluatorResult(autoValue);
|
|
80926
80990
|
}
|
|
80927
|
-
function
|
|
80991
|
+
function computeConstantEnumMemberValue(member) {
|
|
80928
80992
|
const isConstEnum = isEnumConst(member.parent);
|
|
80929
80993
|
const initializer = member.initializer;
|
|
80930
|
-
const
|
|
80931
|
-
if (value !== void 0) {
|
|
80932
|
-
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
80994
|
+
const result = evaluate(initializer, member);
|
|
80995
|
+
if (result.value !== void 0) {
|
|
80996
|
+
if (isConstEnum && typeof result.value === "number" && !isFinite(result.value)) {
|
|
80933
80997
|
error(
|
|
80934
80998
|
initializer,
|
|
80935
|
-
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
|
|
80999
|
+
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
|
|
80936
81000
|
);
|
|
80937
|
-
} else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString
|
|
81001
|
+
} else if (getIsolatedModules(compilerOptions) && typeof result.value === "string" && !result.isSyntacticallyString) {
|
|
80938
81002
|
error(
|
|
80939
81003
|
initializer,
|
|
80940
81004
|
Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
|
|
@@ -80948,19 +81012,7 @@ function createTypeChecker(host) {
|
|
|
80948
81012
|
} else {
|
|
80949
81013
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
80950
81014
|
}
|
|
80951
|
-
return
|
|
80952
|
-
}
|
|
80953
|
-
function isSyntacticallyNumericConstant(expr) {
|
|
80954
|
-
expr = skipOuterExpressions(expr);
|
|
80955
|
-
switch (expr.kind) {
|
|
80956
|
-
case 224 /* PrefixUnaryExpression */:
|
|
80957
|
-
return isSyntacticallyNumericConstant(expr.operand);
|
|
80958
|
-
case 226 /* BinaryExpression */:
|
|
80959
|
-
return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
|
|
80960
|
-
case 9 /* NumericLiteral */:
|
|
80961
|
-
return true;
|
|
80962
|
-
}
|
|
80963
|
-
return false;
|
|
81015
|
+
return result;
|
|
80964
81016
|
}
|
|
80965
81017
|
function evaluateEntityNameExpression(expr, location) {
|
|
80966
81018
|
const symbol = resolveEntityName(
|
|
@@ -80970,7 +81022,10 @@ function createTypeChecker(host) {
|
|
|
80970
81022
|
true
|
|
80971
81023
|
);
|
|
80972
81024
|
if (!symbol)
|
|
80973
|
-
return
|
|
81025
|
+
return evaluatorResult(
|
|
81026
|
+
/*value*/
|
|
81027
|
+
void 0
|
|
81028
|
+
);
|
|
80974
81029
|
if (expr.kind === 80 /* Identifier */) {
|
|
80975
81030
|
const identifier = expr;
|
|
80976
81031
|
if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
|
|
@@ -80979,7 +81034,11 @@ function createTypeChecker(host) {
|
|
|
80979
81034
|
/*diagnostic*/
|
|
80980
81035
|
void 0
|
|
80981
81036
|
)) {
|
|
80982
|
-
return
|
|
81037
|
+
return evaluatorResult(
|
|
81038
|
+
+identifier.escapedText,
|
|
81039
|
+
/*isSyntacticallyString*/
|
|
81040
|
+
false
|
|
81041
|
+
);
|
|
80983
81042
|
}
|
|
80984
81043
|
}
|
|
80985
81044
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
@@ -80988,9 +81047,23 @@ function createTypeChecker(host) {
|
|
|
80988
81047
|
if (isConstantVariable(symbol)) {
|
|
80989
81048
|
const declaration = symbol.valueDeclaration;
|
|
80990
81049
|
if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
80991
|
-
|
|
81050
|
+
const result = evaluate(declaration.initializer, declaration);
|
|
81051
|
+
if (location && getSourceFileOfNode(location) !== getSourceFileOfNode(declaration)) {
|
|
81052
|
+
return evaluatorResult(
|
|
81053
|
+
result.value,
|
|
81054
|
+
/*isSyntacticallyString*/
|
|
81055
|
+
false,
|
|
81056
|
+
/*resolvedOtherFiles*/
|
|
81057
|
+
true
|
|
81058
|
+
);
|
|
81059
|
+
}
|
|
81060
|
+
return result;
|
|
80992
81061
|
}
|
|
80993
81062
|
}
|
|
81063
|
+
return evaluatorResult(
|
|
81064
|
+
/*value*/
|
|
81065
|
+
void 0
|
|
81066
|
+
);
|
|
80994
81067
|
}
|
|
80995
81068
|
function evaluateElementAccessExpression(expr, location) {
|
|
80996
81069
|
const root = expr.expression;
|
|
@@ -81005,20 +81078,31 @@ function createTypeChecker(host) {
|
|
|
81005
81078
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
81006
81079
|
const member = rootSymbol.exports.get(name);
|
|
81007
81080
|
if (member) {
|
|
81081
|
+
Debug.assert(getSourceFileOfNode(member.valueDeclaration) === getSourceFileOfNode(rootSymbol.valueDeclaration));
|
|
81008
81082
|
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
81009
81083
|
}
|
|
81010
81084
|
}
|
|
81011
81085
|
}
|
|
81086
|
+
return evaluatorResult(
|
|
81087
|
+
/*value*/
|
|
81088
|
+
void 0
|
|
81089
|
+
);
|
|
81012
81090
|
}
|
|
81013
81091
|
function evaluateEnumMember(expr, symbol, location) {
|
|
81014
81092
|
const declaration = symbol.valueDeclaration;
|
|
81015
81093
|
if (!declaration || declaration === location) {
|
|
81016
81094
|
error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
81017
|
-
return
|
|
81095
|
+
return evaluatorResult(
|
|
81096
|
+
/*value*/
|
|
81097
|
+
void 0
|
|
81098
|
+
);
|
|
81018
81099
|
}
|
|
81019
81100
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81020
81101
|
error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
81021
|
-
return
|
|
81102
|
+
return evaluatorResult(
|
|
81103
|
+
/*value*/
|
|
81104
|
+
0
|
|
81105
|
+
);
|
|
81022
81106
|
}
|
|
81023
81107
|
return getEnumMemberValue(declaration);
|
|
81024
81108
|
}
|
|
@@ -83159,7 +83243,10 @@ function createTypeChecker(host) {
|
|
|
83159
83243
|
}
|
|
83160
83244
|
function getEnumMemberValue(node) {
|
|
83161
83245
|
computeEnumMemberValues(node.parent);
|
|
83162
|
-
return getNodeLinks(node).enumMemberValue
|
|
83246
|
+
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
83247
|
+
/*value*/
|
|
83248
|
+
void 0
|
|
83249
|
+
);
|
|
83163
83250
|
}
|
|
83164
83251
|
function canHaveConstantValue(node) {
|
|
83165
83252
|
switch (node.kind) {
|
|
@@ -83172,13 +83259,13 @@ function createTypeChecker(host) {
|
|
|
83172
83259
|
}
|
|
83173
83260
|
function getConstantValue2(node) {
|
|
83174
83261
|
if (node.kind === 306 /* EnumMember */) {
|
|
83175
|
-
return getEnumMemberValue(node);
|
|
83262
|
+
return getEnumMemberValue(node).value;
|
|
83176
83263
|
}
|
|
83177
83264
|
const symbol = getNodeLinks(node).resolvedSymbol;
|
|
83178
83265
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
83179
83266
|
const member = symbol.valueDeclaration;
|
|
83180
83267
|
if (isEnumConst(member.parent)) {
|
|
83181
|
-
return getEnumMemberValue(member);
|
|
83268
|
+
return getEnumMemberValue(member).value;
|
|
83182
83269
|
}
|
|
83183
83270
|
}
|
|
83184
83271
|
return void 0;
|
|
@@ -83553,6 +83640,10 @@ function createTypeChecker(host) {
|
|
|
83553
83640
|
const node = getParseTreeNode(nodeIn, canHaveConstantValue);
|
|
83554
83641
|
return node ? getConstantValue2(node) : void 0;
|
|
83555
83642
|
},
|
|
83643
|
+
getEnumMemberValue: (nodeIn) => {
|
|
83644
|
+
const node = getParseTreeNode(nodeIn, isEnumMember);
|
|
83645
|
+
return node ? getEnumMemberValue(node) : void 0;
|
|
83646
|
+
},
|
|
83556
83647
|
collectLinkedAliases,
|
|
83557
83648
|
getReferencedValueDeclaration,
|
|
83558
83649
|
getReferencedValueDeclarations,
|
|
@@ -89771,7 +89862,8 @@ function transformTypeScript(context) {
|
|
|
89771
89862
|
/*generateNameForComputedPropertyName*/
|
|
89772
89863
|
false
|
|
89773
89864
|
);
|
|
89774
|
-
const
|
|
89865
|
+
const evaluated = resolver.getEnumMemberValue(member);
|
|
89866
|
+
const valueExpression = transformEnumMemberDeclarationValue(member, evaluated == null ? void 0 : evaluated.value);
|
|
89775
89867
|
const innerAssignment = factory2.createAssignment(
|
|
89776
89868
|
factory2.createElementAccessExpression(
|
|
89777
89869
|
currentNamespaceContainerName,
|
|
@@ -89779,7 +89871,7 @@ function transformTypeScript(context) {
|
|
|
89779
89871
|
),
|
|
89780
89872
|
valueExpression
|
|
89781
89873
|
);
|
|
89782
|
-
const outerAssignment =
|
|
89874
|
+
const outerAssignment = typeof (evaluated == null ? void 0 : evaluated.value) === "string" || (evaluated == null ? void 0 : evaluated.isSyntacticallyString) ? innerAssignment : factory2.createAssignment(
|
|
89783
89875
|
factory2.createElementAccessExpression(
|
|
89784
89876
|
currentNamespaceContainerName,
|
|
89785
89877
|
innerAssignment
|
|
@@ -89796,10 +89888,9 @@ function transformTypeScript(context) {
|
|
|
89796
89888
|
member
|
|
89797
89889
|
);
|
|
89798
89890
|
}
|
|
89799
|
-
function transformEnumMemberDeclarationValue(member) {
|
|
89800
|
-
|
|
89801
|
-
|
|
89802
|
-
return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-value)) : factory2.createNumericLiteral(value);
|
|
89891
|
+
function transformEnumMemberDeclarationValue(member, constantValue) {
|
|
89892
|
+
if (constantValue !== void 0) {
|
|
89893
|
+
return typeof constantValue === "string" ? factory2.createStringLiteral(constantValue) : constantValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-constantValue)) : factory2.createNumericLiteral(constantValue);
|
|
89803
89894
|
} else {
|
|
89804
89895
|
enableSubstitutionForNonQualifiedEnumMembers();
|
|
89805
89896
|
if (member.initializer) {
|
|
@@ -111139,6 +111230,7 @@ var notImplementedResolver = {
|
|
|
111139
111230
|
isEntityNameVisible: notImplemented,
|
|
111140
111231
|
// Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant
|
|
111141
111232
|
getConstantValue: notImplemented,
|
|
111233
|
+
getEnumMemberValue: notImplemented,
|
|
111142
111234
|
getReferencedValueDeclaration: notImplemented,
|
|
111143
111235
|
getReferencedValueDeclarations: notImplemented,
|
|
111144
111236
|
getTypeReferenceSerializationKind: notImplemented,
|
|
@@ -117214,7 +117306,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117214
117306
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
117215
117307
|
isSourceOfProjectReferenceRedirect,
|
|
117216
117308
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
117217
|
-
getRedirectReferenceForResolution,
|
|
117218
117309
|
emitBuildInfo,
|
|
117219
117310
|
fileExists,
|
|
117220
117311
|
readFile,
|
|
@@ -122130,8 +122221,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122130
122221
|
getResolutionWithResolvedFileName,
|
|
122131
122222
|
deferWatchingNonRelativeResolution,
|
|
122132
122223
|
shouldRetryResolution,
|
|
122133
|
-
logChanges
|
|
122134
|
-
canWatchFailedLookups
|
|
122224
|
+
logChanges
|
|
122135
122225
|
}) {
|
|
122136
122226
|
const path = resolutionHost.toPath(containingFile);
|
|
122137
122227
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
@@ -122154,14 +122244,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122154
122244
|
}
|
|
122155
122245
|
resolutionsInFile.set(name, mode, resolution);
|
|
122156
122246
|
if (resolution !== existingResolution) {
|
|
122157
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(
|
|
122158
|
-
name,
|
|
122159
|
-
resolution,
|
|
122160
|
-
path,
|
|
122161
|
-
getResolutionWithResolvedFileName,
|
|
122162
|
-
deferWatchingNonRelativeResolution,
|
|
122163
|
-
(resolution2) => canWatchFailedLookups(resolution2, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options, containingSourceFile)
|
|
122164
|
-
);
|
|
122247
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
122165
122248
|
if (existingResolution) {
|
|
122166
122249
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
122167
122250
|
}
|
|
@@ -122240,8 +122323,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122240
122323
|
),
|
|
122241
122324
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
122242
122325
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
122243
|
-
deferWatchingNonRelativeResolution: false
|
|
122244
|
-
canWatchFailedLookups: canWatchFailedLookupsOfTypeReferencedDirective
|
|
122326
|
+
deferWatchingNonRelativeResolution: false
|
|
122245
122327
|
});
|
|
122246
122328
|
}
|
|
122247
122329
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -122263,9 +122345,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122263
122345
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
122264
122346
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
122265
122347
|
logChanges: logChangesWhenResolvingModule,
|
|
122266
|
-
deferWatchingNonRelativeResolution: true
|
|
122348
|
+
deferWatchingNonRelativeResolution: true
|
|
122267
122349
|
// Defer non relative resolution watch because we could be using ambient modules
|
|
122268
|
-
canWatchFailedLookups: canWatchFailedLookupsOfResolvedModule
|
|
122269
122350
|
});
|
|
122270
122351
|
}
|
|
122271
122352
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
@@ -122281,8 +122362,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122281
122362
|
path,
|
|
122282
122363
|
getResolvedModule,
|
|
122283
122364
|
/*deferWatchingNonRelativeResolution*/
|
|
122284
|
-
false
|
|
122285
|
-
canWatchFailedLookupsOfResolvedLibrary
|
|
122365
|
+
false
|
|
122286
122366
|
);
|
|
122287
122367
|
resolvedLibraries.set(libFileName, resolution);
|
|
122288
122368
|
if (existingResolution) {
|
|
@@ -122329,18 +122409,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122329
122409
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
122330
122410
|
return endsWith(dirPath, "/node_modules/@types");
|
|
122331
122411
|
}
|
|
122332
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution
|
|
122333
|
-
var _a
|
|
122412
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
122413
|
+
var _a;
|
|
122334
122414
|
if (resolution.refCount) {
|
|
122335
122415
|
resolution.refCount++;
|
|
122336
122416
|
Debug.assertIsDefined(resolution.files);
|
|
122337
122417
|
} else {
|
|
122338
122418
|
resolution.refCount = 1;
|
|
122339
122419
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
122340
|
-
if (((_b = resolution.failedLookupLocations) == null ? void 0 : _b.length) && canWatchFailedLookups(resolution))
|
|
122341
|
-
resolution.canWatchFailedLookups = true;
|
|
122342
122420
|
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
122343
|
-
|
|
122421
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
122344
122422
|
} else {
|
|
122345
122423
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
122346
122424
|
}
|
|
@@ -122376,16 +122454,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122376
122454
|
}
|
|
122377
122455
|
return setAtRoot;
|
|
122378
122456
|
}
|
|
122379
|
-
function
|
|
122457
|
+
function watchFailedLookupLocationOfResolution(resolution) {
|
|
122380
122458
|
Debug.assert(!!resolution.refCount);
|
|
122381
122459
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
122382
122460
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult)
|
|
122383
122461
|
return;
|
|
122384
|
-
|
|
122385
|
-
if (addToFailedLookup)
|
|
122462
|
+
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult)
|
|
122386
122463
|
resolutionsWithFailedLookups.add(resolution);
|
|
122387
122464
|
let setAtRoot = false;
|
|
122388
|
-
if (
|
|
122465
|
+
if (failedLookupLocations) {
|
|
122389
122466
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
122390
122467
|
setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
|
|
122391
122468
|
}
|
|
@@ -122400,7 +122477,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122400
122477
|
true
|
|
122401
122478
|
);
|
|
122402
122479
|
}
|
|
122403
|
-
watchAffectingLocationsOfResolution(resolution, !
|
|
122480
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
122404
122481
|
}
|
|
122405
122482
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
122406
122483
|
Debug.assert(!!resolution.refCount);
|
|
@@ -122487,7 +122564,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122487
122564
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
122488
122565
|
const program = resolutionHost.getCurrentProgram();
|
|
122489
122566
|
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
122490
|
-
resolutions.forEach(
|
|
122567
|
+
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
122491
122568
|
} else {
|
|
122492
122569
|
resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
|
|
122493
122570
|
resolution,
|
|
@@ -122538,10 +122615,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122538
122615
|
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
|
|
122539
122616
|
resolvedFileToResolution.delete(key);
|
|
122540
122617
|
}
|
|
122541
|
-
const {
|
|
122618
|
+
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
122542
122619
|
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
122543
122620
|
let removeAtRoot = false;
|
|
122544
|
-
if (
|
|
122621
|
+
if (failedLookupLocations) {
|
|
122545
122622
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
122546
122623
|
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
122547
122624
|
}
|
|
@@ -122714,7 +122791,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122714
122791
|
return true;
|
|
122715
122792
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
122716
122793
|
return false;
|
|
122717
|
-
return
|
|
122794
|
+
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.alternateResult));
|
|
122718
122795
|
}
|
|
122719
122796
|
function isInvalidatedFailedLookup(locationPath) {
|
|
122720
122797
|
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
@@ -122777,16 +122854,6 @@ function resolutionIsSymlink(resolution) {
|
|
|
122777
122854
|
var _a, _b;
|
|
122778
122855
|
return !!(((_a = resolution.resolvedModule) == null ? void 0 : _a.originalPath) || ((_b = resolution.resolvedTypeReferenceDirective) == null ? void 0 : _b.originalPath));
|
|
122779
122856
|
}
|
|
122780
|
-
function canWatchFailedLookupsOfResolvedModule(resolution, optionsForFile, file) {
|
|
122781
|
-
var _a;
|
|
122782
|
-
return !resolution.resolvedModule || !!resolution.alternateResult || !!((_a = resolution.resolutionDiagnostics) == null ? void 0 : _a.length) || !!getResolutionDiagnostic(optionsForFile, resolution.resolvedModule, file);
|
|
122783
|
-
}
|
|
122784
|
-
function canWatchFailedLookupsOfTypeReferencedDirective(resolution) {
|
|
122785
|
-
return !resolution.resolvedTypeReferenceDirective;
|
|
122786
|
-
}
|
|
122787
|
-
function canWatchFailedLookupsOfResolvedLibrary(resolution) {
|
|
122788
|
-
return !resolution.resolvedModule;
|
|
122789
|
-
}
|
|
122790
122857
|
|
|
122791
122858
|
// src/compiler/watch.ts
|
|
122792
122859
|
var sysFormatDiagnosticsHost = sys ? {
|