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

Class Goto

mypyc/ir/ops.py:397–423  ·  view source on GitHub ↗

Unconditional jump.

Source from the content-addressed store, hash-verified

395
396@final
397class Goto(ControlOp):
398 """Unconditional jump."""
399
400 error_kind = ERR_NEVER
401
402 def __init__(self, label: BasicBlock, line: int = -1) -> None:
403 super().__init__(line)
404 self.label = label
405
406 def targets(self) -> Sequence[BasicBlock]:
407 return (self.label,)
408
409 def set_target(self, i: int, new: BasicBlock) -> None:
410 assert i == 0
411 self.label = new
412
413 def __repr__(self) -> str:
414 return "<Goto %s>" % self.label.label
415
416 def sources(self) -> list[Value]:
417 return []
418
419 def set_sources(self, new: list[Value]) -> None:
420 assert not new
421
422 def accept(self, visitor: OpVisitor[T]) -> T:
423 return visitor.visit_goto(self)
424
425
426@final

Callers 14

gen_breakMethod · 0.90
gen_continueMethod · 0.90
gen_returnMethod · 0.90
gotoMethod · 0.90
float_modMethod · 0.90
test_valid_gotoMethod · 0.90
test_invalid_gotoMethod · 0.90
test_pprintMethod · 0.90
test_gotoMethod · 0.90

Calls

no outgoing calls

Tested by 5

test_valid_gotoMethod · 0.72
test_invalid_gotoMethod · 0.72
test_pprintMethod · 0.72
test_gotoMethod · 0.72
test_goto_next_blockMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…