@@ -6,7 +6,6 @@ namespace ts {
66 let nextNodeId = 1;
77 let nextMergeId = 1;
88 let nextFlowId = 1;
9- let nextCheckerId = 1;
109
1110 const enum IterationUse {
1211 AllowsSyncIterablesFlag = 1 << 0,
@@ -299,7 +298,6 @@ namespace ts {
299298 let instantiationDepth = 0;
300299 let constraintDepth = 0;
301300 let currentNode: Node | undefined;
302- let checkerId: number;
303301
304302 const emptySymbols = createSymbolTable();
305303 const identityMapper: (type: Type) => Type = identity;
@@ -844,6 +842,7 @@ namespace ts {
844842 const flowLoopTypes: Type[][] = [];
845843 const sharedFlowNodes: FlowNode[] = [];
846844 const sharedFlowTypes: FlowType[] = [];
845+ const flowNodeReachable: (boolean | undefined)[] = [];
847846 const potentialThisCollisions: Node[] = [];
848847 const potentialNewTargetCollisions: Node[] = [];
849848 const awaitedTypeStack: number[] = [];
@@ -16994,21 +16993,17 @@ namespace ts {
1699416993 }
1699516994
1699616995 function isReachableFlowNode(flow: FlowNode) {
16997- return isReachableFlowNodeWorker(flow, /*noCacheCheck */ false);
16996+ return isReachableFlowNodeWorker(flow, /*skipCacheCheck */ false);
1699816997 }
1699916998
1700016999 function isReachableFlowNodeWorker(flow: FlowNode, noCacheCheck: boolean): boolean {
1700117000 while (true) {
1700217001 const flags = flow.flags;
17003- if (flags & ( FlowFlags.Shared | FlowFlags.Assignment | FlowFlags.Label) ) {
17002+ if (flags & FlowFlags.Shared) {
1700417003 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));
1701217007 }
1701317008 noCacheCheck = false;
1701417009 }
@@ -32292,9 +32287,6 @@ namespace ts {
3229232287 }
3229332288
3229432289 function initializeTypeChecker() {
32295- checkerId = nextCheckerId;
32296- nextCheckerId++;
32297-
3229832290 // Bind all source files and propagate errors
3229932291 for (const file of host.getSourceFiles()) {
3230032292 bindSourceFile(file, compilerOptions);
0 commit comments