[vala/wip/issue/658: 27/48] cleaning 3




commit 24c2dea0e51508b54a1dd71caa3821b1c01e32f2
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Oct 7 18:51:22 2020 +0200

    cleaning 3

 vala/valaparser.vala | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index aa0a3fad6..d8c060fa2 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3696,6 +3696,8 @@ public class Vala.Parser : CodeVisitor {
                }
        }
 
+       static int next_anonymous_id = 0;
+
        DelegateType parse_anonymous_delegate (Symbol? parent) throws ParseError { //(Symbol parent, 
List<Attribute>? attrs) throws ParseError {
                if (parent == null) {
                        throw new ParseError.SYNTAX ("anonymous delegate: parent==null");
@@ -3725,10 +3727,9 @@ public class Vala.Parser : CodeVisitor {
                expect (TokenType.LAMBDA);
                var type = parse_type (true, false);
 
-               // TODO: Get rid of hardcoded name, it should be anonymous
-               var d = new Delegate ("oma123", type, get_src (begin), comment);
+               var d = new Delegate ("__delegate%i_".printf (next_anonymous_id++), 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 {
                        d.add_error_type (error_type);
                }
 
-               parent.scope.add(null, d);
+               parent.add_delegate (d);
                return new DelegateType (d);
        }
 


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