[vala/0.46] vala: Perform version check for types of non-external variable declarations



commit 065b8bb8cdc9e243a723a43a92176590c4d4ba8d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Apr 16 12:37:26 2020 +0200

    vala: Perform version check for types of non-external variable declarations

 vala/valafield.vala         | 6 ++++++
 vala/valalocalvariable.vala | 7 +++++++
 vala/valaparameter.vala     | 7 +++++++
 3 files changed, 20 insertions(+)
---
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 93c239938..f0c5972a7 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -105,6 +105,12 @@ public class Vala.Field : Variable, Lockable {
                }
 
                variable_type.check (context);
+               if (!external_package) {
+                       // check symbol availability
+                       if (variable_type.data_type != null) {
+                               variable_type.data_type.version.check (source_reference);
+                       }
+               }
 
                // check whether field type is at least as accessible as the field
                if (!context.analyzer.is_type_accessible (this, variable_type)) {
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index f06742327..79cf22bb4 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -152,6 +152,13 @@ public class Vala.LocalVariable : Variable {
                        variable_type.check (context);
                }
 
+               if (!external_package) {
+                       // check symbol availability
+                       if (variable_type.data_type != null) {
+                               variable_type.data_type.version.check (source_reference);
+                       }
+               }
+
                unowned ArrayType? variable_array_type = variable_type as ArrayType;
                if (variable_array_type != null && variable_array_type.inline_allocated
                    && initializer is ArrayCreationExpression && ((ArrayCreationExpression) 
initializer).initializer_list == null) {
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 1c4ad30d8..fe7aabd6e 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -197,6 +197,13 @@ public class Vala.Parameter : Variable {
                }
 
                if (!ellipsis) {
+                       if (!external_package) {
+                               // check symbol availability
+                               if ((parent_symbol == null || !parent_symbol.external_package) && 
variable_type.data_type != null) {
+                                       variable_type.data_type.version.check (source_reference);
+                               }
+                       }
+
                        // check whether parameter type is at least as accessible as the method
                        if (!context.analyzer.is_type_accessible (this, variable_type)) {
                                error = true;


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