lookupSymbol

fun lookupSymbol(symbol: Symbol, thisScopeOnly: Boolean = false, replaceImports: Boolean = true, predicate: (Declaration) -> Boolean? = null): List<Declaration>

Looks up a list of Declaration nodes for the specified symbol. Optionally, predicate can be used for additional filtering.

By default, the lookup algorithm will go to the Scope.parent if no match was found in the current scope. This behaviour can be turned off with thisScopeOnly. This is useful for qualified lookups, where we want to stay in our lookup-scope.

Parameters

symbol

the symbol to lookup

thisScopeOnly

whether we should stay in the current scope for lookup or traverse to its parents if no match was found.

replaceImports

whether any symbols pointing to ImportDeclaration.importedSymbols or wildcards should be replaced with their actual nodes

predicate

An optional predicate which should be used in the lookup.