[vala] Treat casts of C constants as constants



commit b2fcb15be51f146f38acedeedcc6b410b092daa4
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jun 16 10:51:46 2009 +0200

    Treat casts of C constants as constants

 codegen/valaccodebasemodule.vala |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 5be268c..925d9b5 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]