[vala/0.44] codegen: Use array_length of collection variable instead of expression



commit 452dbd38133e3269c7c2a9ddd0d7cc7c4ac333f7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Jun 13 15:58:58 2019 +0200

    codegen: Use array_length of collection variable instead of expression

 codegen/valaccodecontrolflowmodule.vala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 25c386f50..df31fcef3 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -242,10 +242,10 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                if (stmt.collection.value_type is ArrayType) {
                        array_type = (ArrayType) stmt.collection.value_type;
 
-                       var array_len = get_array_length_cexpression (stmt.collection);
+                       var array_len = get_variable_cexpression (get_array_length_cname (get_local_cname 
(collection_backup), 1));
 
                        // 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);
+                       ccode.add_assignment (array_len, get_array_length_cexpression (stmt.collection));
 
                        var iterator_variable = new LocalVariable (array_type.length_type.copy (), 
stmt.variable_name + "_it");
                        visit_local_variable (iterator_variable);


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