[vala/1270-remove-static-codecontext-access] Symbol.add_delegate(): avoid use static code context



commit 6b5704277a3ce600b077a2ace234f4fcaaa073b8
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 21:01:46 2021 -0600

    Symbol.add_delegate(): avoid use static code context

 vala/valagenieparser.vala      | 8 ++++----
 vala/valagirparser.vala        | 4 ++--
 vala/valanamespace.vala        | 4 ++--
 vala/valaobjecttypesymbol.vala | 2 +-
 vala/valaparser.vala           | 4 ++--
 vala/valasymbol.vala           | 4 ++--
 vapigen/valagidlparser.vala    | 2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 9ad9f8aef..f2d446423 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2610,7 +2610,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is ErrorDomain) {
                        ns.add_error_domain ((ErrorDomain) sym, context);
                } else if (sym is Delegate) {
-                       ns.add_delegate ((Delegate) sym);
+                       ns.add_delegate ((Delegate) sym, context);
                } else if (sym is Method) {
                        unowned Method method = (Method) sym;
                        if (method.binding == MemberBinding.INSTANCE) {
@@ -2742,7 +2742,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Enum) {
                        cl.add_enum ((Enum) sym, context);
                } else if (sym is Delegate) {
-                       cl.add_delegate ((Delegate) sym);
+                       cl.add_delegate ((Delegate) sym, context);
                } else if (sym is Method) {
                        cl.add_method ((Method) sym);
                } else if (sym is Vala.Signal) {
@@ -3415,7 +3415,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Enum) {
                        iface.add_enum ((Enum) sym, context);
                } else if (sym is Delegate) {
-                       iface.add_delegate ((Delegate) sym);
+                       iface.add_delegate ((Delegate) sym, context);
                } else if (sym is Method) {
                        iface.add_method ((Method) sym);
                } else if (sym is Vala.Signal) {
@@ -3831,7 +3831,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        if (result is Namespace) {
                                ns.add_namespace ((Namespace) result, context);
                        } else {
-                               ns.add_delegate ((Delegate) result);
+                               ns.add_delegate ((Delegate) result, context);
                        }
                        result = ns;
                }
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 85fea572f..7e8186b81 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1171,7 +1171,7 @@ public class Vala.GirParser : CodeVisitor {
                                                                field.set_attribute_bool ("CCode", 
"delegate_target", false);
                                                        }
                                                        d.name = "%s%sFunc".printf (parent.symbol.name, 
Symbol.lower_case_to_camel_case (d.name));
-                                                       get_parent_namespace (this).add_delegate (d);
+                                                       get_parent_namespace (this).add_delegate (d, 
parser.context);
                                                }
                                        } else if (field.variable_type is ArrayType) {
                                                Node array_length;
@@ -1595,7 +1595,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Constant) {
                                ns.add_constant ((Constant) sym);
                        } else if (sym is Delegate) {
-                               ns.add_delegate ((Delegate) sym);
+                               ns.add_delegate ((Delegate) sym, context);
                        } else if (sym is Enum) {
                                ns.add_enum ((Enum) sym, context);
                        } else if (sym is ErrorDomain) {
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 820356748..15b463407 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -109,7 +109,7 @@ public class Vala.Namespace : Symbol {
                                old_ns.add_interface (iface, context);
                        }
                        foreach (Delegate d in ns.get_delegates ()) {
-                               old_ns.add_delegate (d);
+                               old_ns.add_delegate (d, context);
                        }
                        foreach (Enum en in ns.get_enums ()) {
                                old_ns.add_enum (en, context);
@@ -250,7 +250,7 @@ public class Vala.Namespace : Symbol {
         *
         * @param d a delegate
         */
-       public override void add_delegate (Delegate d) {
+       public override void add_delegate (Delegate d, CodeContext context) {
                // namespaces do not support private members
                if (d.access == SymbolAccessibility.PRIVATE) {
                        d.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 6c76c73be..3df1d7325 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -238,7 +238,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
         *
         * @param d a delegate
         */
-       public override void add_delegate (Delegate d) {
+       public override void add_delegate (Delegate d, CodeContext context) {
                delegates.add (d);
                scope.add (d.name, d);
        }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 2629990b3..d630c2bf5 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2173,7 +2173,7 @@ public class Vala.Parser : CodeVisitor {
                foreach (var param in params) {
                        d.add_parameter (param);
                }
-               context.root.add_delegate (d);
+               context.root.add_delegate (d, context);
 
                var lambda = new LambdaExpression.with_statement_body (parse_block (), src);
                foreach (var p in params) {
@@ -3931,7 +3931,7 @@ public class Vala.Parser : CodeVisitor {
                        if (result is Namespace) {
                                next.add_namespace ((Namespace) result, context);
                        } else {
-                               next.add_delegate ((Delegate) result);
+                               next.add_delegate ((Delegate) result, context);
                        }
                        result = next;
                }
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 05e33e903..03d7ee014 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -475,8 +475,8 @@ public abstract class Vala.Symbol : CodeNode {
                context.report.log_error (edomain.source_reference, "inner `%s' types are not supported in 
`%s'", "errordomain", get_full_name ());
        }
 
-       public virtual void add_delegate (Delegate d) {
-               Report.error (d.source_reference, "inner `%s' types are not supported in `%s'", "delegate", 
get_full_name ());
+       public virtual void add_delegate (Delegate d, CodeContext context) {
+               context.report.log_error (d.source_reference, "inner `%s' types are not supported in `%s'", 
"delegate", get_full_name ());
        }
 
        public virtual void add_constant (Constant constant) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 93e71f07e..50f70184e 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -378,7 +378,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Constant) {
                                ns.add_constant ((Constant) sym);
                        } else if (sym is Delegate) {
-                               ns.add_delegate ((Delegate) sym);
+                               ns.add_delegate ((Delegate) sym, context);
                        } else if (sym is Enum) {
                                ns.add_enum ((Enum) sym, context);
                        } else if (sym is ErrorDomain) {


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