[FIR-IDE] Use delegating KtScope for type param scope

This commit is contained in:
Pavel Kirpichenkov
2020-09-02 12:23:35 +03:00
parent 0d3f1af6e4
commit 26982d1b48
@@ -132,9 +132,9 @@ internal class KtFirScopeProvider(
@OptIn(ExperimentalStdlibApi::class) @OptIn(ExperimentalStdlibApi::class)
val allKtScopes = buildList { val allKtScopes = buildList {
implicitReceiverScopes.mapNotNullTo(this, ::convertToKtScope) implicitReceiverScopes.mapTo(this, ::convertToKtScope)
nonLocalScopes.mapNotNullTo(this, ::convertToKtScope) nonLocalScopes.mapTo(this, ::convertToKtScope)
firLocalScopes.mapNotNullTo(this, ::convertToKtScope) firLocalScopes.mapTo(this, ::convertToKtScope)
} }
KtScopeContext(getCompositeScope(allKtScopes), implicitReceiversTypes) KtScopeContext(getCompositeScope(allKtScopes), implicitReceiversTypes)
@@ -145,14 +145,14 @@ internal class KtFirScopeProvider(
?.getNonStrictParentOfType<KtNamedFunction>() ?.getNonStrictParentOfType<KtNamedFunction>()
?.takeIf { it.textOffset == offset } ?.takeIf { it.textOffset == offset }
private fun convertToKtScope(firScope: FirScope): KtScope? { private fun convertToKtScope(firScope: FirScope): KtScope {
firScopeStorage.register(firScope) firScopeStorage.register(firScope)
return when (firScope) { return when (firScope) {
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token) is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token)
is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, builder, project, token) is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, builder, project, token)
is FirPackageMemberScope -> KtFirPackageScope(firScope, project, builder, token) is FirPackageMemberScope -> KtFirPackageScope(firScope, project, builder, token)
is FirContainingNamesAwareScope -> KtFirDelegatingScopeImpl(firScope, builder, token) is FirContainingNamesAwareScope -> KtFirDelegatingScopeImpl(firScope, builder, token)
is FirMemberTypeParameterScope -> null is FirMemberTypeParameterScope -> KtFirDelegatingScopeImpl(firScope, builder, token)
else -> TODO(firScope::class.toString()) else -> TODO(firScope::class.toString())
} }
} }