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



commit f6620aebfc2916abc495b0fcbbd2d5d760ffb10d
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 19:10:37 2021 -0600

    Symbol.add_struct(): avoid use static code 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 ec60f4f19..e753387e4 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2604,7 +2604,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Interface) {
                        ns.add_interface ((Interface) sym, context);
                } else if (sym is Struct) {
-                       ns.add_struct ((Struct) sym);
+                       ns.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
                        ns.add_enum ((Enum) sym);
                } else if (sym is ErrorDomain) {
@@ -2738,7 +2738,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                if (sym is Class) {
                        cl.add_class ((Class) sym, context);
                } else if (sym is Struct) {
-                       cl.add_struct ((Struct) sym);
+                       cl.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
                        cl.add_enum ((Enum) sym);
                } else if (sym is Delegate) {
@@ -3330,7 +3330,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        if (result is Namespace) {
                                ns.add_namespace ((Namespace) result, context);
                        } else {
-                               ns.add_struct ((Struct) result);
+                               ns.add_struct ((Struct) result, context);
                        }
                        result = ns;
                }
@@ -3411,7 +3411,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                if (sym is Class) {
                        iface.add_class ((Class) sym, context);
                } else if (sym is Struct) {
-                       iface.add_struct ((Struct) sym);
+                       iface.add_struct ((Struct) sym, context);
                } else if (sym is Enum) {
                        iface.add_enum ((Enum) sym);
                } else if (sym is Delegate) {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index cb99cd53e..169341c91 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1553,7 +1553,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Signal) {
                                cl.add_signal ((Signal) sym);
                        } else if (sym is Struct) {
-                               cl.add_struct ((Struct) sym);
+                               cl.add_struct ((Struct) sym, context);
                        }
                } else if (container is Enum) {
                        unowned Enum en = (Enum) container;
@@ -1583,7 +1583,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Signal) {
                                iface.add_signal ((Signal) sym);
                        } else if (sym is Struct) {
-                               iface.add_struct ((Struct) sym);
+                               iface.add_struct ((Struct) sym, context);
                        }
                } else if (container is Namespace) {
                        unowned Namespace ns = (Namespace) container;
@@ -1615,7 +1615,7 @@ public class Vala.GirParser : CodeVisitor {
                                }
                                ns.add_method (method);
                        } else if (sym is Struct) {
-                               ns.add_struct ((Struct) sym);
+                               ns.add_struct ((Struct) sym, context);
                        }
                } else if (container is Struct) {
                        unowned Struct st = (Struct) container;
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index b1068e0b7..b175e7ad0 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -103,7 +103,7 @@ public class Vala.Namespace : Symbol {
                                old_ns.add_class (cl, context);
                        }
                        foreach (Struct st in ns.get_structs ()) {
-                               old_ns.add_struct (st);
+                               old_ns.add_struct (st, context);
                        }
                        foreach (Interface iface in ns.get_interfaces ()) {
                                old_ns.add_interface (iface, context);
@@ -193,7 +193,7 @@ public class Vala.Namespace : Symbol {
         *
         * @param st a struct
         */
-       public override void add_struct (Struct st) {
+       public override void add_struct (Struct st, CodeContext context) {
                // namespaces do not support private members
                if (st.access == SymbolAccessibility.PRIVATE) {
                        st.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 764b3c61f..d0201d13a 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -218,7 +218,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
         *
         * @param st a struct
         */
-       public override void add_struct (Struct st) {
+       public override void add_struct (Struct st, CodeContext context) {
                structs.add (st);
                scope.add (st.name, st);
        }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index f6820f8a8..81767c530 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3501,7 +3501,7 @@ public class Vala.Parser : CodeVisitor {
                        if (result is Namespace) {
                                next.add_namespace ((Namespace) result, context);
                        } else {
-                               next.add_struct ((Struct) result);
+                               next.add_struct ((Struct) result, context);
                        }
                        result = next;
                }
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 32fb2e48b..900400000 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -463,8 +463,8 @@ public abstract class Vala.Symbol : CodeNode {
                context.report.log_error (iface.source_reference, "inner `%s' types are not supported in 
`%s'", "interface", get_full_name ());
        }
 
-       public virtual void add_struct (Struct st) {
-               Report.error (st.source_reference, "inner `%s' types are not supported in `%s'", "struct", 
get_full_name ());
+       public virtual void add_struct (Struct st, CodeContext context) {
+               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) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index f5cb40f45..ee955b618 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -336,7 +336,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Signal) {
                                cl.add_signal ((Signal) sym);
                        } else if (sym is Struct) {
-                               cl.add_struct ((Struct) sym);
+                               cl.add_struct ((Struct) sym, context);
                        }
                } else if (container is Enum) {
                        unowned Enum en = (Enum) container;
@@ -366,7 +366,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Signal) {
                                iface.add_signal ((Signal) sym);
                        } else if (sym is Struct) {
-                               iface.add_struct ((Struct) sym);
+                               iface.add_struct ((Struct) sym, context);
                        }
                } else if (container is Namespace) {
                        unowned Namespace ns = (Namespace) container;
@@ -400,7 +400,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Namespace) {
                                ns.add_namespace ((Namespace) sym, context);
                        } else if (sym is Struct) {
-                               ns.add_struct ((Struct) sym);
+                               ns.add_struct ((Struct) sym, context);
                        }
                } else if (container is Struct) {
                        unowned Struct st = (Struct) container;


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