ifstmt reduction vs extended_args

This commit is contained in:
rocky
2020-01-22 19:14:52 -05:00
parent c1cde68da8
commit e17d9c806a

View File

@@ -46,13 +46,12 @@ def ifstmt(self, lhs, n, rule, ast, tokens, first, last):
if testexpr[0] in ("testtrue", "testfalse"): if testexpr[0] in ("testtrue", "testfalse"):
test = testexpr[0] test = testexpr[0]
if len(test) > 1 and test[1].kind.startswith("jmp_"): if len(test) > 1 and test[1].kind.startswith("jmp_"):
if last == n: last = min(last, n-1)
last -= 1
jmp_target = test[1][0].attr jmp_target = test[1][0].attr
if ( if (
tokens[first].off2int() tokens[first].off2int(True)
<= jmp_target <= jmp_target
< tokens[last].off2int() < tokens[last].off2int(False)
): ):
return True return True
# jmp_target less than tokens[first] is okay - is to a loop # jmp_target less than tokens[first] is okay - is to a loop