From: Rico Tzschichholz Date: Sun, 8 Mar 2020 09:41:16 +0000 (+0100) Subject: codegen: Inherit "delegate_target" from (base-/base-interface) parameter/property... X-Git-Tag: 0.48.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f03b08c498f6b9b989e412eb0ca93ceb21637ce2;p=thirdparty%2Fvala.git codegen: Inherit "delegate_target" from (base-/base-interface) parameter/property/method --- diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala index e5394f1b8..ce61b3667 100644 --- a/codegen/valaccodeattribute.vala +++ b/codegen/valaccodeattribute.vala @@ -1477,13 +1477,33 @@ public class Vala.CCodeAttribute : AttributeCache { private bool get_default_delegate_target () { if (node is Field || node is Parameter || node is LocalVariable) { + if (node is Parameter) { + unowned Parameter param = (Parameter) node; + if (param.base_parameter != null) { + return get_ccode_delegate_target (param.base_parameter); + } + } unowned DelegateType? delegate_type = ((Variable) node).variable_type as DelegateType; return delegate_type != null && delegate_type.delegate_symbol.has_target; } else if (node is Callable) { + if (node is Method) { + unowned Method method = (Method) node; + if (method.base_method != null && method.base_method != method) { + return get_ccode_delegate_target (method.base_method); + } else if (method.base_interface_method != null && method.base_interface_method != method) { + return get_ccode_delegate_target (method.base_interface_method); + } + } unowned DelegateType? delegate_type = ((Callable) node).return_type as DelegateType; return delegate_type != null && delegate_type.delegate_symbol.has_target; } else if (node is Property) { - unowned DelegateType? delegate_type = ((Property) node).property_type as DelegateType; + unowned Property prop = (Property) node; + if (prop.base_property != null && prop.base_property != prop) { + return get_ccode_delegate_target (prop.base_property); + } else if (prop.base_interface_property != null && prop.base_interface_property != prop) { + return get_ccode_delegate_target (prop.base_interface_property); + } + unowned DelegateType? delegate_type = prop.property_type as DelegateType; return delegate_type != null && delegate_type.delegate_symbol.has_target; } else if (node is PropertyAccessor) { return get_ccode_delegate_target (((PropertyAccessor) node).prop);