mirror of
https://github.com/syssec-utd/pylingual.git
synced 2026-05-10 18:39:03 -07:00
Fixing With statement test cases
This commit is contained in:
@@ -75,6 +75,27 @@ class JumpTemplate(ControlFlowTemplate):
|
||||
to_indented_source = defer_source_to("body")
|
||||
|
||||
|
||||
@register_template(0, 0)
|
||||
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(exact_instructions("JUMP_BACKWARD_NO_INTERRUPT"), exact_instructions("POP_JUMP_IF_TRUE")),
|
||||
block=~N.tail(),
|
||||
tail=N.tail(),
|
||||
)
|
||||
|
||||
try_match = make_try_match(
|
||||
{
|
||||
EdgeKind.Fall: "tail",
|
||||
EdgeKind.TrueJump: "block",
|
||||
},
|
||||
"body",
|
||||
"jump",
|
||||
)
|
||||
|
||||
to_indented_source = defer_source_to("body")
|
||||
|
||||
|
||||
@register_template(0, 20)
|
||||
@register_template(2, 20)
|
||||
class BlockTemplate(ControlFlowTemplate):
|
||||
|
||||
@@ -7,7 +7,6 @@ def a1_bare_with_fallthrough():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.10, duplicate blocks explained further in issue 32
|
||||
def b0_multi_with():
|
||||
with a, b:
|
||||
print(1)
|
||||
@@ -26,7 +25,6 @@ def c1_with_as_fallthrough():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.10, same issue as b
|
||||
def d0_multi_with_as():
|
||||
with a, b as c:
|
||||
print(1)
|
||||
@@ -36,7 +34,6 @@ def d1_multi_with_as_fallthrough():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.10, same issue as b
|
||||
def e0_with_multi_as():
|
||||
with a as b, c:
|
||||
print(1)
|
||||
@@ -46,7 +43,6 @@ def e1_with_multi_as_fallthrough():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.10, same issue as b
|
||||
def f0_multi_with_multi_as():
|
||||
with a as b, c as d:
|
||||
print(1)
|
||||
@@ -56,7 +52,6 @@ def f1_multi_with_multi_as_fallthrough():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.10, same issue as b
|
||||
def g0_multi_with_multi_as_alt():
|
||||
with a, b as c, d:
|
||||
print(1)
|
||||
@@ -66,7 +61,6 @@ def g1_multi_with_multi_as_fallthrough_alt():
|
||||
print(1)
|
||||
print(2)
|
||||
|
||||
# Fails in 3.13, unexpected JUMP_BACKWARD_NO_INTERRUPT messes up the template
|
||||
def h0_try_with_except():
|
||||
try:
|
||||
with a:
|
||||
|
||||
Reference in New Issue
Block a user