[vala] Fix retrieving array length from constants in other source files



commit 0ad170a9f091a504dc96e67955d11baa4b3f0da0
Author: Jürg Billeter <j bitron ch>
Date:   Thu Mar 11 23:33:11 2010 +0100

    Fix retrieving array length from constants in other source files
    
    Fixes bug 612315.

 codegen/valaccodebasemodule.vala |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 42a1fc7..99f7d54 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -904,11 +904,12 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 		if (!c.external) {
 			generate_type_declaration (c.type_reference, decl_space);
 
-			if (c.initializer is InitializerList) {
+			var initializer_list = c.initializer as InitializerList;
+			if (initializer_list != null) {
 				var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
 				var arr = "";
 				if (c.type_reference is ArrayType) {
-					arr = "[]";
+					arr = "[%d]".printf (initializer_list.size);
 				}
 
 				var cinitializer = (CCodeExpression) c.initializer.ccodenode;



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