From bccc29251c21ae1fce3b5d7b01175c3afb92a808 Mon Sep 17 00:00:00 2001 From: Dave Holoway Date: Tue, 16 Jun 2020 18:55:14 +0100 Subject: [PATCH] allow null scope in findIdentifier --- langserver/java/body-parser3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langserver/java/body-parser3.js b/langserver/java/body-parser3.js index 1932031..22004ec 100644 --- a/langserver/java/body-parser3.js +++ b/langserver/java/body-parser3.js @@ -2023,10 +2023,10 @@ function findIdentifier(ident, mdecls, scope, imports, typemap) { // is it a local or parameter - note that locals must be ordered innermost-scope-first const local = mdecls.locals.find(local => local.name === ident); - let param = !(scope instanceof SourceType) && scope.parameters.find(p => p.name === ident); + let param = scope && !(scope instanceof SourceType) && scope.parameters.find(p => p.name === ident); if (local || param) { matches.variables = [local || param]; - } else { + } else if (scope) { // is it a field, method or enum value in the current type (or any of the outer types or superclasses) const scoped_type = scope instanceof SourceType ? scope : scope.owner; const outer_types = [];