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



commit e4861a8a8bad1b59b485d95b6565a447f4eedf7b
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 a549f0621..b85aca900 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -237,10 +237,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 (int_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]