mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Get rid of ERROR_IF's "label" parameter (GH-132654)
This commit is contained in:
parent
b329096cfb
commit
732d1b0241
7 changed files with 155 additions and 162 deletions
|
@ -419,7 +419,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
def test_error_if_plain(self):
|
||||
input = """
|
||||
inst(OP, (--)) {
|
||||
ERROR_IF(cond, label);
|
||||
ERROR_IF(cond);
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
|
@ -432,7 +432,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP);
|
||||
if (cond) {
|
||||
JUMP_TO_LABEL(label);
|
||||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
def test_error_if_plain_with_comment(self):
|
||||
input = """
|
||||
inst(OP, (--)) {
|
||||
ERROR_IF(cond, label); // Comment is ok
|
||||
ERROR_IF(cond); // Comment is ok
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
|
@ -455,7 +455,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP);
|
||||
if (cond) {
|
||||
JUMP_TO_LABEL(label);
|
||||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
inst(OP, (left, right -- res)) {
|
||||
SPAM(left, right);
|
||||
INPUTS_DEAD();
|
||||
ERROR_IF(cond, label);
|
||||
ERROR_IF(cond);
|
||||
res = 0;
|
||||
}
|
||||
"""
|
||||
|
@ -487,7 +487,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
left = stack_pointer[-2];
|
||||
SPAM(left, right);
|
||||
if (cond) {
|
||||
JUMP_TO_LABEL(pop_2_label);
|
||||
JUMP_TO_LABEL(pop_2_error);
|
||||
}
|
||||
res = 0;
|
||||
stack_pointer[-2] = res;
|
||||
|
@ -503,7 +503,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
inst(OP, (left, right -- res)) {
|
||||
res = SPAM(left, right);
|
||||
INPUTS_DEAD();
|
||||
ERROR_IF(cond, label);
|
||||
ERROR_IF(cond);
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
|
@ -522,7 +522,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
left = stack_pointer[-2];
|
||||
res = SPAM(left, right);
|
||||
if (cond) {
|
||||
JUMP_TO_LABEL(pop_2_label);
|
||||
JUMP_TO_LABEL(pop_2_error);
|
||||
}
|
||||
stack_pointer[-2] = res;
|
||||
stack_pointer += -1;
|
||||
|
@ -903,7 +903,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
inst(OP, (extra, values[oparg] --)) {
|
||||
DEAD(extra);
|
||||
DEAD(values);
|
||||
ERROR_IF(oparg == 0, somewhere);
|
||||
ERROR_IF(oparg == 0);
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
|
@ -922,7 +922,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
if (oparg == 0) {
|
||||
stack_pointer += -1 - oparg;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
JUMP_TO_LABEL(somewhere);
|
||||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
stack_pointer += -1 - oparg;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
|
@ -1319,7 +1319,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
|
||||
op(THIRD, (j, k --)) {
|
||||
INPUTS_DEAD(); // Mark j and k as used
|
||||
ERROR_IF(cond, error);
|
||||
ERROR_IF(cond);
|
||||
}
|
||||
|
||||
macro(TEST) = FIRST + SECOND + THIRD;
|
||||
|
@ -1369,7 +1369,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
|
||||
op(SECOND, (a -- a, b)) {
|
||||
b = 1;
|
||||
ERROR_IF(cond, error);
|
||||
ERROR_IF(cond);
|
||||
}
|
||||
|
||||
macro(TEST) = FIRST + SECOND;
|
||||
|
@ -1414,10 +1414,10 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
|
||||
input = """
|
||||
inst(OP1, ( --)) {
|
||||
ERROR_IF(true, here);
|
||||
ERROR_IF(true);
|
||||
}
|
||||
inst(OP2, ( --)) {
|
||||
ERROR_IF(1, there);
|
||||
ERROR_IF(1);
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
|
@ -1429,7 +1429,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP1);
|
||||
JUMP_TO_LABEL(here);
|
||||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
|
||||
TARGET(OP2) {
|
||||
|
@ -1440,7 +1440,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP2);
|
||||
JUMP_TO_LABEL(there);
|
||||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
@ -1716,7 +1716,7 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
|
||||
input = """
|
||||
inst(OP, ( -- )) {
|
||||
ERROR_IF(escaping_call(), error);
|
||||
ERROR_IF(escaping_call());
|
||||
}
|
||||
"""
|
||||
with self.assertRaises(SyntaxError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue