From: Jürg Billeter Date: Fri, 8 Jan 2010 21:07:56 +0000 (+0100) Subject: Consider negative literals constant X-Git-Tag: 0.7.10~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11764759cbec71a1f07bb65e85f27e18a2c2770c;p=thirdparty%2Fvala.git Consider negative literals constant Fixes bug 605158. --- diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala index b2066a373..f5b99e499 100644 --- a/vala/valaunaryexpression.vala +++ b/vala/valaunaryexpression.vala @@ -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;