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

This commit is contained in:
Mark Shannon 2025-01-06 14:16:22 +00:00 committed by GitHub
parent f89e5e20cb
commit b9c693dcca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View file

@ -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:

View file

@ -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: