[vala/1270-remove-static-codecontext-access] Symbol.add_constant(): avoid use static code context
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/1270-remove-static-codecontext-access] Symbol.add_constant(): avoid use static code context
- Date: Fri, 31 Dec 2021 19:53:38 +0000 (UTC)
commit ecbdad1224350f6b5f8fa7ef53a62ffcb5e65bdd
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Dec 29 21:52:00 2021 -0600
Symbol.add_constant(): avoid use static code context
vala/valaenum.vala | 2 +-
vala/valagenieparser.vala | 8 ++++----
vala/valagirparser.vala | 10 +++++-----
vala/valanamespace.vala | 4 ++--
vala/valaobjecttypesymbol.vala | 2 +-
vala/valaparser.vala | 2 +-
vala/valastruct.vala | 2 +-
vala/valasymbol.vala | 4 ++--
vapigen/valagidlparser.vala | 10 +++++-----
9 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index 2d403157d..642751caa 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -97,7 +97,7 @@ public class Vala.Enum : TypeSymbol {
*
* @param c a constant
*/
- public override void add_constant (Constant c) {
+ public override void add_constant (Constant c, CodeContext context) {
constants.add (c);
scope.add (c.name, c);
}
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index f2d446423..00b3e0a25 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2624,7 +2624,7 @@ public class Vala.Genie.Parser : CodeVisitor {
}
ns.add_field (field);
} else if (sym is Constant) {
- ns.add_constant ((Constant) sym);
+ ns.add_constant ((Constant) sym, context);
} else {
context.report.log_error (sym.source_reference, "unexpected declaration in
namespace");
}
@@ -2750,7 +2750,7 @@ public class Vala.Genie.Parser : CodeVisitor {
} else if (sym is Field) {
cl.add_field ((Field) sym);
} else if (sym is Constant) {
- cl.add_constant ((Constant) sym);
+ cl.add_constant ((Constant) sym, context);
} else if (sym is Property) {
cl.add_property ((Property) sym);
} else if (sym is Constructor) {
@@ -3344,7 +3344,7 @@ public class Vala.Genie.Parser : CodeVisitor {
} else if (sym is Field) {
st.add_field ((Field) sym);
} else if (sym is Constant) {
- st.add_constant ((Constant) sym);
+ st.add_constant ((Constant) sym, context);
} else if (sym is Property) {
st.add_property ((Property) sym);
} else {
@@ -3423,7 +3423,7 @@ public class Vala.Genie.Parser : CodeVisitor {
} else if (sym is Field) {
iface.add_field ((Field) sym);
} else if (sym is Constant) {
- iface.add_constant ((Constant) sym);
+ iface.add_constant ((Constant) sym, context);
} else if (sym is Property) {
iface.add_property ((Property) sym);
} else {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 7e8186b81..cb0eea0d1 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1541,7 +1541,7 @@ public class Vala.GirParser : CodeVisitor {
if (sym is Class) {
cl.add_class ((Class) sym, context);
} else if (sym is Constant) {
- cl.add_constant ((Constant) sym);
+ cl.add_constant ((Constant) sym, context);
} else if (sym is Enum) {
cl.add_enum ((Enum) sym, context);
} else if (sym is Field) {
@@ -1561,7 +1561,7 @@ public class Vala.GirParser : CodeVisitor {
if (sym is EnumValue) {
en.add_value ((EnumValue) sym);
} else if (sym is Constant) {
- en.add_constant ((Constant) sym);
+ en.add_constant ((Constant) sym, context);
} else if (sym is Method) {
en.add_method ((Method) sym);
}
@@ -1571,7 +1571,7 @@ public class Vala.GirParser : CodeVisitor {
if (sym is Class) {
iface.add_class ((Class) sym, context);
} else if (sym is Constant) {
- iface.add_constant ((Constant) sym);
+ iface.add_constant ((Constant) sym, context);
} else if (sym is Enum) {
iface.add_enum ((Enum) sym, context);
} else if (sym is Field) {
@@ -1593,7 +1593,7 @@ public class Vala.GirParser : CodeVisitor {
} else if (sym is Class) {
ns.add_class ((Class) sym, context);
} else if (sym is Constant) {
- ns.add_constant ((Constant) sym);
+ ns.add_constant ((Constant) sym, context);
} else if (sym is Delegate) {
ns.add_delegate ((Delegate) sym, context);
} else if (sym is Enum) {
@@ -1621,7 +1621,7 @@ public class Vala.GirParser : CodeVisitor {
unowned Struct st = (Struct) container;
if (sym is Constant) {
- st.add_constant ((Constant) sym);
+ st.add_constant ((Constant) sym, context);
} else if (sym is Field) {
st.add_field ((Field) sym);
} else if (sym is Method) {
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 15b463407..984442bbd 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -118,7 +118,7 @@ public class Vala.Namespace : Symbol {
old_ns.add_error_domain (ed, context);
}
foreach (Constant c in ns.get_constants ()) {
- old_ns.add_constant (c);
+ old_ns.add_constant (c, context);
}
foreach (Field f in ns.get_fields ()) {
old_ns.add_field (f);
@@ -350,7 +350,7 @@ public class Vala.Namespace : Symbol {
*
* @param constant a constant
*/
- public override void add_constant (Constant constant) {
+ public override void add_constant (Constant constant, CodeContext context) {
// namespaces do not support private members
if (constant.access == SymbolAccessibility.PRIVATE) {
constant.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 3df1d7325..1c860093f 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -248,7 +248,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
*
* @param c a constant
*/
- public override void add_constant (Constant c) {
+ public override void add_constant (Constant c, CodeContext context) {
constants.add (c);
scope.add (c.name, c);
}
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index d630c2bf5..f101bd2fe 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3100,7 +3100,7 @@ public class Vala.Parser : CodeVisitor {
}
expect (TokenType.SEMICOLON);
- parent.add_constant (c);
+ parent.add_constant (c, context);
}
void parse_field_declaration (Symbol parent, List<Attribute>? attrs) throws ParseError {
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 5cce4b24b..922b7cf3a 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -192,7 +192,7 @@ public class Vala.Struct : TypeSymbol {
*
* @param c a constant
*/
- public override void add_constant (Constant c) {
+ public override void add_constant (Constant c, CodeContext context) {
constants.add (c);
scope.add (c.name, c);
}
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 03d7ee014..489718249 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -479,8 +479,8 @@ public abstract class Vala.Symbol : CodeNode {
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) {
- Report.error (constant.source_reference, "constants are not allowed in `%s'", get_full_name
());
+ public virtual void add_constant (Constant constant, CodeContext context) {
+ context.report.log_error (constant.source_reference, "constants are not allowed in `%s'",
get_full_name ());
}
public virtual void add_field (Field f) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 50f70184e..62711a258 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -324,7 +324,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (sym is Class) {
cl.add_class ((Class) sym, context);
} else if (sym is Constant) {
- cl.add_constant ((Constant) sym);
+ cl.add_constant ((Constant) sym, context);
} else if (sym is Enum) {
cl.add_enum ((Enum) sym, context);
} else if (sym is Field) {
@@ -344,7 +344,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (sym is EnumValue) {
en.add_value ((EnumValue) sym);
} else if (sym is Constant) {
- en.add_constant ((Constant) sym);
+ en.add_constant ((Constant) sym, context);
} else if (sym is Method) {
en.add_method ((Method) sym);
}
@@ -354,7 +354,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (sym is Class) {
iface.add_class ((Class) sym, context);
} else if (sym is Constant) {
- iface.add_constant ((Constant) sym);
+ iface.add_constant ((Constant) sym, context);
} else if (sym is Enum) {
iface.add_enum ((Enum) sym, context);
} else if (sym is Field) {
@@ -376,7 +376,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (sym is Class) {
ns.add_class ((Class) sym, context);
} else if (sym is Constant) {
- ns.add_constant ((Constant) sym);
+ ns.add_constant ((Constant) sym, context);
} else if (sym is Delegate) {
ns.add_delegate ((Delegate) sym, context);
} else if (sym is Enum) {
@@ -406,7 +406,7 @@ public class Vala.GIdlParser : CodeVisitor {
unowned Struct st = (Struct) container;
if (sym is Constant) {
- st.add_constant ((Constant) sym);
+ st.add_constant ((Constant) sym, context);
} else if (sym is Field) {
st.add_field ((Field) sym);
} else if (sym is Method) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]