From: Jürg Billeter Date: Tue, 16 Jun 2009 08:51:46 +0000 (+0200) Subject: Treat casts of C constants as constants X-Git-Tag: 0.7.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2fcb15be51f146f38acedeedcc6b410b092daa4;p=thirdparty%2Fvala.git Treat casts of C constants as constants --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 5be268c98..925d9b5e1 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1020,6 +1020,9 @@ internal class Vala.CCodeBaseModule : CCodeModule { public bool is_constant_ccode_expression (CCodeExpression cexpr) { if (cexpr is CCodeConstant) { return true; + } else if (cexpr is CCodeCastExpression) { + var ccast = (CCodeCastExpression) cexpr; + return is_constant_ccode_expression (ccast.inner); } else if (cexpr is CCodeBinaryExpression) { var cbinary = (CCodeBinaryExpression) cexpr; return is_constant_ccode_expression (cbinary.left) && is_constant_ccode_expression (cbinary.right);