[FIR] Cleanup creating sessions in CLI FIR compiler

This commit is contained in:
Dmitriy Novozhilov
2020-10-01 14:43:31 +03:00
parent 3aa8b09e31
commit 82a2ecfe14
2 changed files with 42 additions and 32 deletions
@@ -0,0 +1,33 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.session
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
class FirJvmModuleInfo(override val name: Name, val dependencies: List<ModuleInfo>) : ModuleInfo {
companion object {
val LIBRARIES_MODULE_NAME = Name.special("<dependencies>")
fun createForLibraries(): FirJvmModuleInfo = FirJvmModuleInfo(LIBRARIES_MODULE_NAME, emptyList())
}
constructor(moduleName: String, dependencies: List<ModuleInfo>) : this(Name.identifier(moduleName), dependencies)
override val platform: TargetPlatform
get() = JvmPlatforms.unspecifiedJvmPlatform
override val analyzerServices: PlatformDependentAnalyzerServices
get() = JvmPlatformAnalyzerServices
override fun dependencies(): List<ModuleInfo> {
return dependencies
}
}