Skip to content

Commit 6f76b62

Browse files
Remove uses of getNodeId in compiler outside of checker.
1 parent ca13132 commit 6f76b62

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/compiler/transformers/es2017.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace ts {
4646
/** Whether the async function contains an element access on super (`super[x]`). */
4747
let hasSuperElementAccess: boolean;
4848
/** A set of node IDs for generated super accessors (variable statements). */
49-
const substitutedSuperAccessors: boolean[] = [];
49+
const substitutedSuperAccessors = new Set<Node>();
5050

5151
let contextFlags: ContextFlags = 0;
5252

@@ -503,7 +503,7 @@ namespace ts {
503503
enableSubstitutionForAsyncMethodsWithSuper();
504504
if (capturedSuperProperties.size) {
505505
const variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
506-
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
506+
substitutedSuperAccessors.add(variableStatement);
507507
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
508508
}
509509
}
@@ -613,7 +613,7 @@ namespace ts {
613613
}
614614
}
615615
// Disable substitution in the generated super accessor itself.
616-
else if (enabledSubstitutions && substitutedSuperAccessors[getNodeId(node)]) {
616+
else if (enabledSubstitutions && substitutedSuperAccessors.has(node)) {
617617
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
618618
enclosingSuperContainerFlags = 0;
619619
previousOnEmitNode(hint, node, emitCallback);

src/compiler/transformers/es2018.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace ts {
7070
/** Whether the async function contains an element access on super (`super[x]`). */
7171
let hasSuperElementAccess: boolean;
7272
/** A set of node IDs for generated super accessors. */
73-
const substitutedSuperAccessors: boolean[] = [];
73+
const substitutedSuperAccessors = new Set<Node>();
7474

7575
return chainBundle(context, transformSourceFile);
7676

@@ -972,7 +972,7 @@ namespace ts {
972972
if (emitSuperHelpers) {
973973
enableSubstitutionForAsyncMethodsWithSuper();
974974
const variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
975-
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
975+
substitutedSuperAccessors.add(variableStatement);
976976
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
977977
}
978978

@@ -1087,7 +1087,7 @@ namespace ts {
10871087
}
10881088
}
10891089
// Disable substitution in the generated super accessor itself.
1090-
else if (enabledSubstitutions && substitutedSuperAccessors[getNodeId(node)]) {
1090+
else if (enabledSubstitutions && substitutedSuperAccessors.has(node)) {
10911091
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
10921092
enclosingSuperContainerFlags = 0 as NodeCheckFlags;
10931093
previousOnEmitNode(hint, node, emitCallback);

0 commit comments

Comments
 (0)