[Analysis API] fix getScopeContextForFile and clarify its semantic

It was used to get importing scope, so it was renamed to getImportingScopeContext.

It was broken after changing the behaviour of `LowLevelFirApiFacadeForResolveOnAir.onAirGetTowerContextProvider` for the whole file

^KT-57966
This commit is contained in:
Ilya Kirillov
2023-05-01 12:25:36 +02:00
committed by Space Team
parent 254092a267
commit 20f921c0bf
4 changed files with 48 additions and 6 deletions
@@ -40,6 +40,8 @@ public abstract class KtScopeProvider : KtAnalysisSessionComponent() {
public abstract fun getSyntheticJavaPropertiesScope(type: KtType): KtTypeScope?
public abstract fun getImportingScopeContext(file: KtFile): KtScopeContext
public abstract fun getScopeContextForPosition(
originalFile: KtFile,
positionInFakeFile: KtElement
@@ -112,8 +114,13 @@ public interface KtScopeProviderMixIn : KtAnalysisSessionMixIn {
public fun KtFile.getScopeContextForPosition(positionInFakeFile: KtElement): KtScopeContext =
withValidityAssertion { analysisSession.scopeProvider.getScopeContextForPosition(this, positionInFakeFile) }
public fun KtFile.getScopeContextForFile(): KtScopeContext =
withValidityAssertion { analysisSession.scopeProvider.getScopeContextForPosition(this, this) }
/**
* Returns a [KtScopeContext] formed by all imports in the [KtFile].
*
* By default, this will also include default importing scopes, which can be filtered by [KtScopeKind]
*/
public fun KtFile.getImportingScopeContext(): KtScopeContext =
withValidityAssertion { analysisSession.scopeProvider.getImportingScopeContext(this) }
/**
* Returns single scope, containing declarations from all scopes that satisfy [filter]. The order of declarations corresponds to the