Kotlin Facet: Check contradictory values of "coroutine support" option

#KT-16109 Fixed
This commit is contained in:
Alexey Sedunov
2017-02-08 15:18:33 +03:00
parent 9397b16bb9
commit 330beebb2c
2 changed files with 46 additions and 7 deletions
@@ -74,12 +74,14 @@ enum class CoroutineSupport(
companion object {
val DEFAULT = ENABLED_WITH_WARNING
@JvmStatic fun byCompilerArguments(arguments: CommonCompilerArguments?) = when {
arguments == null -> DEFAULT
@JvmStatic fun byCompilerArguments(arguments: CommonCompilerArguments?) = byCompilerArgumentsOrNull(arguments) ?: DEFAULT
fun byCompilerArgumentsOrNull(arguments: CommonCompilerArguments?) = when {
arguments == null -> null
arguments.coroutinesEnable -> ENABLED
arguments.coroutinesWarn -> ENABLED_WITH_WARNING
arguments.coroutinesError -> DISABLED
else -> DEFAULT
else -> null
}
fun byCompilerArgument(argument: String): CoroutineSupport {