summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-04-16 12:37:26 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-06-17 12:21:48 +0200
commit0d80b5ae9c3de4ce3ace83dbd859b065f9ec1665 (patch)
tree3f7ca89ecbfa90c3a7dd05ab1001583bd50bf656 /vala
parent26cecfc8b15a7ecba42ffd955546dbdd5d352d02 (diff)
downloadvala-0d80b5ae9c3de4ce3ace83dbd859b065f9ec1665.tar.gz
vala: Use available CodeContext instance for VersionAttribute.check()
Diffstat (limited to 'vala')
-rw-r--r--vala/valaclass.vala4
-rw-r--r--vala/valafield.vala2
-rw-r--r--vala/valalocalvariable.vala2
-rw-r--r--vala/valamemberaccess.vala2
-rw-r--r--vala/valaobjectcreationexpression.vala2
-rw-r--r--vala/valaparameter.vala2
-rw-r--r--vala/valaversionattribute.vala8
7 files changed, 11 insertions, 11 deletions
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index c3cc48f55..e0247ac9b 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -774,7 +774,7 @@ public class Vala.Class : ObjectTypeSymbol {
&& (impl.base_interface_type == null || impl.base_interface_type.type_symbol == iface)
&& impl.compatible_no_error (m))) {
// method is used as interface implementation, so it is not unused
- impl.version.check (source_reference);
+ impl.version.check (context, source_reference);
impl.used = true;
implemented = true;
if (impl.base_interface_method == null) {
@@ -810,7 +810,7 @@ public class Vala.Class : ObjectTypeSymbol {
Report.error (source_reference, "Type and/or accessors of inherited properties `%s' and `%s' do not match: %s.".printf (prop.get_full_name (), base_prop.get_full_name (), invalid_match));
}
// property is used as interface implementation, so it is not unused
- sym.version.check (source_reference);
+ sym.version.check (context, source_reference);
sym.used = true;
} else {
error = true;
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 3b6eeda75..ed59f582a 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -110,7 +110,7 @@ public class Vala.Field : Variable, Lockable {
// check symbol availability
if (variable_type.type_symbol != null) {
- variable_type.type_symbol.version.check (source_reference);
+ variable_type.type_symbol.version.check (context, source_reference);
}
}
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index dbe9ace11..a1c3657f8 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -163,7 +163,7 @@ public class Vala.LocalVariable : Variable {
if (!external_package) {
// check symbol availability
if (variable_type.type_symbol != null) {
- variable_type.type_symbol.version.check (source_reference);
+ variable_type.type_symbol.version.check (context, source_reference);
}
}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 1154d3c8b..5e810d699 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -787,7 +787,7 @@ public class Vala.MemberAccess : Expression {
if (parent != member) {
member.used = true;
}
- member.version.check (source_reference);
+ member.version.check (context, source_reference);
if (access == SymbolAccessibility.PROTECTED && member.parent_symbol is TypeSymbol) {
unowned TypeSymbol target_type = (TypeSymbol) member.parent_symbol;
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index bc326f9c5..b01431c4e 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -288,7 +288,7 @@ public class Vala.ObjectCreationExpression : Expression {
// track usage for flow analyzer
symbol_reference.used = true;
- symbol_reference.version.check (source_reference);
+ symbol_reference.version.check (context, source_reference);
}
if (symbol_reference != null
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 0267a7675..986d451ab 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -202,7 +202,7 @@ public class Vala.Parameter : Variable {
// check symbol availability
if ((parent_symbol == null || !parent_symbol.external_package) && variable_type.type_symbol != null) {
- variable_type.type_symbol.version.check (source_reference);
+ variable_type.type_symbol.version.check (context, source_reference);
}
}
diff --git a/vala/valaversionattribute.vala b/vala/valaversionattribute.vala
index bff4d41d5..ce46406cd 100644
--- a/vala/valaversionattribute.vala
+++ b/vala/valaversionattribute.vala
@@ -145,14 +145,14 @@ public class Vala.VersionAttribute {
* Check to see if the symbol is experimental, deprecated or not available
* and emit a warning if it is.
*/
- public bool check (SourceReference? source_ref = null) {
+ public bool check (CodeContext context, SourceReference? source_ref = null) {
bool result = false;
// deprecation:
if (symbol.external_package && deprecated) {
string? package_version = symbol.source_reference.file.installed_version;
- if (!CodeContext.get ().deprecated && (package_version == null || deprecated_since == null || VersionAttribute.cmp_versions (package_version, deprecated_since) >= 0)) {
+ if (!context.deprecated && (package_version == null || deprecated_since == null || VersionAttribute.cmp_versions (package_version, deprecated_since) >= 0)) {
Report.deprecated (source_ref, "`%s' %s%s".printf (symbol.get_full_name (), (deprecated_since == null) ? "is deprecated" : "has been deprecated since %s".printf (deprecated_since), (replacement == null) ? "" : ". Use %s".printf (replacement)));
}
result = true;
@@ -162,7 +162,7 @@ public class Vala.VersionAttribute {
if (symbol.external_package && since != null) {
string? package_version = symbol.source_reference.file.installed_version;
- if (CodeContext.get ().since_check && package_version != null && VersionAttribute.cmp_versions (package_version, since) < 0) {
+ if (context.since_check && package_version != null && VersionAttribute.cmp_versions (package_version, since) < 0) {
unowned string filename = symbol.source_reference.file.filename;
string pkg = Path.get_basename (filename[0:filename.last_index_of_char ('.')]);
Report.error (source_ref, "`%s' is not available in %s %s. Use %s >= %s".printf (symbol.get_full_name (), pkg, package_version, pkg, since));
@@ -172,7 +172,7 @@ public class Vala.VersionAttribute {
// experimental:
if (symbol.external_package && experimental) {
- if (!CodeContext.get ().experimental) {
+ if (!context.experimental) {
string? package_version = symbol.source_reference.file.installed_version;
string? experimental_until = this.experimental_until;