mirror of
https://github.com/syssec-utd/pylingual.git
synced 2026-05-10 18:39:03 -07:00
format
This commit is contained in:
@@ -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("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_NOT_NONE"),
|
||||
exact_instructions("POP_JUMP_IF_NONE"),
|
||||
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(
|
||||
|
||||
@@ -107,7 +107,7 @@ class TryElse3_12(ControlFlowTemplate):
|
||||
else:
|
||||
{try_else}
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@register_template(0, 0, (3, 11))
|
||||
class Try3_11(ControlFlowTemplate):
|
||||
|
||||
@@ -160,7 +160,7 @@ class FixLoop(ControlFlowTemplate):
|
||||
if cfg.get_edge_data(candidate_end, ss).get("kind") != EdgeKind.Exception:
|
||||
candidate_end = ss
|
||||
break
|
||||
|
||||
|
||||
if encompassed_nodes is not None:
|
||||
for succ in encompassed_nodes:
|
||||
if cfg.get_edge_data(succ, candidate_end) != None:
|
||||
|
||||
+6
-4
@@ -306,18 +306,20 @@ def f_nofallthru_if_pass():
|
||||
|
||||
def g1_ifElseLoop():
|
||||
for a in range(3):
|
||||
if a> b:
|
||||
if a > b:
|
||||
print(1)
|
||||
|
||||
|
||||
|
||||
def g2_ifElseLoop():
|
||||
for a in range(3):
|
||||
if a> b:
|
||||
if a > b:
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
|
||||
def g3_ifElseLoop():
|
||||
for a in range(3):
|
||||
if a> b:
|
||||
if a > b:
|
||||
print(1)
|
||||
else:
|
||||
print(2)
|
||||
|
||||
Reference in New Issue
Block a user