]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Consider negative literals constant
authorJürg Billeter <j@bitron.ch>
Fri, 8 Jan 2010 21:07:56 +0000 (22:07 +0100)
committerJürg Billeter <j@bitron.ch>
Fri, 8 Jan 2010 21:07:56 +0000 (22:07 +0100)
Fixes bug 605158.

vala/valaunaryexpression.vala

index b2066a373d101552655f828e50d3c035a77bc366..f5b99e499dc3b515ef65eddb719464e1342084e1 100644 (file)
@@ -1,6 +1,6 @@
 /* valaunaryexpression.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -96,6 +96,14 @@ public class Vala.UnaryExpression : Expression {
                return get_operator_string () + _inner.to_string ();
        }
 
+       public override bool is_constant () {
+               if (operator == UnaryOperator.INCREMENT || operator == UnaryOperator.DECREMENT) {
+                       return false;
+               }
+
+               return inner.is_constant ();
+       }
+
        public override bool is_pure () {
                if (operator == UnaryOperator.INCREMENT || operator == UnaryOperator.DECREMENT) {
                        return false;