[vala/0.48] codegen: Also check array type of variable argument for ref parameters



commit 14a3bffa2cda2e2a770aa96dbce739f8f6fd610e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Feb 1 08:18:38 2021 +0100

    codegen: Also check array type of variable argument for ref parameters

 codegen/valaccodemethodcallmodule.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 0cbd01ec4..461e89735 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -939,9 +939,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        if (unary != null && unary.operator == UnaryOperator.REF) {
                                if (param != null && get_ccode_array_length (param) && param.variable_type is 
ArrayType
                                    && !((ArrayType) param.variable_type).fixed_length && ((ArrayType) 
param.variable_type).rank == 1) {
-                                       unowned Symbol? array_var = unary.inner.symbol_reference;
-                                       if (array_var != null && array_var.is_internal_symbol ()
-                                           && (array_var is LocalVariable || array_var is Field)) {
+                                       unowned Variable? array_var = unary.inner.symbol_reference as 
Variable;
+                                       if ((array_var is LocalVariable || array_var is Field) && 
array_var.is_internal_symbol ()
+                                           && array_var.variable_type is ArrayType && !((ArrayType) 
array_var.variable_type).fixed_length) {
                                                ccode.add_assignment (get_array_size_cvalue 
(unary.inner.target_value), get_array_length_cvalue (unary.inner.target_value, 1));
                                        }
                                }


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