[vala/wip/ricotz/lsp-rev: 3/3] WIP vala: Unresolved namespaces?



commit 2a50b3ff58628b6b8567900a4db0c65bd6beea53
Author: Princeton Ferro <princetonferro gmail com>
Date:   Tue Feb 18 12:20:00 2020 +0100

    WIP vala: Unresolved namespaces?

 vala/valagirparser.vala    | 6 ++++++
 vala/valamemberaccess.vala | 3 +++
 2 files changed, 9 insertions(+)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 30468323a..87d1d0e0d 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1384,6 +1384,12 @@ public class Vala.GirParser : CodeVisitor {
                                continue;
                        }
 
+                       if (ns == null) {
+                               // We should not have a null namespace unless we're in LSP mode.
+                               assert (context.keep_going);
+                               continue;
+                       }
+
                        provided_namespaces.add ("%s-%s".printf (gir_namespace, gir_version));
 
                        var gir_symbol = new UnresolvedSymbol (null, gir_namespace);
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 946bd2b0a..3866f6051 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -307,6 +307,9 @@ public class Vala.MemberAccess : Expression {
 
                        if (symbol_reference == null && source_reference != null) {
                                foreach (UsingDirective ns in source_reference.using_directives) {
+                                       if (!(ns.namespace_symbol is Vala.Namespace)) {
+                                               continue;
+                                       }
                                        var local_sym = ns.namespace_symbol.scope.lookup (member_name);
                                        if (local_sym != null) {
                                                if (symbol_reference != null && symbol_reference != 
local_sym) {


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