Partial 3.8 async "for" fixes

This commit is contained in:
rocky
2022-01-18 13:08:17 -05:00
parent 88c0c03ee4
commit 5b5fa310d9
3 changed files with 36 additions and 3 deletions

View File

@@ -584,6 +584,21 @@ class Python37BaseParser(PythonParser):
"""
self.add_unique_doc_rules(rules_str, customize)
elif opname == "GET_ANEXT":
self.addRule(
"""
func_async_prefix ::= _come_froms SETUP_FINALLY GET_ANEXT LOAD_CONST YIELD_FROM POP_BLOCK
func_async_middle ::= JUMP_FORWARD COME_FROM_EXCEPT
DUP_TOP LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_TRUE
list_afor2 ::= func_async_prefix
store list_iter
JUMP_BACK COME_FROM_FINALLY
END_ASYNC_FOR
""",
nop_func,
)
custom_ops_processed.add(opname)
elif opname == "FORMAT_VALUE_ATTR":
rules_str = """
expr ::= formatted_value2

View File

@@ -75,6 +75,11 @@ class Python38Parser(Python37Parser):
COME_FROM_FINALLY
END_ASYNC_FOR
genexpr_func_async ::= LOAD_FAST func_async_prefix
store comp_iter
JUMP_BACK COME_FROM_FINALLY
END_ASYNC_FOR
# FIXME: come froms after the else_suite or END_ASYNC_FOR distinguish which of
# for / forelse is used. Add come froms and check of add up control-flow detection phase.
async_forelse_stmt38 ::= expr