Commit d467013c authored by Stefan Behnel's avatar Stefan Behnel

range optimisation fixes

parent a927b5a7
...@@ -2990,15 +2990,16 @@ class ForInStatNode(LoopNode, StatNode): ...@@ -2990,15 +2990,16 @@ class ForInStatNode(LoopNode, StatNode):
else: else:
step = args[2] step = args[2]
if isinstance(step, ExprNodes.UnaryMinusNode) and isinstance(step.operand, ExprNodes.IntNode): if isinstance(step, ExprNodes.UnaryMinusNode) and isinstance(step.operand, ExprNodes.IntNode):
step = ExprNodes.IntNode(pos = step.pos, value=-int(step.operand.value)) step = ExprNodes.IntNode(pos = step.pos, value=str(-int(step.operand.value, 0)))
if isinstance(step, ExprNodes.IntNode): if isinstance(step, ExprNodes.IntNode):
if step.value > 0: step_value = int(step.value, 0)
if step_value > 0:
self.step = step self.step = step
self.relation1 = '<=' self.relation1 = '<='
self.relation2 = '<' self.relation2 = '<'
return True return True
elif step.value < 0: elif step_value < 0:
self.step = ExprNodes.IntNode(pos = step.pos, value=-int(step.value)) self.step = ExprNodes.IntNode(pos = step.pos, value=str(-step_value))
self.relation1 = '>=' self.relation1 = '>='
self.relation2 = '>' self.relation2 = '>'
return True return True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment