You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Correct ifelsestmtc rules for 3.x
This commit is contained in:
@@ -1534,7 +1534,7 @@ class Python3Parser(PythonParser):
|
||||
"except_handler_else": except_handler_else,
|
||||
# "ifstmt": ifstmt,
|
||||
"ifstmtl": ifstmt,
|
||||
"ifelsestmtc": ifstmt,
|
||||
"ifelsestmtc": ifelsestmt,
|
||||
"ifelsestmt": ifelsestmt,
|
||||
"or": or_check,
|
||||
"testtrue": testtrue,
|
||||
|
@@ -33,6 +33,15 @@ IFELSE_STMT_RULES = frozenset(
|
||||
"else_suitec",
|
||||
),
|
||||
),
|
||||
(
|
||||
"ifelsestmtc",
|
||||
(
|
||||
"testexpr",
|
||||
"c_stmts_opt",
|
||||
"jump_absolute_else",
|
||||
"else_suitec"
|
||||
),
|
||||
),
|
||||
(
|
||||
"ifelsestmt",
|
||||
(
|
||||
@@ -79,7 +88,8 @@ IFELSE_STMT_RULES = frozenset(
|
||||
])
|
||||
|
||||
def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
||||
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP":
|
||||
|
||||
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP" and lhs != "ifelsestmtc":
|
||||
# ifelsestmt jumped outside of loop. No good.
|
||||
return True
|
||||
|
||||
|
Reference in New Issue
Block a user