Skip to content

Commit c7c94b1

Browse files
stroxlerfacebook-github-bot
authored andcommitted
In flow merging, call flows flow
Summary: This funciton isn't small or simple anymore, so using a name other than `x` helps a bit. Reviewed By: rchen152 Differential Revision: D82316900 fbshipit-source-id: 91c8bebab25d6e5788e10837fece9c2c9176c6ea
1 parent 424e394 commit c7c94b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyrefly/lib/binding/flow_ops.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,21 @@ impl MergeItem {
131131
}
132132

133133
impl<'a> BindingsBuilder<'a> {
134-
fn merge_flow(&mut self, mut xs: Vec<Flow>, range: TextRange, is_loop: bool) -> Flow {
134+
fn merge_flow(&mut self, mut flows: Vec<Flow>, range: TextRange, is_loop: bool) -> Flow {
135135
// Short circuit in the one case we know we safely can.
136136
//
137137
// Note that it is impossible to hit this in a loop, which is essential because we
138138
// could panic due to unbound speculative Phi keys if we try to short circuit a loop.
139-
if xs.len() == 1 && xs[0].has_terminated {
140-
return xs.pop().unwrap();
139+
if flows.len() == 1 && flows[0].has_terminated {
140+
return flows.pop().unwrap();
141141
}
142142

143143
// We normally only merge the live branches (where control flow is not
144144
// known to terminate), but if nothing is live we still need to fill in
145145
// the Phi keys and potentially analyze downstream code, so in that case
146146
// we'll use the terminated branches.
147147
let (terminated_branches, live_branches): (Vec<_>, Vec<_>) =
148-
xs.into_iter().partition(|x| x.has_terminated);
148+
flows.into_iter().partition(|flow| flow.has_terminated);
149149
let has_terminated = live_branches.is_empty();
150150
let branches = if has_terminated {
151151
terminated_branches
@@ -155,7 +155,7 @@ impl<'a> BindingsBuilder<'a> {
155155

156156
// Collect all the branches into a `MergeItem` per name we need to merge
157157
let mut merge_items: SmallMap<Name, MergeItem> =
158-
SmallMap::with_capacity(branches.first().map_or(0, |x| x.info.len()));
158+
SmallMap::with_capacity(branches.first().map_or(0, |flow| flow.info.len()));
159159
let n_branches = branches.len();
160160
for flow in branches {
161161
for (name, info) in flow.info.into_iter_hashed() {

0 commit comments

Comments
 (0)