Skip to content

Commit 37d320d

Browse files
committed
Rename visitedFlowXXX to sharedFlowXXX
1 parent 9eecf8c commit 37d320d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/compiler/checker.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ namespace ts {
333333

334334
let flowLoopStart = 0;
335335
let flowLoopCount = 0;
336-
let visitedFlowCount = 0;
336+
let sharedFlowCount = 0;
337337
let flowAnalysisDisabled = false;
338338

339339
const emptyStringType = getLiteralType("");
@@ -352,8 +352,8 @@ namespace ts {
352352
const flowLoopNodes: FlowNode[] = [];
353353
const flowLoopKeys: string[] = [];
354354
const flowLoopTypes: Type[][] = [];
355-
const visitedFlowNodes: FlowNode[] = [];
356-
const visitedFlowTypes: FlowType[] = [];
355+
const sharedFlowNodes: FlowNode[] = [];
356+
const sharedFlowTypes: FlowType[] = [];
357357
const potentialThisCollisions: Node[] = [];
358358
const potentialNewTargetCollisions: Node[] = [];
359359
const awaitedTypeStack: number[] = [];
@@ -11502,9 +11502,9 @@ namespace ts {
1150211502
if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & TypeFlags.Narrowable)) {
1150311503
return declaredType;
1150411504
}
11505-
const visitedFlowStart = visitedFlowCount;
11505+
const sharedFlowStart = sharedFlowCount;
1150611506
const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
11507-
visitedFlowCount = visitedFlowStart;
11507+
sharedFlowCount = sharedFlowStart;
1150811508
// When the reference is 'x' in an 'x.length', 'x.push(value)', 'x.unshift(value)' or x[n] = value' operation,
1150911509
// we give type 'any[]' to 'x' instead of using the type determined by control flow analysis such that operations
1151011510
// on empty arrays are possible without implicit any errors and new element types can be inferred without
@@ -11532,9 +11532,9 @@ namespace ts {
1153211532
// We cache results of flow type resolution for shared nodes that were previously visited in
1153311533
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
1153411534
// antecedent of more than one node.
11535-
for (let i = visitedFlowStart; i < visitedFlowCount; i++) {
11536-
if (visitedFlowNodes[i] === flow) {
11537-
return visitedFlowTypes[i];
11535+
for (let i = sharedFlowStart; i < sharedFlowCount; i++) {
11536+
if (sharedFlowNodes[i] === flow) {
11537+
return sharedFlowTypes[i];
1153811538
}
1153911539
}
1154011540
}
@@ -11597,9 +11597,9 @@ namespace ts {
1159711597
}
1159811598
if (flags & FlowFlags.Shared) {
1159911599
// Record visited node and the associated type in the cache.
11600-
visitedFlowNodes[visitedFlowCount] = flow;
11601-
visitedFlowTypes[visitedFlowCount] = type;
11602-
visitedFlowCount++;
11600+
sharedFlowNodes[sharedFlowCount] = flow;
11601+
sharedFlowTypes[sharedFlowCount] = type;
11602+
sharedFlowCount++;
1160311603
}
1160411604
return type;
1160511605
}

0 commit comments

Comments
 (0)