[gnome-builder/gnome-builder-3-34] vala-pack: Support for vala 0.48 API



commit 0322d6db4d5ece1554206ef7ea14cce473cb5190
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 30 15:32:16 2019 +0200

    vala-pack: Support for vala 0.48 API

 src/plugins/vala-pack/lang-server/ide-utils.vala   |  4 ++++
 .../vala-pack/lang-server/ide-vala-completion.vala | 24 ++++++++++++++--------
 2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/vala-pack/lang-server/ide-utils.vala 
b/src/plugins/vala-pack/lang-server/ide-utils.vala
index b6baf1afc..091f16171 100644
--- a/src/plugins/vala-pack/lang-server/ide-utils.vala
+++ b/src/plugins/vala-pack/lang-server/ide-utils.vala
@@ -29,7 +29,11 @@ namespace Ide {
                if (node is Vala.MethodCall) {
                        source_reference = ((Vala.MethodCall) node).call.symbol_reference.source_reference;
                } else if (node is Vala.DataType) {
+#if VALA_0_48
+                       source_reference = ((Vala.DataType) node).type_symbol.source_reference;
+#else
                        source_reference = ((Vala.DataType) node).data_type.source_reference;
+#endif
                } else if (node is Vala.MemberAccess) {
                        weak Vala.Symbol symbol_ref = ((Vala.MemberAccess) node).symbol_reference;
                        if (symbol_ref != null) {
diff --git a/src/plugins/vala-pack/lang-server/ide-vala-completion.vala 
b/src/plugins/vala-pack/lang-server/ide-vala-completion.vala
index d8312b139..0ce2529cd 100644
--- a/src/plugins/vala-pack/lang-server/ide-vala-completion.vala
+++ b/src/plugins/vala-pack/lang-server/ide-vala-completion.vala
@@ -110,6 +110,14 @@ namespace Ide
                        return matching_symbols;
                }
 
+               inline Vala.ArrayList<Vala.Symbol> symbol_lookup_inherited_for_type (Vala.DataType data_type) 
{
+#if VALA_0_48
+                       return symbol_lookup_inherited (data_type.type_symbol);
+#else
+                       return symbol_lookup_inherited (data_type.data_type);
+#endif
+               }
+
                Vala.ArrayList<Vala.Symbol> symbol_lookup_inherited (Vala.Symbol? sym,
                                                                bool invocation = false)
                {
@@ -127,32 +135,32 @@ namespace Ide
 
                        if (invocation && sym is Vala.Method) {
                                var func = (Vala.Method) sym;
-                               result.add_all (symbol_lookup_inherited (func.return_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (func.return_type));
                        } else if (sym is Vala.Class) {
                                var cl = (Vala.Class) sym;
                                foreach (var base_type in cl.get_base_types ()) {
-                                       result.add_all (symbol_lookup_inherited (base_type.data_type));
+                                       result.add_all (symbol_lookup_inherited_for_type (base_type));
                                }
                        } else if (sym is Vala.Struct) {
                                var st = (Vala.Struct) sym;
-                               result.add_all (symbol_lookup_inherited (st.base_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (st.base_type));
                        } else if (sym is Vala.Interface) {
                                var iface = (Vala.Interface) sym;
                                foreach (var prerequisite in iface.get_prerequisites ()) {
-                                       result.add_all (symbol_lookup_inherited (prerequisite.data_type));
+                                       result.add_all (symbol_lookup_inherited_for_type (prerequisite));
                                }
                        } else if (sym is Vala.LocalVariable) {
                                var variable = (Vala.LocalVariable) sym;
-                               result.add_all (symbol_lookup_inherited (variable.variable_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (variable.variable_type));
                        } else if (sym is Vala.Field) {
                                var field = (Vala.Field) sym;
-                               result.add_all (symbol_lookup_inherited (field.variable_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (field.variable_type));
                        } else if (sym is Vala.Property) {
                                var prop = (Vala.Property) sym;
-                               result.add_all (symbol_lookup_inherited (prop.property_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (prop.property_type));
                        } else if (sym is Vala.Parameter) {
                                var fp = (Vala.Parameter) sym;
-                               result.add_all (symbol_lookup_inherited (fp.variable_type.data_type));
+                               result.add_all (symbol_lookup_inherited_for_type (fp.variable_type));
                        }
 
                        return result;


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