diff --git a/test/test_functions.py b/test/test_functions.py index 673cab11..7dc60b56 100755 --- a/test/test_functions.py +++ b/test/test_functions.py @@ -48,3 +48,6 @@ def func_with_tuple_args5((a,b), (c,d), *args, **kwargs): def func_with_tuple_args6((a,b), (c,d)=(2,3), *args, **kwargs): print a print c + +def func_ret1(): + return 1 < 2 < 3 \ No newline at end of file diff --git a/uncompyle2/scanner25.py b/uncompyle2/scanner25.py index 25d545ac..0ecb200e 100755 --- a/uncompyle2/scanner25.py +++ b/uncompyle2/scanner25.py @@ -822,17 +822,13 @@ class Scanner25(scan.Scanner): 'start': rtarget, 'end': end}) elif code[pre[rtarget]] == RETURN_VALUE: + # if it's an old JUMP_IF_FALSE_OR_POP, JUMP_IF_TRUE_OR_POP (return 1<2<3 case) + if pos < rtarget and code[rtarget] == ROT_TWO: + return self.structs.append({'type': 'if-then', 'start': start, 'end': rtarget}) self.return_end_ifs.add(pre[rtarget]) - # if it's an old JUMP_IF_FALSE_OR_POP, JUMP_IF_TRUE_OR_POP - #if target > pos: - # unop_target = self.last_instr(pos, target, JF, target) - # if unop_target and code[unop_target+3] != ROT_TWO: - # self.fixed_jumps[pos] = unop_target - # else: - # self.fixed_jumps[pos] = self.restrict_to_parent(target, parent) def find_jump_targets(self, code): ''' diff --git a/uncompyle2/scanner26.py b/uncompyle2/scanner26.py index 89b15971..7b87e5db 100755 --- a/uncompyle2/scanner26.py +++ b/uncompyle2/scanner26.py @@ -821,17 +821,13 @@ class Scanner26(scan.Scanner): 'start': rtarget, 'end': end}) elif code[pre[rtarget]] == RETURN_VALUE: + # if it's an old JUMP_IF_FALSE_OR_POP, JUMP_IF_TRUE_OR_POP (return 1<2<3 case) + if pos < rtarget and code[rtarget] == ROT_TWO: + return self.structs.append({'type': 'if-then', 'start': start, 'end': rtarget}) self.return_end_ifs.add(pre[rtarget]) - # if it's an old JUMP_IF_FALSE_OR_POP, JUMP_IF_TRUE_OR_POP - #if target > pos: - # unop_target = self.last_instr(pos, target, JF, target) - # if unop_target and code[unop_target+3] != ROT_TWO: - # self.fixed_jumps[pos] = unop_target - # else: - # self.fixed_jumps[pos] = self.restrict_to_parent(target, parent) def find_jump_targets(self, code): '''