]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Inherit "array" attributes from (base/base-interface) property
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 8 Mar 2020 09:41:16 +0000 (10:41 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 8 Mar 2020 09:41:16 +0000 (10:41 +0100)
codegen/valaccodeattribute.vala
codegen/valaccodebasemodule.vala

index aa3209703b65cd0e814829e25b7482d8cb987894..e5394f1b88e313a9805391d0989ed2d3d3b81eb9 100644 (file)
@@ -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;
        }
index 5dfadecbcb1d61a59062950f63b16b874f974de8..36124b53eda0995f323bedf3db2d84849fa53899 100644 (file)
@@ -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;