Configuration: Drop coroutines for language >= 1.3

#KT-25681 Fixed

Original commit: a490781213
This commit is contained in:
Alexey Sedunov
2018-07-25 13:22:59 +03:00
committed by Ilya Gorbunov
parent 1d1d959e27
commit b48d055334
2 changed files with 4 additions and 2 deletions
@@ -187,14 +187,15 @@ class KotlinFacetSettings {
} }
} }
var coroutineSupport: LanguageFeature.State var coroutineSupport: LanguageFeature.State?
get() { get() {
val languageVersion = languageLevel ?: return LanguageFeature.Coroutines.defaultState val languageVersion = languageLevel ?: return LanguageFeature.Coroutines.defaultState
if (languageVersion < LanguageFeature.Coroutines.sinceVersion!!) return LanguageFeature.State.DISABLED if (languageVersion < LanguageFeature.Coroutines.sinceVersion!!) return LanguageFeature.State.DISABLED
return CoroutineSupport.byCompilerArguments(compilerArguments) return CoroutineSupport.byCompilerArgumentsOrNull(compilerArguments)
} }
set(value) { set(value) {
compilerArguments!!.coroutinesState = when (value) { compilerArguments!!.coroutinesState = when (value) {
null -> CommonCompilerArguments.DEFAULT
LanguageFeature.State.ENABLED -> CommonCompilerArguments.ENABLE LanguageFeature.State.ENABLED -> CommonCompilerArguments.ENABLE
LanguageFeature.State.ENABLED_WITH_WARNING -> CommonCompilerArguments.WARN LanguageFeature.State.ENABLED_WITH_WARNING -> CommonCompilerArguments.WARN
LanguageFeature.State.ENABLED_WITH_ERROR, LanguageFeature.State.DISABLED -> CommonCompilerArguments.ERROR LanguageFeature.State.ENABLED_WITH_ERROR, LanguageFeature.State.DISABLED -> CommonCompilerArguments.ERROR
@@ -153,6 +153,7 @@ private fun readV2Config(element: Element): KotlinFacetSettings {
compilerArguments!!.coroutinesState = CommonCompilerArguments.WARN compilerArguments!!.coroutinesState = CommonCompilerArguments.WARN
args.any { arg -> arg.attributes[0].value == "coroutinesError" && arg.attributes[1].booleanValue } -> args.any { arg -> arg.attributes[0].value == "coroutinesError" && arg.attributes[1].booleanValue } ->
compilerArguments!!.coroutinesState = CommonCompilerArguments.ERROR compilerArguments!!.coroutinesState = CommonCompilerArguments.ERROR
else -> compilerArguments!!.coroutinesState = CommonCompilerArguments.DEFAULT
} }
} }
} }