vala r1534 - in trunk: . gobject



Author: juergbi
Date: Sun Jun  1 20:34:28 2008
New Revision: 1534
URL: http://svn.gnome.org/viewvc/vala?rev=1534&view=rev

Log:
2008-06-01  JÃrg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala:

	Fix foreach when used with methods returning arrays


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Sun Jun  1 20:34:28 2008
@@ -1953,15 +1953,14 @@
 			var array_type = (ArrayType) stmt.collection.value_type;
 			
 			var array_len = get_array_length_cexpression (stmt.collection);
-			
-			if (array_len is CCodeConstant) {
-				// the array has no length parameter i.e. it is NULL-terminated array
 
-				// store array length for use by _vala_array_free
-				var clendecl = new CCodeDeclaration ("int");
-				clendecl.add_declarator (new CCodeVariableDeclarator.with_initializer (get_array_length_cname (collection_backup.name, 1), array_len));
-				cblock.add_statement (clendecl);
+			// store array length for use by _vala_array_free
+			var clendecl = new CCodeDeclaration ("int");
+			clendecl.add_declarator (new CCodeVariableDeclarator.with_initializer (get_array_length_cname (collection_backup.name, 1), array_len));
+			cblock.add_statement (clendecl);
 
+			if (array_len is CCodeConstant) {
+				// the array has no length parameter i.e. it is NULL-terminated array
 
 				var it_name = "%s_it".printf (stmt.variable_name);
 			



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