mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 09:59:25 +00:00
allow null scope in findIdentifier
This commit is contained in:
@@ -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
|
// is it a local or parameter - note that locals must be ordered innermost-scope-first
|
||||||
const local = mdecls.locals.find(local => local.name === ident);
|
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) {
|
if (local || param) {
|
||||||
matches.variables = [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)
|
// 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 scoped_type = scope instanceof SourceType ? scope : scope.owner;
|
||||||
const outer_types = [];
|
const outer_types = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user