Warning on ++x and --x
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 17 Jan 2008 08:20:03 +0000 (00:20 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 17 Jan 2008 08:20:03 +0000 (00:20 -0800)
Cython/Compiler/ExprNodes.py

index 0e8e0987383010a4f0c3783c15a2b35b89e09bf3..3ec90009b8f0c9c2a88f4ec672d17e39e367a4e0 100644 (file)
@@ -2571,6 +2571,8 @@ def unop_node(pos, operator, operand):
     # given operator.
     if isinstance(operand, IntNode) and operator == '-':
         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, 
         operator = operator, 
         operand = operand)