From 349e55cb005c259bd62303c25c0f46f63330e374 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Mon, 1 May 2023 11:38:18 +0200 Subject: [PATCH] [Analysis API FIR] refactor, extract createScopesWithKind to a separate function it will be reused in the following commits ^KT-57966 --- .../analysis/api/fir/components/KtFirScopeProvider.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirScopeProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirScopeProvider.kt index 9e04cf2a32e..548bc2b543a 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirScopeProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirScopeProvider.kt @@ -196,11 +196,15 @@ internal class KtFirScopeProvider( val availableScopes = towerDataElement.getAvailableScopes().flatMap { flattenFirScope(it) } availableScopes.map { IndexedValue(index, it) } } - val scopes = firScopes.map { (index, firScope) -> + val ktScopesWithKinds = createScopesWithKind(firScopes) + + return KtScopeContext(ktScopesWithKinds, implicitReceivers, token) + } + + private fun createScopesWithKind(firScopes: Iterable>): List { + return firScopes.map { (index, firScope) -> KtScopeWithKind(convertToKtScope(firScope), getScopeKind(firScope, index), token) } - - return KtScopeContext(scopes, implicitReceivers, token) } private fun flattenFirScope(firScope: FirScope): List = when (firScope) {