]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Inherit "delegate_target" from (base-/base-interface) parameter/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

index e5394f1b88e313a9805391d0989ed2d3d3b81eb9..ce61b36676107bd2d2cd7d29347f03ea9c4ab759 100644 (file)
@@ -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);