[vala/staging] codegen: Inherit "array" attributes from (base/base-interface) property



commit 6fba9d7fae2970c800150ff337d6492346bec3e4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Mar 8 10:41:16 2020 +0100

    codegen: Inherit "array" attributes from (base/base-interface) property

 codegen/valaccodeattribute.vala  | 18 ++++++++++++++++++
 codegen/valaccodebasemodule.vala |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index aa3209703..e5394f1b8 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -1509,6 +1509,15 @@ public class Vala.CCodeAttribute : AttributeCache {
                        } else if (method.base_interface_method != null && method.base_interface_method != 
method) {
                                return get_ccode_array_length (method.base_interface_method);
                        }
+               } else if (node is Property) {
+                       unowned Property prop = (Property) node;
+                       if (prop.base_property != null && prop.base_property != prop) {
+                               return get_ccode_array_length (prop.base_property);
+                       } else if (prop.base_interface_property != null && prop.base_interface_property != 
prop) {
+                               return get_ccode_array_length (prop.base_interface_property);
+                       }
+               } else if (node is PropertyAccessor) {
+                       return get_ccode_array_length (((PropertyAccessor) node).prop);
                }
                return true;
        }
@@ -1526,6 +1535,15 @@ public class Vala.CCodeAttribute : AttributeCache {
                        } else if (method.base_interface_method != null && method.base_interface_method != 
method) {
                                return get_ccode_array_null_terminated (method.base_interface_method);
                        }
+               } else if (node is Property) {
+                       unowned Property prop = (Property) node;
+                       if (prop.base_property != null && prop.base_property != prop) {
+                               return get_ccode_array_null_terminated (prop.base_property);
+                       } else if (prop.base_interface_property != null && prop.base_interface_property != 
prop) {
+                               return get_ccode_array_null_terminated (prop.base_interface_property);
+                       }
+               } else if (node is PropertyAccessor) {
+                       return get_ccode_array_null_terminated (((PropertyAccessor) node).prop);
                }
                return false;
        }
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 5dfadecbc..36124b53e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3978,7 +3978,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                }
 
                // return array length if appropriate
-               if (((current_method != null && get_ccode_array_length (current_method)) || 
(current_property_accessor != null && get_ccode_array_length (current_property_accessor.prop))) && 
current_return_type is ArrayType) {
+               if (((current_method != null && get_ccode_array_length (current_method)) || 
(current_property_accessor != null && get_ccode_array_length (current_property_accessor))) && 
current_return_type is ArrayType) {
                        var temp_value = store_temp_value (stmt.return_expression.target_value, stmt);
 
                        var array_type = (ArrayType) current_return_type;


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