[Analysis API] optimize composite scope
Do not create KtCompositeScope for empty or single scopes
This commit is contained in:
committed by
Space Team
parent
950a32901c
commit
ee1fd9f6e9
@@ -95,4 +95,5 @@ compileKotlin.dependsOn(generateCode)
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions.freeCompilerArgs += "-Xcontext-receivers"
|
||||
kotlinOptions.freeCompilerArgs += "-opt-in=org.jetbrains.kotlin.analysis.api.KtAnalysisApiInternals"
|
||||
}
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ internal class KtFirScopeProvider(
|
||||
|
||||
|
||||
override fun getCompositeScope(subScopes: List<KtScope>): KtScope {
|
||||
return KtCompositeScope(subScopes, token)
|
||||
return KtCompositeScope.create(subScopes, token)
|
||||
}
|
||||
|
||||
override fun getTypeScope(type: KtType): KtTypeScope? = getFirTypeScope(type)?.let { convertToKtTypeScope(it) }
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ internal class KtFirScopeSubstitution(
|
||||
override fun getDeclarationScope(scope: KtTypeScope): KtScope {
|
||||
return when (scope) {
|
||||
is KtFirDelegatingTypeScope -> KtFirDelegatingNamesAwareScope(scope.firScope, analysisSession.firSymbolBuilder)
|
||||
is KtCompositeTypeScope -> KtCompositeScope(scope.subScopes.map(::getDeclarationScope), token)
|
||||
is KtCompositeTypeScope -> KtCompositeScope.create(scope.subScopes.map(::getDeclarationScope), token)
|
||||
else -> unexpectedElementError<KtTypeScope>(scope)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user