[AA] Add getCombinedMemberScope to KtScopeProvider

- The function is mostly for convenience, but scope providers will be
  able to optimize this scope if needed (similar to how combined
  declared member scopes are already optimized).
- `getCombinedMemberScope` will be used by `KDocReferenceResolver`.

^KT-61900
This commit is contained in:
Marco Pennekamp
2023-09-14 14:28:47 +02:00
committed by Space Team
parent 1408556511
commit 7a7a923197
@@ -23,6 +23,13 @@ public abstract class KtScopeProvider : KtAnalysisSessionComponent() {
public abstract fun getStaticMemberScope(symbol: KtSymbolWithMembers): KtScope
public open fun getCombinedMemberScope(symbol: KtSymbolWithMembers): KtScope = getCompositeScope(
listOf(
getMemberScope(symbol),
getStaticMemberScope(symbol),
)
)
public abstract fun getDeclaredMemberScope(classSymbol: KtSymbolWithMembers): KtScope
public abstract fun getStaticDeclaredMemberScope(classSymbol: KtSymbolWithMembers): KtScope
@@ -143,6 +150,12 @@ public interface KtScopeProviderMixIn : KtAnalysisSessionMixIn {
public fun KtSymbolWithMembers.getStaticMemberScope(): KtScope =
withValidityAssertion { analysisSession.scopeProvider.getStaticMemberScope(this) }
/**
* Returns a [KtScope] containing all members from [getMemberScope] and [getStaticMemberScope].
*/
public fun KtSymbolWithMembers.getCombinedMemberScope(): KtScope =
withValidityAssertion { analysisSession.scopeProvider.getCombinedMemberScope(this) }
/**
* Returns a [KtScope] containing the *non-static* callables and all classifiers explicitly declared in the given [KtSymbolWithMembers].
*