]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Call visit_local_variable on the foreach collection variable
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 28 Apr 2011 09:40:46 +0000 (11:40 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 28 Apr 2011 11:44:42 +0000 (13:44 +0200)
codegen/valaccodecontrolflowmodule.vala

index 70f7a5ac7ecd846528d21559244549a1601f2689..7c890e0d2cfe75f3ffea8203bfa3f61b28fbb973 100644 (file)
@@ -230,12 +230,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        array_type.fixed_length = false;
                }
 
-               if (is_in_coroutine ()) {
-                       closure_struct.add_field (collection_type.get_cname (), collection_backup.name);
-               } else {
-                       var ccolvardecl = new CCodeVariableDeclarator (collection_backup.name);
-                       ccode.add_declaration (collection_type.get_cname (), ccolvardecl);
-               }
+               visit_local_variable (collection_backup);
                ccode.add_assignment (get_variable_cexpression (collection_backup.name), get_cvalue (stmt.collection));
                
                if (stmt.tree_can_fail && stmt.collection.tree_can_fail) {
@@ -249,11 +244,6 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        var array_len = get_array_length_cexpression (stmt.collection);
 
                        // store array length for use by _vala_array_free
-                       if (is_in_coroutine ()) {
-                               closure_struct.add_field ("int", get_array_length_cname (collection_backup.name, 1));
-                       } else {
-                               ccode.add_declaration ("int", new CCodeVariableDeclarator (get_array_length_cname (collection_backup.name, 1)));
-                       }
                        ccode.add_assignment (get_variable_cexpression (get_array_length_cname (collection_backup.name, 1)), array_len);
 
                        var it_name = (stmt.variable_name + "_it");