Commit d6b43eb1 authored by Stefan Behnel's avatar Stefan Behnel

show 'no inc/dec in Python' warning only for ++ and --, not for ~~

parent 253a9f34
...@@ -7291,8 +7291,8 @@ def unop_node(pos, operator, operand): ...@@ -7291,8 +7291,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 = str(-Utils.str_to_number(operand.value))) return IntNode(pos = operand.pos, value = str(-Utils.str_to_number(operand.value)))
elif isinstance(operand, UnopNode) and operand.operator == operator: elif isinstance(operand, UnopNode) and operand.operator == operator in '+-':
warning(pos, "Python has no increment/decrement operator: %s%sx = %s(%sx) = x" % ((operator,)*4), 5) 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