]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Treat casts of C constants as constants
authorJürg Billeter <j@bitron.ch>
Tue, 16 Jun 2009 08:51:46 +0000 (10:51 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 16 Jun 2009 08:51:46 +0000 (10:51 +0200)
codegen/valaccodebasemodule.vala

index 5be268c988c9fb499cb09d9d3af525a07f67f9c9..925d9b5e19418a2a2fbd27ad99194b31e0155fc8 100644 (file)
@@ -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);