You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +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,
|
"except_handler_else": except_handler_else,
|
||||||
# "ifstmt": ifstmt,
|
# "ifstmt": ifstmt,
|
||||||
"ifstmtl": ifstmt,
|
"ifstmtl": ifstmt,
|
||||||
"ifelsestmtc": ifstmt,
|
"ifelsestmtc": ifelsestmt,
|
||||||
"ifelsestmt": ifelsestmt,
|
"ifelsestmt": ifelsestmt,
|
||||||
"or": or_check,
|
"or": or_check,
|
||||||
"testtrue": testtrue,
|
"testtrue": testtrue,
|
||||||
|
@@ -33,6 +33,15 @@ IFELSE_STMT_RULES = frozenset(
|
|||||||
"else_suitec",
|
"else_suitec",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"ifelsestmtc",
|
||||||
|
(
|
||||||
|
"testexpr",
|
||||||
|
"c_stmts_opt",
|
||||||
|
"jump_absolute_else",
|
||||||
|
"else_suitec"
|
||||||
|
),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"ifelsestmt",
|
"ifelsestmt",
|
||||||
(
|
(
|
||||||
@@ -79,7 +88,8 @@ IFELSE_STMT_RULES = frozenset(
|
|||||||
])
|
])
|
||||||
|
|
||||||
def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
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.
|
# ifelsestmt jumped outside of loop. No good.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user