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



commit 0dece893b7516b17c16ae1e1e565255e0d761f92
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 19:37:01 2021 -0600

    Symbol.add_enum(): avoid use static context

 vala/valagenieparser.vala      | 8 ++++----
 vala/valagirparser.vala        | 6 +++---
 vala/valanamespace.vala        | 4 ++--
 vala/valaobjecttypesymbol.vala | 2 +-
 vala/valaparser.vala           | 2 +-
 vala/valasymbol.vala           | 4 ++--
 vapigen/valagidlparser.vala    | 6 +++---
 7 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index e753387e4..c5ea5d384 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2606,7 +2606,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Struct) {
                        ns.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
-                       ns.add_enum ((Enum) sym);
+                       ns.add_enum ((Enum) sym, context);
                } else if (sym is ErrorDomain) {
                        ns.add_error_domain ((ErrorDomain) sym);
                } else if (sym is Delegate) {
@@ -2740,7 +2740,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Struct) {
                        cl.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
-                       cl.add_enum ((Enum) sym);
+                       cl.add_enum ((Enum) sym, context);
                } else if (sym is Delegate) {
                        cl.add_delegate ((Delegate) sym);
                } else if (sym is Method) {
@@ -3413,7 +3413,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Struct) {
                        iface.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
-                       iface.add_enum ((Enum) sym);
+                       iface.add_enum ((Enum) sym, context);
                } else if (sym is Delegate) {
                        iface.add_delegate ((Delegate) sym);
                } else if (sym is Method) {
@@ -3486,7 +3486,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        if (result is Namespace) {
                                ns.add_namespace ((Namespace) result, context);
                        } else {
-                               ns.add_enum ((Enum) result);
+                               ns.add_enum ((Enum) result, context);
                        }
                        result = ns;
                }
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 169341c91..74c4a59b9 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1543,7 +1543,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Constant) {
                                cl.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
-                               cl.add_enum ((Enum) sym);
+                               cl.add_enum ((Enum) sym, context);
                        } else if (sym is Field) {
                                cl.add_field ((Field) sym);
                        } else if (sym is Method) {
@@ -1573,7 +1573,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Constant) {
                                iface.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
-                               iface.add_enum ((Enum) sym);
+                               iface.add_enum ((Enum) sym, context);
                        } else if (sym is Field) {
                                iface.add_field ((Field) sym);
                        } else if (sym is Method) {
@@ -1597,7 +1597,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Delegate) {
                                ns.add_delegate ((Delegate) sym);
                        } else if (sym is Enum) {
-                               ns.add_enum ((Enum) sym);
+                               ns.add_enum ((Enum) sym, context);
                        } else if (sym is ErrorDomain) {
                                ns.add_error_domain ((ErrorDomain) sym);
                        } else if (sym is Field) {
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index b175e7ad0..107832b3b 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -112,7 +112,7 @@ public class Vala.Namespace : Symbol {
                                old_ns.add_delegate (d);
                        }
                        foreach (Enum en in ns.get_enums ()) {
-                               old_ns.add_enum (en);
+                               old_ns.add_enum (en, context);
                        }
                        foreach (ErrorDomain ed in ns.get_error_domains ()) {
                                old_ns.add_error_domain (ed);
@@ -212,7 +212,7 @@ public class Vala.Namespace : Symbol {
         *
         * @param en an enum
         */
-       public override void add_enum (Enum en) {
+       public override void add_enum (Enum en, CodeContext context) {
                // namespaces do not support private members
                if (en.access == SymbolAccessibility.PRIVATE) {
                        en.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index d0201d13a..6c76c73be 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -228,7 +228,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
         *
         * @param en an enum
         */
-       public override void add_enum (Enum en) {
+       public override void add_enum (Enum en, CodeContext context) {
                enums.add (en);
                scope.add (en.name, en);
        }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 81767c530..962ea365d 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3611,7 +3611,7 @@ public class Vala.Parser : CodeVisitor {
                        if (result is Namespace) {
                                next.add_namespace ((Namespace) result, context);
                        } else {
-                               next.add_enum ((Enum) result);
+                               next.add_enum ((Enum) result, context);
                        }
                        result = next;
                }
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 900400000..a38f0094c 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -467,8 +467,8 @@ public abstract class Vala.Symbol : CodeNode {
                context.report.log_error (st.source_reference, "inner `%s' types are not supported in `%s'", 
"struct", get_full_name ());
        }
 
-       public virtual void add_enum (Enum en) {
-               Report.error (en.source_reference, "inner `%s' types are not supported in `%s'", "enum", 
get_full_name ());
+       public virtual void add_enum (Enum en, CodeContext context) {
+               context.report.log_error (en.source_reference, "inner `%s' types are not supported in `%s'", 
"enum", get_full_name ());
        }
 
        public virtual void add_error_domain (ErrorDomain edomain) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index ee955b618..3609afa47 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -326,7 +326,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Constant) {
                                cl.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
-                               cl.add_enum ((Enum) sym);
+                               cl.add_enum ((Enum) sym, context);
                        } else if (sym is Field) {
                                cl.add_field ((Field) sym);
                        } else if (sym is Method) {
@@ -356,7 +356,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Constant) {
                                iface.add_constant ((Constant) sym);
                        } else if (sym is Enum) {
-                               iface.add_enum ((Enum) sym);
+                               iface.add_enum ((Enum) sym, context);
                        } else if (sym is Field) {
                                iface.add_field ((Field) sym);
                        } else if (sym is Method) {
@@ -380,7 +380,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Delegate) {
                                ns.add_delegate ((Delegate) sym);
                        } else if (sym is Enum) {
-                               ns.add_enum ((Enum) sym);
+                               ns.add_enum ((Enum) sym, context);
                        } else if (sym is ErrorDomain) {
                                ns.add_error_domain ((ErrorDomain) sym);
                        } else if (sym is Field) {


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