Fix bugs in scanner.last_instr()...

And ave instruction stream self.insts like we do in Python 3 so we
can start simplifying code.
This commit is contained in:
rocky
2017-12-15 20:34:34 -05:00
parent 9cb99e3290
commit 15057bed1d
3 changed files with 17 additions and 7 deletions

View File

@@ -174,8 +174,9 @@ class Scanner(object):
instr = [instr]
result_offset = None
current_distance = len(code)
current_distance = self.insts[-1].offset - self.insts[0].offset
extended_arg = 0
# FIXME: use self.insts rather than code[]
for offset in self.op_range(start, end):
op = code[offset]
@@ -197,6 +198,12 @@ class Scanner(object):
if new_distance <= current_distance:
current_distance = new_distance
result_offset = offset
pass
pass
pass
pass
extended_arg = 0
pass
return result_offset
def all_instr(self, start, end, instr, target=None, include_beyond_target=False):