Align overlap condition on java implementation

This commit is contained in:
Thomas 2019-05-13 22:33:43 +02:00
parent 9a6b4e8fe8
commit 6fbc156f6c
2 changed files with 2 additions and 4 deletions

View File

@ -157,13 +157,12 @@ class TokenStreamRewriter(object):
rewrites[prevRop.instructionIndex] = None
continue
isDisjoint = any((prevRop.last_index < rop.index, prevRop.index > rop.last_index))
isSame = all((prevRop.index == rop.index, prevRop.last_index == rop.last_index))
if all((prevRop.text is None, rop.text is None, not isDisjoint)):
rewrites[prevRop.instructionIndex] = None
rop.index = min(prevRop.index, rop.index)
rop.last_index = min(prevRop.last_index, rop.last_index)
print('New rop {}'.format(rop))
elif (not(isDisjoint) and not(isSame)):
elif ( not(isDisjoint) ):
raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop))
# Walk inserts before

View File

@ -156,13 +156,12 @@ class TokenStreamRewriter(object):
rewrites[prevRop.instructionIndex] = None
continue
isDisjoint = any((prevRop.last_index<rop.index, prevRop.index>rop.last_index))
isSame = all((prevRop.index == rop.index, prevRop.last_index == rop.last_index))
if all((prevRop.text is None, rop.text is None, not isDisjoint)):
rewrites[prevRop.instructionIndex] = None
rop.index = min(prevRop.index, rop.index)
rop.last_index = min(prevRop.last_index, rop.last_index)
print('New rop {}'.format(rop))
elif (not(isDisjoint) and not(isSame)):
elif ( not(isDisjoint) ):
raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop))
# Walk inserts