[vala] codegen: Fix initializer lists for structs with array fields



commit 5d29984bff7d5c2ac32372470b8de439a477ecd4
Author: Jürg Billeter <j bitron ch>
Date:   Tue Apr 5 19:23:00 2011 +0200

    codegen: Fix initializer lists for structs with array fields

 codegen/valaccodebasemodule.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 2c7633e..aab8d65 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2125,6 +2125,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 					}
 
 					clist.append (cexpr);
+
+					var array_type = field.variable_type as ArrayType;
+					if (array_type != null && !field.no_array_length && !field.array_null_terminated) {
+						for (int dim = 1; dim <= array_type.rank; dim++) {
+							clist.append (get_array_length_cvalue (expr.target_value, dim));
+						}
+					}
 				}
 
 				set_cvalue (list, clist);



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