@@ -6,7 +6,6 @@ namespace ts {
6
6
let nextNodeId = 1;
7
7
let nextMergeId = 1;
8
8
let nextFlowId = 1;
9
- let nextCheckerId = 1;
10
9
11
10
const enum IterationUse {
12
11
AllowsSyncIterablesFlag = 1 << 0,
@@ -299,7 +298,6 @@ namespace ts {
299
298
let instantiationDepth = 0;
300
299
let constraintDepth = 0;
301
300
let currentNode: Node | undefined;
302
- let checkerId: number;
303
301
304
302
const emptySymbols = createSymbolTable();
305
303
const identityMapper: (type: Type) => Type = identity;
@@ -844,6 +842,7 @@ namespace ts {
844
842
const flowLoopTypes: Type[][] = [];
845
843
const sharedFlowNodes: FlowNode[] = [];
846
844
const sharedFlowTypes: FlowType[] = [];
845
+ const flowNodeReachable: (boolean | undefined)[] = [];
847
846
const potentialThisCollisions: Node[] = [];
848
847
const potentialNewTargetCollisions: Node[] = [];
849
848
const awaitedTypeStack: number[] = [];
@@ -16994,21 +16993,17 @@ namespace ts {
16994
16993
}
16995
16994
16996
16995
function isReachableFlowNode(flow: FlowNode) {
16997
- return isReachableFlowNodeWorker(flow, /*noCacheCheck */ false);
16996
+ return isReachableFlowNodeWorker(flow, /*skipCacheCheck */ false);
16998
16997
}
16999
16998
17000
16999
function isReachableFlowNodeWorker(flow: FlowNode, noCacheCheck: boolean): boolean {
17001
17000
while (true) {
17002
17001
const flags = flow.flags;
17003
- if (flags & ( FlowFlags.Shared | FlowFlags.Assignment | FlowFlags.Label) ) {
17002
+ if (flags & FlowFlags.Shared) {
17004
17003
if (!noCacheCheck) {
17005
- if (flow.checkerId === checkerId) {
17006
- return !!(flow.flags & FlowFlags.Reachable);
17007
- }
17008
- const reachable = isReachableFlowNodeWorker(flow, /*noCacheCheck*/ true);
17009
- flow.checkerId = checkerId;
17010
- flow.flags = (flow.flags & ~FlowFlags.Reachable) | (reachable ? FlowFlags.Reachable : 0);
17011
- return reachable;
17004
+ const id = getFlowNodeId(flow);
17005
+ const reachable = flowNodeReachable[id];
17006
+ return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ true));
17012
17007
}
17013
17008
noCacheCheck = false;
17014
17009
}
@@ -32292,9 +32287,6 @@ namespace ts {
32292
32287
}
32293
32288
32294
32289
function initializeTypeChecker() {
32295
- checkerId = nextCheckerId;
32296
- nextCheckerId++;
32297
-
32298
32290
// Bind all source files and propagate errors
32299
32291
for (const file of host.getSourceFiles()) {
32300
32292
bindSourceFile(file, compilerOptions);
0 commit comments