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

Method gen_return

mypyc/irbuild/nonlocalcontrol.py:170–181  ·  view source on GitHub ↗
(self, builder: IRBuilder, value: Value, line: int)

Source from the content-addressed store, hash-verified

168 builder.error("continue inside try/finally block is unimplemented", line)
169
170 def gen_return(self, builder: IRBuilder, value: Value, line: int) -> None:
171 if self.ret_reg is None:
172 if builder.fn_info.is_generator:
173 self.ret_reg = builder.make_spill_target(builder.ret_types[-1])
174 else:
175 self.ret_reg = Register(builder.ret_types[-1])
176 # assert needed because of apparent mypy bug... it loses track of the union
177 # and infers the type as object
178 assert isinstance(self.ret_reg, (Register, AssignmentTarget)), self.ret_reg
179 builder.assign(self.ret_reg, value, line)
180
181 builder.add(Goto(self.target))
182
183
184class ExceptNonlocalControl(CleanupNonlocalControl):

Callers

nothing calls this directly

Calls 6

RegisterClass · 0.90
GotoClass · 0.90
isinstanceFunction · 0.85
make_spill_targetMethod · 0.80
assignMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected