[vala/wip/issue/658: 2/9] Removed crap




commit 5ca1ff877bcb03130971c6d1161b840fa346a76f
Author: Nick Schrader <nick schrader mailbox org>
Date:   Mon Jul 20 12:50:36 2020 +0200

    Removed crap

 1                              | 16580 ---------------------------------------
 2                              |     1 -
 delegate                       |   Bin 12432 -> 0 bytes
 deltest                        |   Bin 12432 -> 0 bytes
 deltest2                       |   Bin 12440 -> 0 bytes
 file                           | 10457 ------------------------
 tmp/deltest.vala               |    16 +-
 vala/valacodevisitor.vala      |     8 -
 vala/valadatatype.vala         |    16 +-
 vala/valadelegatetype.vala     |     1 -
 vala/valaparser.vala           |    44 +-
 vala/valasemanticanalyzer.vala |     1 -
 vala/valasymbolresolver.vala   |    20 -
 with                           |   Bin 18512 -> 0 bytes
 14 files changed, 16 insertions(+), 27128 deletions(-)
---
diff --git a/tmp/deltest.vala b/tmp/deltest.vala
index e416b882d..feabfdd29 100644
--- a/tmp/deltest.vala
+++ b/tmp/deltest.vala
@@ -2,10 +2,18 @@ void main() {
     f(t);
 }
 
-int t(int a, int b) {
-    return a+b;
+int t(Comp<int> a, Comp<int> b) {
+    return a.a+b.a;
 }
 
-void f(delegate(int x, int y) => int abc) {
-    stdout.printf ("%d", abc(1, 2));
+void f(delegate(Comp<int> x, Comp<int> y) => int abc) {
+    stdout.printf ("%d", abc(new Comp<int>(1), new Comp<int>(2)));
+}
+
+class Comp<A> {
+    public A a { get; private set; }
+
+    public Comp (A a) {
+        this.a = a;
+    }
 }
diff --git a/vala/valacodevisitor.vala b/vala/valacodevisitor.vala
index 0799728d7..f47f96349 100644
--- a/vala/valacodevisitor.vala
+++ b/vala/valacodevisitor.vala
@@ -108,14 +108,6 @@ public abstract class Vala.CodeVisitor {
        public virtual void visit_delegate (Delegate d) {
        }
 
-       /**
-        * Visit operation called for delegates.
-        *
-        * @param d a delegate
-        */
-       public virtual void visit_anonymous_delegate (Delegate d) {
-       }
-
        /**
         * Visit operation called for constants.
         *
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 131792453..624775ead 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -41,23 +41,10 @@ public abstract class Vala.DataType : CodeNode {
         */
        public bool nullable { get; set; }
 
-       private weak Symbol? _symbol;
        /**
         * The referred symbol.
         */
-       /*public weak Symbol? symbol { 
-               get { if (marker) stderr.printf("Getting symbol\n"); return _symbol;}
-               private set { if (marker) stderr.printf("Setting symbol\n"); _symbol = value; }
-       }*/
-
-       public weak Symbol? symbol { 
-               get { return _symbol;}
-               private set { _symbol = value; }
-       }
-
-       public void print_symbol_addr() {
-               stderr.printf("*symbol: %p\n", &_symbol);
-       }
+       public weak Symbol? symbol { get; private set; }
 
        /**
         * The referred type symbol.
@@ -82,7 +69,6 @@ public abstract class Vala.DataType : CodeNode {
        private static List<DataType> _empty_type_list;
 
        protected DataType.with_symbol (Symbol? symbol) {
-               //stderr.printf("DataType.with_symbol: %s\n", symbol != null ? symbol.name : "null");
                this.symbol = symbol;
        }
 
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 2fa3ff8c3..9301c9d69 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -30,7 +30,6 @@ public class Vala.DelegateType : CallableType {
                get {
                        if (marker && symbol != null) {
                                stderr.printf("[*%p] delegate_symbol name: %s, type: %s ", &(this.marker), 
symbol.name, Type.from_instance(symbol).name());
-                               print_symbol_addr();
                                stderr.printf("constr del name %s, type: %s, address %p\n", del.name, 
Type.from_instance(del).name(), &del);
                        }
                        return (Delegate) symbol;
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index b69c5670e..ba4661e03 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2947,7 +2947,6 @@ public class Vala.Parser : CodeVisitor {
                var flags = parse_member_declaration_modifiers ();
                var type = parse_type (true, false);
                var sym = parse_symbol_name ();
-               //stdout.printf("%s\n", sym.name);
                var type_param_list = parse_type_parameter_list ();
                var method = new Method (sym.name, type, get_src (begin), comment);
                if (sym.inner != null) {
@@ -3701,15 +3700,9 @@ public class Vala.Parser : CodeVisitor {
                if (parent == null) {
                        throw new ParseError.SYNTAX ("anonymous delegate: parent==null");
                }
+
                var begin = get_location ();
-               //var access = parse_access_modifier ();
-               //var flags = parse_member_declaration_modifiers ();
                expect (TokenType.DELEGATE);
-               /*if (ModifierFlags.NEW in flags) {
-                       throw new ParseError.SYNTAX ("`new' modifier not allowed on delegates");
-               }*/
-               //var type = parse_type (true, false);
-               //var sym = parse_symbol_name ();
                var type_param_list = parse_type_parameter_list ();
 
                expect (TokenType.OPEN_PARENS);
@@ -3732,25 +3725,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);
-               /*d.access = access;
-               set_attributes (d, attrs);
-               if (ModifierFlags.STATIC in flags) {
-                       if (!context.deprecated) {
-                               // TODO enable warning in future releases
-                               Report.warning (get_last_src (), "deprecated syntax, use [CCode (has_target = 
false)]");
-                       }
-                       d.has_target = false;
-               }
-               if (ModifierFlags.EXTERN in flags) {
-                       d.is_extern = true;
-               }
-               if (!d.get_attribute_bool ("CCode", "has_typedef", true)) {
-                       if (!d.external) {
-                               Report.error (get_last_src (), "Delegates without definition must be 
external");
-                       }
-                       d.anonymous = true;
-               }*/
+               
                foreach (var type_param in type_param_list) {
                        d.add_type_parameter (type_param);
                }
@@ -3765,21 +3742,6 @@ public class Vala.Parser : CodeVisitor {
 
                parent.scope.add(null, d);
                return new DelegateType.anonymous(d);
-               
-               //expect (TokenType.SEMICOLON);
-
-               /*Symbol result = d;
-               while (sym != null) {
-                       sym = sym.inner;
-
-                       Symbol next = (sym != null ? new Namespace (sym.name, d.source_reference) : parent);
-                       if (result is Namespace) {
-                               next.add_namespace ((Namespace) result);
-                       } else {
-                               next.add_delegate ((Delegate) result);
-                       }
-                       result = next;
-               }*/
        }
 
        List<TypeParameter> parse_type_parameter_list () throws ParseError {
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 668b079d8..e91d39b60 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -679,7 +679,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                if (arg.target_type != null) {
                        if ((direction == ParameterDirection.IN || direction == ParameterDirection.REF)
                            && !arg.value_type.compatible (arg.target_type)) {
-                               arg.value_type.compatible (arg.target_type);
                                stderr.printf("Target parent type: %s\n", arg.target_type.parent_node == null 
? "null" : Type.from_instance(arg.target_type.parent_node).name());
                                stderr.printf("arg value: %s, target: %s, target_type_symbol: %s\n", 
Type.from_instance(arg.value_type).name(), Type.from_instance(arg.target_type).name(), 
arg.target_type.type_symbol == null ? "null" : Type.from_instance(arg.target_type.type_symbol).name());
                                Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to 
`%s'".printf (i + 1, arg.value_type.to_prototype_string (), arg.target_type.to_prototype_string ()));
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 015d85133..b2c29f91e 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -168,23 +168,6 @@ public class Vala.SymbolResolver : CodeVisitor {
                current_scope = current_scope.parent_scope;
        }
 
-       public override void visit_anonymous_delegate (Delegate cb) {
-               if (cb.checked) {
-                       return;
-               }
-
-               if (cb.name == "oma123") {
-                       stderr.printf("@oma123 (anonymous)\n");
-                       debug = true;
-               }
-
-               current_scope = cb.scope;
-
-               cb.accept_children (this);
-
-               current_scope = current_scope.parent_scope;
-       }
-
        public override void visit_constant (Constant c) {
                if (c.checked) {
                        return;
@@ -300,9 +283,6 @@ public class Vala.SymbolResolver : CodeVisitor {
 
        private Symbol? resolve_symbol (UnresolvedSymbol unresolved_symbol) {
                var sym = resolve_symbol2(unresolved_symbol);
-               if (false) { //(sym.name==null) {
-                       stderr.printf("resolve symbol: %s, type: %s\n", sym.name, 
Type.from_instance(sym).name());
-               }
                if (sym==null) {
                        stderr.printf("Could not find symbol: name: %s, type: %s\n", unresolved_symbol.name, 
Type.from_instance(unresolved_symbol).name());
                }


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