[Analysis API] add KtScope.getCallableSymbols/getClassifier symbols overloads which accept a candidate name set
This is needed for the cases when a candidate name set is known to avoid retrieving a set with all possible names when processing the scope. ^KT-58653 fixed
This commit is contained in:
committed by
Space Team
parent
aacdfb67c6
commit
29be88e3c9
@@ -5,9 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.scopes
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeOwner
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
|
||||
@@ -24,16 +23,55 @@ public interface KtScope : KtScopeLike {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtCallableSymbol] which current scope contain if declaration name matches [nameFilter]
|
||||
* Return a sequence of [KtCallableSymbol] which current scope contain if declaration name matches [nameFilter].
|
||||
*
|
||||
* This function needs to retrieve a set of all possible names before processing the scope.
|
||||
* The overload with `names: Collection<Name>` should be used when the candidate name set is known.
|
||||
*/
|
||||
public fun getCallableSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence<KtCallableSymbol>
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtCallableSymbol] which current scope contain, if declaration name present in [names]
|
||||
*
|
||||
* This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
|
||||
*/
|
||||
public fun getCallableSymbols(names: Collection<Name>): Sequence<KtCallableSymbol>
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtCallableSymbol] which current scope contain, if declaration name present in [names]
|
||||
*
|
||||
* @see getCallableSymbols
|
||||
*/
|
||||
public fun getCallableSymbols(vararg names: Name): Sequence<KtCallableSymbol> =
|
||||
getCallableSymbols(names.toList())
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtClassifierSymbol] which current scope contain if classifier name matches [nameFilter]. The sequence includes:
|
||||
* nested classes, inner classes, nested type aliases for the class scope, and top-level classes and top-level type aliases for file scope.
|
||||
*
|
||||
* This function needs to retrieve a set of all possible names before processing the scope.
|
||||
* The overload with `names: Collection<Name>` should be used when the candidate name set is known.
|
||||
*/
|
||||
public fun getClassifierSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence<KtClassifierSymbol>
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
|
||||
*
|
||||
* The sequence includes: nested classes, inner classes, nested type aliases for the class scope,
|
||||
* and top-level classes and top-level type aliases for file scope.
|
||||
*
|
||||
* This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
|
||||
*/
|
||||
public fun getClassifierSymbols(names: Collection<Name>): Sequence<KtClassifierSymbol>
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
|
||||
*
|
||||
* @see getClassifierSymbols
|
||||
*/
|
||||
public fun getClassifierSymbols(vararg names: Name): Sequence<KtClassifierSymbol> =
|
||||
getClassifierSymbols(names.toList())
|
||||
|
||||
/**
|
||||
* Return a sequence of [KtConstructorSymbol] which current scope contain
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user