More 3.x "if" checking. Abbreviate stmts->sstmt

This commit is contained in:
rocky
2020-01-26 02:58:33 -05:00
parent 7721fbd276
commit 33918bd9d2
5 changed files with 17 additions and 9 deletions

View File

@@ -20,11 +20,12 @@ def ifstmt(self, lhs, n, rule, ast, tokens, first, last):
last_offset = tokens[l].offset
for i in range(first, l):
t = tokens[i]
if t.kind == "POP_JUMP_IF_FALSE":
# instead of POP_JUMP_IF, should we use op attributes?
if t.kind in ("POP_JUMP_IF_FALSE", "POP_JUMP_IF_TRUE"):
pjif_target = t.attr
if pjif_target > last_offset:
# In come cases, where we have long bytecode, a
# "POP_JUMP_IF_FALSE" offset might be too
# "POP_JUMP_IF_TRUE/FALSE" offset might be too
# large for the instruction; so instead it
# jumps to a JUMP_FORWARD. Allow that here.
if tokens[l] == "JUMP_FORWARD":