From: Rico Tzschichholz Date: Sun, 8 Mar 2020 09:41:16 +0000 (+0100) Subject: codegen: Inherit "array" attributes from (base/base-interface) property X-Git-Tag: 0.48.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fba9d7fae2970c800150ff337d6492346bec3e4;p=thirdparty%2Fvala.git codegen: Inherit "array" attributes from (base/base-interface) property --- 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;