Skip to content

Commit e64dbab

Browse files
More removals.
1 parent 044de3e commit e64dbab

File tree

6 files changed

+12
-28
lines changed

6 files changed

+12
-28
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,6 @@ namespace ts {
288288
return result;
289289
}
290290

291-
export function getNodeIdOrDefault(node: Node): number {
292-
return idCache.get(node) || 0;
293-
}
294-
295-
export function setNodeIdForStrangeRedirect(node: Node, id: number): void {
296-
idCache.set(node, id);
297-
}
298-
299291
export function getSymbolId(symbol: Symbol): SymbolId {
300292
if (!symbol.id) {
301293
symbol.id = nextSymbolId;
@@ -971,7 +963,7 @@ namespace ts {
971963
let flowInvocationCount = 0;
972964
let lastFlowNode: FlowNode | undefined;
973965
let lastFlowNodeReachable: boolean;
974-
let flowTypeCache: Type[] | undefined;
966+
let flowTypeCache: ESMap<Node, Type> | undefined;
975967

976968
const emptyStringType = getStringLiteralType("");
977969
const zeroType = getNumberLiteralType(0);
@@ -3899,10 +3891,9 @@ namespace ts {
38993891

39003892
function getAlternativeContainingModules(symbol: Symbol, enclosingDeclaration: Node): Symbol[] {
39013893
const containingFile = getSourceFileOfNode(enclosingDeclaration);
3902-
const id = getNodeId(containingFile);
39033894
const links = getSymbolLinks(symbol);
39043895
let results: Symbol[] | undefined;
3905-
if (links.extendedContainersByFile && (results = links.extendedContainersByFile.get(id))) {
3896+
if (links.extendedContainersByFile && (results = links.extendedContainersByFile.get(containingFile))) {
39063897
return results;
39073898
}
39083899
if (containingFile && containingFile.imports) {
@@ -3916,7 +3907,7 @@ namespace ts {
39163907
results = append(results, resolvedModule);
39173908
}
39183909
if (length(results)) {
3919-
(links.extendedContainersByFile || (links.extendedContainersByFile = new Map())).set(id, results!);
3910+
(links.extendedContainersByFile ||= new Map()).set(containingFile, results!);
39203911
return results!;
39213912
}
39223913
}
@@ -33799,7 +33790,7 @@ namespace ts {
3379933790
}
3380033791
// If a type has been cached for the node, return it.
3380133792
if (node.flags & NodeFlags.TypeCached && flowTypeCache) {
33802-
const cachedType = flowTypeCache[getNodeId(node)];
33793+
const cachedType = flowTypeCache.get(node);
3380333794
if (cachedType) {
3380433795
return cachedType;
3380533796
}
@@ -33808,8 +33799,8 @@ namespace ts {
3380833799
const type = checkExpression(node);
3380933800
// If control flow analysis was required to determine the type, it is worth caching.
3381033801
if (flowInvocationCount !== startInvocationCount) {
33811-
const cache = flowTypeCache || (flowTypeCache = []);
33812-
cache[getNodeId(node)] = type;
33802+
const cache = (flowTypeCache ||= new Map<Node, Type>());
33803+
cache.set(node, type);
3381333804
setNodeFlags(node, node.flags | NodeFlags.TypeCached);
3381433805
}
3381533806
return type;
@@ -41612,9 +41603,6 @@ namespace ts {
4161241603
}
4161341604

4161441605
function getNodeCheckFlags(node: Node): NodeCheckFlags {
41615-
// TODO: probably not meaningful, right?
41616-
// const nodeId = getNodeIdOrDefault(node);
41617-
// if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
4161841606
return nodeLinks.get(node)?.flags || 0;
4161941607
}
4162041608

src/compiler/factory/nodeFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5339,7 +5339,7 @@ namespace ts {
53395339
}
53405340

53415341
function flattenCommaElements(node: Expression): Expression | readonly Expression[] {
5342-
if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode && !getNodeIdOrDefault(node)) {
5342+
if (nodeIsSynthesized(node) && !isParseTreeNode(node) && !node.original && !node.emitNode) {
53435343
if (isCommaListExpression(node)) {
53445344
return node.elements;
53455345
}

src/compiler/program.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,10 +2592,6 @@ namespace ts {
25922592
redirect.redirectInfo = { redirectTarget, unredirected };
25932593
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
25942594
Object.defineProperties(redirect, {
2595-
id: {
2596-
get(this: SourceFile) { return getNodeIdOrDefault(this.redirectInfo!.redirectTarget); },
2597-
set(this: SourceFile, value: number) { setNodeIdForStrangeRedirect(this.redirectInfo!.redirectTarget, value); },
2598-
},
25992595
symbol: {
26002596
get(this: SourceFile) { return this.redirectInfo!.redirectTarget.symbol; },
26012597
set(this: SourceFile, value: SourceFile["symbol"]) { this.redirectInfo!.redirectTarget.symbol = value; },

src/compiler/transformers/es5.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace ts {
6464
*/
6565
function onSubstituteNode(hint: EmitHint, node: Node) {
6666
// TODO: do we need to check for a Node ID here?
67-
if (getNodeIdOrDefault(node) && noSubstitution?.has(node)) {
67+
if (noSubstitution?.has(node)) {
6868
return previousOnSubstituteNode(hint, node);
6969
}
7070

src/compiler/transformers/module/module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ namespace ts {
698698
}
699699

700700
if (temp) {
701-
noSubstitution.add(expression);;
701+
noSubstitution.add(expression);
702702
expression = factory.createComma(expression, temp);
703703
setTextRange(expression, node);
704704
}
@@ -1852,7 +1852,7 @@ namespace ts {
18521852
function substituteCallExpression(node: CallExpression) {
18531853
if (isIdentifier(node.expression)) {
18541854
const expression = substituteExpressionIdentifier(node.expression);
1855-
noSubstitution.add(expression);;
1855+
noSubstitution.add(expression);
18561856
if (!isIdentifier(expression)) {
18571857
return addEmitFlags(
18581858
factory.updateCallExpression(node,
@@ -1962,7 +1962,7 @@ namespace ts {
19621962
let expression: Expression = node;
19631963
for (const exportName of exportedNames) {
19641964
// Mark the node to prevent triggering this rule again.
1965-
noSubstitution.add(expression);;
1965+
noSubstitution.add(expression);
19661966
expression = createExportExpression(exportName, expression, /*location*/ node);
19671967
}
19681968

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4945,7 +4945,7 @@ namespace ts {
49454945
lateSymbol?: Symbol; // Late-bound symbol for a computed property
49464946
specifierCache?: ESMap<string, string>; // For symbols corresponding to external modules, a cache of incoming path -> module specifier name mappings
49474947
extendedContainers?: Symbol[]; // Containers (other than the parent) which this symbol is aliased in
4948-
extendedContainersByFile?: ESMap<NodeId, Symbol[]>; // Containers (other than the parent) which this symbol is aliased in
4948+
extendedContainersByFile?: ESMap<Node, Symbol[]>; // Containers (other than the parent) which this symbol is aliased in
49494949
variances?: VarianceFlags[]; // Alias symbol type argument variance cache
49504950
deferralConstituents?: Type[]; // Calculated list of constituents for a deferred type
49514951
deferralParent?: Type; // Source union/intersection of a deferred type

0 commit comments

Comments
 (0)