Refactoring: remove ModuleResolverProvider, inline createModuleResolverProvider

This commit is contained in:
Nikolay Krasko
2018-02-22 16:10:18 +03:00
parent de68607d5f
commit 90802f2d7c
3 changed files with 117 additions and 164 deletions
@@ -62,6 +62,7 @@ abstract class ResolverForProject<M : ModuleInfo> {
abstract val name: String
abstract val allModules: Collection<M>
abstract val builtIns: KotlinBuiltIns
override fun toString() = name
}
@@ -77,6 +78,7 @@ class EmptyResolverForProject<M : ModuleInfo> : ResolverForProject<M>() {
override fun descriptorForModule(moduleInfo: M) = diagnoseUnknownModuleInfo(listOf(moduleInfo))
override val allModules: Collection<M> = listOf()
override fun diagnoseUnknownModuleInfo(infos: List<ModuleInfo>) = throw IllegalStateException("Should not be called for $infos")
override val builtIns get() = DefaultBuiltIns.Instance
}
class ResolverForProjectImpl<M : ModuleInfo>(
@@ -87,7 +89,7 @@ class ResolverForProjectImpl<M : ModuleInfo>(
private val modulesContent: (M) -> ModuleContent,
private val platformParameters: PlatformAnalysisParameters,
private val targetEnvironment: TargetEnvironment = CompilerEnvironment,
private val builtIns: KotlinBuiltIns = DefaultBuiltIns.Instance,
override val builtIns: KotlinBuiltIns = DefaultBuiltIns.Instance,
private val delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
private val packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { _, _ -> PackagePartProvider.Empty },
private val firstDependency: M? = null,