[vala/staging] codegen: Inherit "delegate_target" from (base-/base-interface) parameter/property/method



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

    codegen: Inherit "delegate_target" from (base-/base-interface) parameter/property/method

 codegen/valaccodeattribute.vala | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
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);


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