63
63
class Frame (Dict [Any , Type ]):
64
64
pass
65
65
66
+
66
67
class Key (AnyType ):
67
68
pass
68
69
@@ -78,8 +79,8 @@ def __init__(self) -> None:
78
79
79
80
# For frames higher in the stack, we record the set of
80
81
# Frames that can escape there
81
- self .options_on_return = [] # type: List[List[Frame]]
82
-
82
+ self .options_on_return = [] # type: List[List[Frame]]
83
+
83
84
# Maps expr.literal_hash] to get_declaration(expr)
84
85
# for every expr stored in the binder
85
86
self .declarations = Frame ()
@@ -181,9 +182,7 @@ def update_from_options(self, frames: List[Frame]) -> bool:
181
182
def pop_frame (self , fall_through : int = 0 ) -> Frame :
182
183
"""Pop a frame and return it.
183
184
184
- If fall_through > 0, then on __exit__ the manager will clear the
185
- breaking_out flag, and if it was not set, will allow the frame
186
- to escape to its ancestor `fall_through` levels higher.
185
+ See frame_context() for documentation of fall_through.
187
186
"""
188
187
if fall_through and not self .breaking_out :
189
188
self .allow_jump (- fall_through )
@@ -276,7 +275,7 @@ def allow_jump(self, index: int) -> None:
276
275
self .options_on_return [index ].append (frame )
277
276
278
277
def push_loop_frame (self ) -> None :
279
- self .loop_frames .append (len (self .frames )- 1 )
278
+ self .loop_frames .append (len (self .frames ) - 1 )
280
279
281
280
def pop_loop_frame (self ) -> None :
282
281
self .loop_frames .pop ()
@@ -285,9 +284,8 @@ def pop_loop_frame(self) -> None:
285
284
def frame_context (self , fall_through : int = 0 ) -> Iterator [Frame ]:
286
285
"""Return a context manager that pushes/pops frames on enter/exit.
287
286
288
- If fall_through > 0, then on __exit__ the manager will clear the
289
- breaking_out flag, and if it was not set, will allow the frame
290
- to escape to its ancestor `fall_through` levels higher.
287
+ If fall_through > 0, then it will allow the frame to escape to
288
+ its ancestor `fall_through` levels higher.
291
289
"""
292
290
yield self .push_frame ()
293
291
self .pop_frame (fall_through )
0 commit comments