[Resolve] Rewrite how built-ins are created
Under COMPOSITE mode we don't have a globally known way to create built-ins, instead, we have to create them on per-module basis. So, in this commit we: 1. Use builtInsProvider: (ModuleInfo) -> KotlinBuiltIns instead of precomputed builtIns instance, in order to be able to calculate builtIns on per-module basis 2. Introduce new entity, called BuiltInsCache, which, roughly speaking, is a map of form ModuleInfo -> KotlinBuiltIns, to prevent creation of multiple builtInsInstances NB. Actually, it's of form BuiltInsCacheKey -> KotlinBuiltIns, because we shouldn't create new builtIns for each module. Also, currently, each platform has its own BuiltInsCacheKey implementation, because parameters by which built-ins are created, are a bit different across different platforms. Ideally, we should eliminate those differences and they use one concrete implementation as a key.
This commit is contained in:
+4
-1
@@ -20,6 +20,7 @@ import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.*
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
@@ -149,7 +150,9 @@ class CommonResolverForModuleFactory(
|
||||
CommonPlatforms.defaultCommonPlatform,
|
||||
shouldCheckExpectActual = false
|
||||
)
|
||||
}
|
||||
},
|
||||
builtInsProvider = { DefaultBuiltIns.Instance },
|
||||
sdkDependency = { null }
|
||||
)
|
||||
|
||||
val moduleDescriptor = resolver.descriptorForModule(moduleInfo)
|
||||
|
||||
Reference in New Issue
Block a user