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



commit 02f935bf7bd108843bb63c5f5cfdc78432ce962f
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 22:52:57 2021 -0600

    Symbol.add_signal(): avoid use static code context

 vala/valagenieparser.vala      | 4 ++--
 vala/valagirparser.vala        | 4 ++--
 vala/valaobjecttypesymbol.vala | 2 +-
 vala/valaparser.vala           | 2 +-
 vala/valasymbol.vala           | 4 ++--
 vapigen/valagidlparser.vala    | 8 ++++----
 6 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 26abc4cbf..797aae55e 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2746,7 +2746,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Method) {
                        cl.add_method ((Method) sym, context);
                } else if (sym is Vala.Signal) {
-                       cl.add_signal ((Vala.Signal) sym);
+                       cl.add_signal ((Vala.Signal) sym, context);
                } else if (sym is Field) {
                        cl.add_field ((Field) sym, context);
                } else if (sym is Constant) {
@@ -3419,7 +3419,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Method) {
                        iface.add_method ((Method) sym, context);
                } else if (sym is Vala.Signal) {
-                       iface.add_signal ((Vala.Signal) sym);
+                       iface.add_signal ((Vala.Signal) sym, context);
                } else if (sym is Field) {
                        iface.add_field ((Field) sym, context);
                } else if (sym is Constant) {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 206d81cc9..462c10035 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1551,7 +1551,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Property) {
                                cl.add_property ((Property) sym, context);
                        } else if (sym is Signal) {
-                               cl.add_signal ((Signal) sym);
+                               cl.add_signal ((Signal) sym, context);
                        } else if (sym is Struct) {
                                cl.add_struct ((Struct) sym, context);
                        }
@@ -1581,7 +1581,7 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (sym is Property) {
                                iface.add_property ((Property) sym, context);
                        } else if (sym is Signal) {
-                               iface.add_signal ((Signal) sym);
+                               iface.add_signal ((Signal) sym, context);
                        } else if (sym is Struct) {
                                iface.add_struct ((Struct) sym, context);
                        }
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 37e055774..55450c56e 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -142,7 +142,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
         *
         * @param sig a signal
         */
-       public override void add_signal (Signal sig) {
+       public override void add_signal (Signal sig, CodeContext context) {
                signals.add (sig);
                members.add (sig);
                scope.add (sig.name, sig);
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 62fbbba6c..d3d65d786 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3418,7 +3418,7 @@ public class Vala.Parser : CodeVisitor {
                        sig.body = parse_block ();
                }
 
-               parent.add_signal (sig);
+               parent.add_signal (sig, context);
        }
 
        void parse_constructor_declaration (Symbol parent, List<Attribute>? attrs) throws ParseError {
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index c22593152..775e8c6cb 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -495,8 +495,8 @@ public abstract class Vala.Symbol : CodeNode {
                context.report.log_error (prop.source_reference, "properties are not allowed in `%s'", 
get_full_name ());
        }
 
-       public virtual void add_signal (Signal sig) {
-               Report.error (sig.source_reference, "signals are not allowed in `%s'", get_full_name ());
+       public virtual void add_signal (Signal sig, CodeContext context) {
+               context.report.log_error (sig.source_reference, "signals are not allowed in `%s'", 
get_full_name ());
        }
 
        public virtual void add_constructor (Constructor c) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index e6e51c6e6..e31297b60 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -334,7 +334,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Property) {
                                cl.add_property ((Property) sym, context);
                        } else if (sym is Signal) {
-                               cl.add_signal ((Signal) sym);
+                               cl.add_signal ((Signal) sym, context);
                        } else if (sym is Struct) {
                                cl.add_struct ((Struct) sym, context);
                        }
@@ -364,7 +364,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (sym is Property) {
                                iface.add_property ((Property) sym, context);
                        } else if (sym is Signal) {
-                               iface.add_signal ((Signal) sym);
+                               iface.add_signal ((Signal) sym, context);
                        } else if (sym is Struct) {
                                iface.add_struct ((Struct) sym, context);
                        }
@@ -1631,7 +1631,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (member.type == IdlNodeTypeId.SIGNAL) {
                                var sig = parse_signal ((IdlNodeSignal) member);
                                if (sig != null) {
-                                       cl.add_signal (sig);
+                                       cl.add_signal (sig, context);
                                }
                        }
                }
@@ -1753,7 +1753,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        } else if (member.type == IdlNodeTypeId.SIGNAL) {
                                var sig = parse_signal ((IdlNodeSignal) member);
                                if (sig != null) {
-                                       iface.add_signal (sig);
+                                       iface.add_signal (sig, context);
                                        sig.is_virtual = false;
                                }
                        }


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