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



commit 5376b3313813e8a5073979fa08d3cbc80639f8a8
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 18:16:53 2021 -0600

    Symbol.add_class(): avoid use static code context

 vala/valagenieparser.vala      | 8 ++++----
 vala/valagirparser.vala        | 6 +++---
 vala/valanamespace.vala        | 4 ++--
 vala/valaobjecttypesymbol.vala | 2 +-
 vala/valaparser.vala           | 4 ++--
 vala/valasymbol.vala           | 4 ++--
 vapigen/valagidlparser.vala    | 6 +++---
 7 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 71bfa1caf..103ecb976 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2600,7 +2600,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                if (sym is Namespace) {
                        ns.add_namespace ((Namespace) sym, context);
                } else if (sym is Class) {
-                       ns.add_class ((Class) sym);
+                       ns.add_class ((Class) sym, context);
                } else if (sym is Interface) {
                        ns.add_interface ((Interface) sym);
                } else if (sym is Struct) {
@@ -2726,7 +2726,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        if (result is Namespace) {
                                ns.add_namespace ((Namespace) result, context);
                        } else {
-                               ns.add_class ((Class) result);
+                               ns.add_class ((Class) result, context);
                        }
                        result = ns;
                }
@@ -2736,7 +2736,7 @@ public class Vala.Genie.Parser : CodeVisitor {
        void parse_class_member (Class cl) throws ParseError {
                var sym = parse_declaration ();
                if (sym is Class) {
-                       cl.add_class ((Class) sym);
+                       cl.add_class ((Class) sym, context);
                } else if (sym is Struct) {
                        cl.add_struct ((Struct) sym);
                } else if (sym is Enum) {
@@ -3409,7 +3409,7 @@ public class Vala.Genie.Parser : CodeVisitor {
        void parse_interface_member (Interface iface) throws ParseError {
                var sym = parse_declaration ();
                if (sym is Class) {
-                       iface.add_class ((Class) sym);
+                       iface.add_class ((Class) sym, context);
                } else if (sym is Struct) {
                        iface.add_struct ((Struct) sym);
                } else if (sym is Enum) {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 3ef7a22e7..bb3038e14 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1539,7 +1539,7 @@ public class Vala.GirParser : CodeVisitor {
                        unowned Class cl = (Class) container;
 
                        if (sym is Class) {
-                               cl.add_class ((Class) sym);
+                               cl.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                cl.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
@@ -1569,7 +1569,7 @@ public class Vala.GirParser : CodeVisitor {
                        unowned Interface iface = (Interface) container;
 
                        if (sym is Class) {
-                               iface.add_class ((Class) sym);
+                               iface.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                iface.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
@@ -1591,7 +1591,7 @@ public class Vala.GirParser : CodeVisitor {
                        if (sym is Namespace) {
                                ns.add_namespace ((Namespace) sym, context);
                        } else if (sym is Class) {
-                               ns.add_class ((Class) sym);
+                               ns.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                ns.add_constant ((Constant) sym);
                        } else if (sym is Delegate) {
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index bb46108d2..543bd2d25 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -100,7 +100,7 @@ public class Vala.Namespace : Symbol {
                                old_ns.add_namespace (sub_ns, context);
                        }
                        foreach (Class cl in ns.get_classes ()) {
-                               old_ns.add_class (cl);
+                               old_ns.add_class (cl, context);
                        }
                        foreach (Struct st in ns.get_structs ()) {
                                old_ns.add_struct (st);
@@ -154,7 +154,7 @@ public class Vala.Namespace : Symbol {
         *
         * @param cl a class
         */
-       public override void add_class (Class cl) {
+       public override void add_class (Class cl, CodeContext context) {
                // namespaces do not support private members
                if (cl.access == SymbolAccessibility.PRIVATE) {
                        cl.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 97f1f0f2c..dfa42d407 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -198,7 +198,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
         *
         * @param cl a class
         */
-       public override void add_class (Class cl) {
+       public override void add_class (Class cl, CodeContext context) {
                classes.add (cl);
                scope.add (cl.name, cl);
        }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 44b3f7b91..eda1f0f8d 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3040,7 +3040,7 @@ public class Vala.Parser : CodeVisitor {
                }
 
                if (partial_reparse) {
-                       parent.add_class (cl);
+                       parent.add_class (cl, context);
                        return;
                }
 
@@ -3055,7 +3055,7 @@ public class Vala.Parser : CodeVisitor {
                                PartialInfo info = { parent, begin, attrs };
                                partials += info;
                        } else if (!cl.is_partial) {
-                               next.add_class ((Class) result);
+                               next.add_class ((Class) result, context);
                        }
                        result = next;
                }
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index ad4e022b5..ed3a7dc35 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -455,8 +455,8 @@ public abstract class Vala.Symbol : CodeNode {
                context.report.log_error (ns.source_reference, "inner `%s' is not supported in `%s'", 
"namespace", get_full_name ());
        }
 
-       public virtual void add_class (Class cl) {
-               Report.error (cl.source_reference, "inner `%s' types are not supported in `%s'", "class", 
get_full_name ());
+       public virtual void add_class (Class cl, CodeContext context) {
+               context.report.log_error (cl.source_reference, "inner `%s' types are not supported in `%s'", 
"class", get_full_name ());
        }
 
        public virtual void add_interface (Interface iface) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index df1cf7381..4b0da7678 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -322,7 +322,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        unowned Class cl = (Class) container;
 
                        if (sym is Class) {
-                               cl.add_class ((Class) sym);
+                               cl.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                cl.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
@@ -352,7 +352,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        unowned Interface iface = (Interface) container;
 
                        if (sym is Class) {
-                               iface.add_class ((Class) sym);
+                               iface.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                iface.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
@@ -374,7 +374,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        if (sym is Namespace) {
                                ns.add_namespace ((Namespace) sym, context);
                        } else if (sym is Class) {
-                               ns.add_class ((Class) sym);
+                               ns.add_class ((Class) sym, context);
                        } else if (sym is Constant) {
                                ns.add_constant ((Constant) sym);
                        } else if (sym is Delegate) {


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