[vala/1270-remove-static-codecontext-access] Symbol.add_field/property(): avoid use static context
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/1270-remove-static-codecontext-access] Symbol.add_field/property(): avoid use static context
- Date: Fri, 31 Dec 2021 19:53:38 +0000 (UTC)
commit 11bf021aa0d39763795920fe566decb2b35430e1
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Dec 29 22:25:53 2021 -0600
Symbol.add_field/property(): avoid use static context
vala/valaclass.vala | 10 +++++-----
vala/valagenieparser.vala | 14 +++++++-------
vala/valagirparser.vala | 14 +++++++-------
vala/valainterface.vala | 6 +++---
vala/valanamespace.vala | 4 ++--
vala/valaobjecttypesymbol.vala | 4 ++--
vala/valaparser.vala | 4 ++--
vala/valastruct.vala | 6 +++---
vala/valasymbol.vala | 8 ++++----
vapigen/valagidlparser.vala | 32 ++++++++++++++++----------------
10 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 436a6b3cf..717e37242 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -258,8 +258,8 @@ public class Vala.Class : ObjectTypeSymbol {
*
* @param f a field
*/
- public override void add_field (Field f) {
- base.add_field (f);
+ public override void add_field (Field f, CodeContext context) {
+ base.add_field (f, context);
if (f.access == SymbolAccessibility.PRIVATE && f.binding == MemberBinding.INSTANCE) {
has_private_fields = true;
@@ -325,8 +325,8 @@ public class Vala.Class : ObjectTypeSymbol {
*
* @param prop a property
*/
- public override void add_property (Property prop) {
- base.add_property (prop);
+ public override void add_property (Property prop, CodeContext context) {
+ base.add_property (prop, context);
if (prop.binding != MemberBinding.STATIC) {
prop.this_parameter = new Parameter ("this", SemanticAnalyzer.get_this_type (prop,
this), prop.source_reference);
@@ -334,7 +334,7 @@ public class Vala.Class : ObjectTypeSymbol {
}
if (prop.field != null) {
- add_field (prop.field);
+ add_field (prop.field, context);
}
}
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 00b3e0a25..935f08f99 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -2622,7 +2622,7 @@ public class Vala.Genie.Parser : CodeVisitor {
if (field.binding == MemberBinding.INSTANCE) {
field.binding = MemberBinding.STATIC;
}
- ns.add_field (field);
+ ns.add_field (field, context);
} else if (sym is Constant) {
ns.add_constant ((Constant) sym, context);
} else {
@@ -2748,11 +2748,11 @@ public class Vala.Genie.Parser : CodeVisitor {
} else if (sym is Vala.Signal) {
cl.add_signal ((Vala.Signal) sym);
} else if (sym is Field) {
- cl.add_field ((Field) sym);
+ cl.add_field ((Field) sym, context);
} else if (sym is Constant) {
cl.add_constant ((Constant) sym, context);
} else if (sym is Property) {
- cl.add_property ((Property) sym);
+ cl.add_property ((Property) sym, context);
} else if (sym is Constructor) {
cl.add_constructor ((Constructor) sym);
} else if (sym is Destructor) {
@@ -3342,11 +3342,11 @@ public class Vala.Genie.Parser : CodeVisitor {
if (sym is Method) {
st.add_method ((Method) sym);
} else if (sym is Field) {
- st.add_field ((Field) sym);
+ st.add_field ((Field) sym, context);
} else if (sym is Constant) {
st.add_constant ((Constant) sym, context);
} else if (sym is Property) {
- st.add_property ((Property) sym);
+ st.add_property ((Property) sym, context);
} else {
context.report.log_error (sym.source_reference, "unexpected declaration in struct");
}
@@ -3421,11 +3421,11 @@ public class Vala.Genie.Parser : CodeVisitor {
} else if (sym is Vala.Signal) {
iface.add_signal ((Vala.Signal) sym);
} else if (sym is Field) {
- iface.add_field ((Field) sym);
+ iface.add_field ((Field) sym, context);
} else if (sym is Constant) {
iface.add_constant ((Constant) sym, context);
} else if (sym is Property) {
- iface.add_property ((Property) sym);
+ iface.add_property ((Property) sym, context);
} else {
context.report.log_error (sym.source_reference, "unexpected declaration in
interface");
}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index cb0eea0d1..2400c681f 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1545,11 +1545,11 @@ public class Vala.GirParser : CodeVisitor {
} else if (sym is Enum) {
cl.add_enum ((Enum) sym, context);
} else if (sym is Field) {
- cl.add_field ((Field) sym);
+ cl.add_field ((Field) sym, context);
} else if (sym is Method) {
cl.add_method ((Method) sym);
} else if (sym is Property) {
- cl.add_property ((Property) sym);
+ cl.add_property ((Property) sym, context);
} else if (sym is Signal) {
cl.add_signal ((Signal) sym);
} else if (sym is Struct) {
@@ -1575,11 +1575,11 @@ public class Vala.GirParser : CodeVisitor {
} else if (sym is Enum) {
iface.add_enum ((Enum) sym, context);
} else if (sym is Field) {
- iface.add_field ((Field) sym);
+ iface.add_field ((Field) sym, context);
} else if (sym is Method) {
iface.add_method ((Method) sym);
} else if (sym is Property) {
- iface.add_property ((Property) sym);
+ iface.add_property ((Property) sym, context);
} else if (sym is Signal) {
iface.add_signal ((Signal) sym);
} else if (sym is Struct) {
@@ -1605,7 +1605,7 @@ public class Vala.GirParser : CodeVisitor {
if (field.binding == MemberBinding.INSTANCE) {
field.binding = MemberBinding.STATIC;
}
- ns.add_field (field);
+ ns.add_field (field, context);
} else if (sym is Interface) {
ns.add_interface ((Interface) sym, context);
} else if (sym is Method) {
@@ -1623,11 +1623,11 @@ public class Vala.GirParser : CodeVisitor {
if (sym is Constant) {
st.add_constant ((Constant) sym, context);
} else if (sym is Field) {
- st.add_field ((Field) sym);
+ st.add_field ((Field) sym, context);
} else if (sym is Method) {
st.add_method ((Method) sym);
} else if (sym is Property) {
- st.add_property ((Property) sym);
+ st.add_property ((Property) sym, context);
}
} else if (container is ErrorDomain) {
unowned ErrorDomain ed = (ErrorDomain) container;
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 92e5da154..e79c6e6f0 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -90,15 +90,15 @@ public class Vala.Interface : ObjectTypeSymbol {
*
* @param prop a property
*/
- public override void add_property (Property prop) {
+ public override void add_property (Property prop, CodeContext context) {
if (prop.field != null) {
- Report.error (prop.source_reference, "interface properties should be `abstract' or
have `get' accessor and/or `set' mutator");
+ context.report.log_error (prop.source_reference, "interface properties should be
`abstract' or have `get' accessor and/or `set' mutator");
prop.error = true;
return;
}
- base.add_property (prop);
+ base.add_property (prop, context);
if (prop.binding != MemberBinding.STATIC) {
prop.this_parameter = new Parameter ("this", SemanticAnalyzer.get_this_type (prop,
this), prop.source_reference);
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 984442bbd..1c0265ae7 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -121,7 +121,7 @@ public class Vala.Namespace : Symbol {
old_ns.add_constant (c, context);
}
foreach (Field f in ns.get_fields ()) {
- old_ns.add_field (f);
+ old_ns.add_field (f, context);
}
foreach (Method m in ns.get_methods ()) {
old_ns.add_method (m);
@@ -369,7 +369,7 @@ public class Vala.Namespace : Symbol {
*
* @param f a field
*/
- public override void add_field (Field f) {
+ public override void add_field (Field f, CodeContext context) {
// namespaces do not support private members
if (f.access == SymbolAccessibility.PRIVATE) {
f.access = SymbolAccessibility.INTERNAL;
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 1c860093f..a84c1f3f6 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -102,7 +102,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
*
* @param f a field
*/
- public override void add_field (Field f) {
+ public override void add_field (Field f, CodeContext context) {
fields.add (f);
members.add (f);
scope.add (f.name, f);
@@ -131,7 +131,7 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
*
* @param prop a property
*/
- public override void add_property (Property prop) {
+ public override void add_property (Property prop, CodeContext context) {
properties.add (prop);
members.add (prop);
scope.add (prop.name, prop);
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index f101bd2fe..73e6bdbfa 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3147,7 +3147,7 @@ public class Vala.Parser : CodeVisitor {
}
expect (TokenType.SEMICOLON);
- parent.add_field (f);
+ parent.add_field (f, context);
}
InitializerList parse_initializer () throws ParseError {
@@ -3382,7 +3382,7 @@ public class Vala.Parser : CodeVisitor {
}
expect (TokenType.CLOSE_BRACE);
- parent.add_property (prop);
+ parent.add_property (prop, context);
}
void parse_signal_declaration (Symbol parent, List<Attribute>? attrs) throws ParseError {
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 922b7cf3a..32cdb7611 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -202,7 +202,7 @@ public class Vala.Struct : TypeSymbol {
*
* @param f a field
*/
- public override void add_field (Field f) {
+ public override void add_field (Field f, CodeContext context) {
f.access = SymbolAccessibility.PUBLIC;
fields.add (f);
@@ -274,7 +274,7 @@ public class Vala.Struct : TypeSymbol {
*
* @param prop a property
*/
- public override void add_property (Property prop) {
+ public override void add_property (Property prop, CodeContext context) {
properties.add (prop);
scope.add (prop.name, prop);
@@ -284,7 +284,7 @@ public class Vala.Struct : TypeSymbol {
}
if (prop.field != null) {
- add_field (prop.field);
+ add_field (prop.field, context);
property_fields.add (prop.field);
}
}
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 489718249..f7fd0ac37 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -483,16 +483,16 @@ public abstract class Vala.Symbol : CodeNode {
context.report.log_error (constant.source_reference, "constants are not allowed in `%s'",
get_full_name ());
}
- public virtual void add_field (Field f) {
- Report.error (f.source_reference, "fields are not allowed in `%s'", get_full_name ());
+ public virtual void add_field (Field f, CodeContext context) {
+ context.report.log_error (f.source_reference, "fields are not allowed in `%s'", get_full_name
());
}
public virtual void add_method (Method m) {
Report.error (m.source_reference, "methods are not allowed in `%s'", get_full_name ());
}
- public virtual void add_property (Property prop) {
- Report.error (prop.source_reference, "properties are not allowed in `%s'", get_full_name ());
+ public virtual void add_property (Property prop, CodeContext context) {
+ context.report.log_error (prop.source_reference, "properties are not allowed in `%s'",
get_full_name ());
}
public virtual void add_signal (Signal sig) {
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 62711a258..edcc3dfde 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -328,11 +328,11 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (sym is Enum) {
cl.add_enum ((Enum) sym, context);
} else if (sym is Field) {
- cl.add_field ((Field) sym);
+ cl.add_field ((Field) sym, context);
} else if (sym is Method) {
cl.add_method ((Method) sym);
} else if (sym is Property) {
- cl.add_property ((Property) sym);
+ cl.add_property ((Property) sym, context);
} else if (sym is Signal) {
cl.add_signal ((Signal) sym);
} else if (sym is Struct) {
@@ -358,11 +358,11 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (sym is Enum) {
iface.add_enum ((Enum) sym, context);
} else if (sym is Field) {
- iface.add_field ((Field) sym);
+ iface.add_field ((Field) sym, context);
} else if (sym is Method) {
iface.add_method ((Method) sym);
} else if (sym is Property) {
- iface.add_property ((Property) sym);
+ iface.add_property ((Property) sym, context);
} else if (sym is Signal) {
iface.add_signal ((Signal) sym);
} else if (sym is Struct) {
@@ -388,7 +388,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (field.binding == MemberBinding.INSTANCE) {
field.binding = MemberBinding.STATIC;
}
- ns.add_field (field);
+ ns.add_field (field, context);
} else if (sym is Interface) {
ns.add_interface ((Interface) sym, context);
} else if (sym is Method) {
@@ -408,11 +408,11 @@ public class Vala.GIdlParser : CodeVisitor {
if (sym is Constant) {
st.add_constant ((Constant) sym, context);
} else if (sym is Field) {
- st.add_field ((Field) sym);
+ st.add_field ((Field) sym, context);
} else if (sym is Method) {
st.add_method ((Method) sym);
} else if (sym is Property) {
- st.add_property ((Property) sym);
+ st.add_property ((Property) sym, context);
}
}
@@ -863,7 +863,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- st.add_field (f);
+ st.add_field (f, context);
}
}
}
@@ -979,7 +979,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- cl.add_field (f);
+ cl.add_field (f, context);
}
}
}
@@ -1058,7 +1058,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- st.add_field (f);
+ st.add_field (f, context);
}
}
}
@@ -1118,7 +1118,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- cl.add_field (f);
+ cl.add_field (f, context);
}
}
}
@@ -1211,7 +1211,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- st.add_field (f);
+ st.add_field (f, context);
}
}
}
@@ -1309,7 +1309,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.FIELD) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- cl.add_field (f);
+ cl.add_field (f, context);
}
}
}
@@ -1626,7 +1626,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.PROPERTY) {
var prop = parse_property ((IdlNodeProperty) member);
if (prop != null) {
- cl.add_property (prop);
+ cl.add_property (prop, context);
}
} else if (member.type == IdlNodeTypeId.SIGNAL) {
var sig = parse_signal ((IdlNodeSignal) member);
@@ -1641,7 +1641,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!current_type_symbol_set.contains (member.name)) {
var f = parse_field ((IdlNodeField) member);
if (f != null) {
- cl.add_field (f);
+ cl.add_field (f, context);
}
}
}
@@ -1748,7 +1748,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (member.type == IdlNodeTypeId.PROPERTY) {
var prop = parse_property ((IdlNodeProperty) member);
if (prop != null) {
- iface.add_property (prop);
+ iface.add_property (prop, context);
}
} else if (member.type == IdlNodeTypeId.SIGNAL) {
var sig = parse_signal ((IdlNodeSignal) member);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]