Commit 270708c2 authored by Robert Bradshaw's avatar Robert Bradshaw

Warning on ++x and --x

parent 6e308d10
...@@ -2571,6 +2571,8 @@ def unop_node(pos, operator, operand): ...@@ -2571,6 +2571,8 @@ def unop_node(pos, operator, operand):
# given operator. # given operator.
if isinstance(operand, IntNode) and operator == '-': if isinstance(operand, IntNode) and operator == '-':
return IntNode(pos = operand.pos, value = -int(operand.value)) return IntNode(pos = operand.pos, value = -int(operand.value))
elif isinstance(operand, UnopNode) and operand.operator == operator:
warning(pos, "Python has no increment/decrement operator: %s%sx = %s(%sx) = x" % ((operator,)*4), 5)
return unop_node_classes[operator](pos, return unop_node_classes[operator](pos,
operator = operator, operator = operator,
operand = operand) operand = operand)
......
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