MCPcopy Index your code
hub / github.com/python/mypy / populate_switch_for_generator_class

Function populate_switch_for_generator_class

mypyc/irbuild/generator.py:181–193  ·  view source on GitHub ↗
(builder: IRBuilder)

Source from the content-addressed store, hash-verified

179
180
181def populate_switch_for_generator_class(builder: IRBuilder) -> None:
182 cls = builder.fn_info.generator_class
183 line = builder.fn_info.fitem.line
184
185 builder.activate_block(cls.switch_block)
186 for label, true_block in enumerate(cls.continuation_blocks):
187 false_block = BasicBlock()
188 comparison = builder.binary_op(cls.next_label_reg, Integer(label), "==", line)
189 builder.add_bool_branch(comparison, true_block, false_block)
190 builder.activate_block(false_block)
191
192 builder.add(RaiseStandardError(RaiseStandardError.STOP_ITERATION, None, line))
193 builder.add(Unreachable())
194
195
196def add_raise_exception_blocks_to_generator_class(builder: IRBuilder, line: int) -> None:

Callers 1

gen_generator_func_bodyFunction · 0.85

Calls 9

BasicBlockClass · 0.90
IntegerClass · 0.90
RaiseStandardErrorClass · 0.90
UnreachableClass · 0.90
enumerateFunction · 0.85
activate_blockMethod · 0.45
binary_opMethod · 0.45
add_bool_branchMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…