Get rid of explicit value case manipulations.

This commit is contained in:
Alexander Gorshenev
2017-12-15 17:26:35 +03:00
committed by alexander-gorshenev
parent d237afdea5
commit ff49153e79
7 changed files with 47 additions and 25 deletions
@@ -69,7 +69,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
internal val produce get() = configuration.get(KonanConfigKeys.PRODUCE)!!
private val prefix = produce.prefix(target)
private val suffix = produce.suffix(target)
val outputName = configuration.get(KonanConfigKeys.OUTPUT)?.removeSuffixIfPresent(suffix) ?: produce.name.toLowerCase()
val outputName = configuration.get(KonanConfigKeys.OUTPUT)?.removeSuffixIfPresent(suffix) ?: produce.userName
val outputFile = outputName
.prefixBaseNameIfNot(prefix)
.suffixIfNot(suffix)
@@ -17,12 +17,13 @@
package org.jetbrains.kotlin.backend.konan
import org.jetbrains.kotlin.backend.konan.util.*
import org.jetbrains.kotlin.konan.util.UserNamed
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
enum class KonanPhase(val description: String,
vararg prerequisite: KonanPhase,
var enabled: Boolean = true, var verbose: Boolean = false) {
var enabled: Boolean = true,
var verbose: Boolean = false) : UserNamed {
/* */ FRONTEND("Frontend builds AST"),
/* */ PSI_TO_IR("Psi to IR conversion"),
/* */ SERIALIZER("Serialize descriptor tree and inline IR bodies"),
@@ -73,7 +74,7 @@ enum class KonanPhase(val description: String,
}
object KonanPhases {
val phases = KonanPhase.values().associate { it.name.toLowerCase() to it }
val phases = KonanPhase.values().associate { it.userName to it }
fun known(name: String): String {
if (phases[name] == null) {
@@ -32,7 +32,7 @@ interface KonanLibraryLayout {
val targetsDir
get() = File(libDir, "targets")
val targetDir
get() = File(targetsDir, target!!.name.toLowerCase())
get() = File(targetsDir, target!!.userName)
val kotlinDir
get() = File(targetDir, "kotlin")
val nativeDir