]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Infer index type of foreach on array from ArrayType.length_type 597f95c3a7b92f42677904828c100b202c3dd2ee 25/head
authorGeorge Barrett <bob@bob131.so>
Tue, 12 Dec 2017 03:39:33 +0000 (14:39 +1100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 2 Nov 2018 13:24:10 +0000 (14:24 +0100)
https://gitlab.gnome.org/GNOME/vala/issues/607

codegen/valaccodecontrolflowmodule.vala

index 1936d512d5ca88038c540cc6d0d36b2a8ecf4ee3..58e51d99f572a6415683a99c2ebbf2c394b0f438 100644 (file)
@@ -247,7 +247,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        // store array length for use by _vala_array_free
                        ccode.add_assignment (get_variable_cexpression (get_array_length_cname (get_local_cname (collection_backup), 1)), array_len);
 
-                       var iterator_variable = new LocalVariable (int_type.copy (), stmt.variable_name + "_it");
+                       var iterator_variable = new LocalVariable (array_type.length_type.copy (), stmt.variable_name + "_it");
                        visit_local_variable (iterator_variable);
                        var it_name = get_local_cname (iterator_variable);