Skip to content

Commit f2111de

Browse files
committed
Remove collapse_ancestry option, and always do it
1 parent 84aa24b commit f2111de

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

mypy/binder.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,19 @@ def __init__(self, parent: 'Frame' = None) -> None:
3232
self.parent = parent
3333
self.options_on_return = [] # type: List[Frame]
3434

35-
def add_return_option(self, frame: 'Frame', collapse_ancestry: bool = False) -> None:
35+
def add_return_option(self, frame: 'Frame') -> None:
3636
"""When this frame is next visited, it may may have state `frame`.
3737
38-
If collapse_ancestry is True, then frame must be a descendent of
39-
self, and we collapse the frame before adding it as an option.
38+
The frame must be a descendent of self, and we incorporate every
39+
intermediate frame.
4040
"""
41-
if collapse_ancestry:
42-
frame_list = []
43-
while frame is not self:
44-
frame_list.append(frame)
45-
frame = frame.parent
46-
frame = Frame()
47-
for f in frame_list[::-1]:
48-
frame.update(f)
41+
frame_list = []
42+
while frame is not self:
43+
frame_list.append(frame)
44+
frame = frame.parent
45+
frame = Frame()
46+
for f in frame_list[::-1]:
47+
frame.update(f)
4948
self.options_on_return.append(frame)
5049

5150

@@ -188,7 +187,7 @@ def pop_frame(self, fall_through: int = 0) -> Frame:
188187

189188
if fall_through:
190189
if not result.broken:
191-
self.frames[-fall_through].add_return_option(result, True)
190+
self.frames[-fall_through].add_return_option(result)
192191
self.breaking_out = False
193192

194193
options = self.frames[-1].options_on_return
@@ -269,7 +268,7 @@ def most_recent_enclosing_type(self, expr: Node, type: Type) -> Type:
269268
return enclosers[-1]
270269

271270
def allow_jump(self, index: int) -> None:
272-
self.frames[index].add_return_option(self.frames[-1], True)
271+
self.frames[index].add_return_option(self.frames[-1])
273272

274273
def push_loop_frame(self) -> None:
275274
self.loop_frames.append(len(self.frames) - 1)

0 commit comments

Comments
 (0)