Skip to content

GH-128073: Include EXIT_IF when checking for escaping calls #128537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,31 @@ def test_pop_dead_inputs_with_output(self):
"""
self.run_cases_test(input, output)

def test_no_escaping_calls_in_branching_macros(self):

input = """
inst(OP, ( -- )) {
DEOPT_IF(escaping_call());
}
"""
with self.assertRaises(SyntaxError):
self.run_cases_test(input, "")

input = """
inst(OP, ( -- )) {
EXIT_IF(escaping_call());
}
"""
with self.assertRaises(SyntaxError):
self.run_cases_test(input, "")

input = """
inst(OP, ( -- )) {
ERROR_IF(escaping_call(), error);
}
"""
with self.assertRaises(SyntaxError):
self.run_cases_test(input, "")

class TestGeneratedAbstractCases(unittest.TestCase):
def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion Tools/cases_generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def check_escaping_calls(instr: parser.InstDef, escapes: dict[lexer.Token, tuple
if tkn.kind == "IF":
next(tkn_iter)
in_if = 1
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF"):
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF", "EXIT_IF"):
next(tkn_iter)
in_if = 1
elif tkn.kind == "LPAREN" and in_if:
Expand Down
Loading