[vala/wip/issue/658: 18/30] cleaning 2




commit c3b5e74d3f9df9468b2a2521801f17cbf93312cf
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Oct 7 17:46:25 2020 +0200

    cleaning 2

 vala/valadelegatetype.vala | 27 ---------------------------
 vala/valaparser.vala       |  3 ++-
 2 files changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index b8b9a9530..4029f00af 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -33,30 +33,12 @@ public class Vala.DelegateType : CallableType {
        }
 
        public bool is_called_once { get; set; }
-       public bool is_anonymous { get; private set; }
 
        DelegateTargetField? target_field;
        DelegateDestroyField? destroy_field;
 
-       /*
-        * TODO: Something weird is going on here... Without this variable `symbol`
-        * (and hence `delegate_symbol`) suddenly change type from ValaDelegate to ValaLocalVariable.
-        * Maybe the symbol of type ValaDelegate is discarded because of its weak reference and
-        * memory for a new one of type ValaLocalVariable is allocated at the exact same address?
-        */
-       Delegate delegate_symbol_ref;
-
-       public DelegateType.anonymous (Delegate delegate_symbol) {
-               if (delegate_symbol!= null) {
-                       stderr.printf("constr anonymous delegate_symbol name %s, type: %s\n", 
delegate_symbol.name, Type.from_instance(delegate_symbol).name());
-               }
-               this (delegate_symbol);
-               this.is_anonymous = true;
-       }
-
        public DelegateType (Delegate delegate_symbol) {
                base (delegate_symbol);
-               delegate_symbol_ref = delegate_symbol;
                this.is_called_once = (delegate_symbol.get_attribute_string ("CCode", "scope") == "async");
        }
 
@@ -108,15 +90,6 @@ public class Vala.DelegateType : CallableType {
                return delegate_symbol.is_accessible (sym);
        }
 
-
-       public override void accept (CodeVisitor visitor) {
-               base.accept (visitor);
-
-               if (is_anonymous) {
-                       delegate_symbol.accept (visitor);
-               }
-       }
-
        public override bool check (CodeContext context) {
                if (is_called_once && !value_owned) {
                        Report.warning (source_reference, "delegates with scope=\"async\" must be owned");
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index d059bd592..447cce690 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3727,6 +3727,7 @@ public class Vala.Parser : CodeVisitor {
 
                // TODO: Get rid of hardcoded name, it should be anonymous
                var d = new Delegate ("oma123", type, get_src (begin), comment);
+               d.anonymous = true;
                
                foreach (var type_param in type_param_list) {
                        d.add_type_parameter (type_param);
@@ -3741,7 +3742,7 @@ public class Vala.Parser : CodeVisitor {
                }
 
                parent.scope.add(null, d);
-               return new DelegateType.anonymous(d);
+               return new DelegateType (d);
        }
 
        List<TypeParameter> parse_type_parameter_list () throws ParseError {


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