This commit is contained in:
caandt
2025-07-25 16:26:03 -05:00
parent 814e99cb2d
commit da1f44caff
4 changed files with 17 additions and 11 deletions
@@ -58,14 +58,17 @@ class RemoveUnreachable(ControlFlowTemplate):
class JumpTemplate(ControlFlowTemplate):
template = T(
body=~N("jump", None).with_cond(without_instructions("CLEANUP_THROW")),
jump=N("tail", "block?").with_in_deg(1).with_cond(
jump=N("tail", "block?")
.with_in_deg(1)
.with_cond(
exact_instructions("JUMP_BACKWARD_NO_INTERRUPT"),
exact_instructions("POP_JUMP_IF_TRUE"),
exact_instructions("JUMP_FORWARD"),
exact_instructions("JUMP_BACKWARD"),
exact_instructions("POP_JUMP_IF_NOT_NONE"),
exact_instructions("POP_JUMP_IF_NONE"),
exact_instructions("POP_JUMP_IF_FALSE")),
exact_instructions("POP_JUMP_IF_FALSE"),
),
block=N.tail(),
tail=N.tail(),
)
@@ -81,6 +84,7 @@ class JumpTemplate(ControlFlowTemplate):
to_indented_source = defer_source_to("body")
@register_template(0, 0, *versions_from(3, 11))
class NopTemplate(ControlFlowTemplate):
template = T(
+2
View File
@@ -309,12 +309,14 @@ def g1_ifElseLoop():
if a > b:
print(1)
def g2_ifElseLoop():
for a in range(3):
if a > b:
print(1)
print(2)
def g3_ifElseLoop():
for a in range(3):
if a > b: