[JS IR] Add messages about unused cli arguments

This commit is contained in:
Alexander Korepanov
2022-11-04 16:09:57 +01:00
committed by Space Team
parent cb7df4d428
commit 92638573ce
@@ -210,7 +210,6 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
)
var irModuleName: String? by NullableStringFreezableVar(null)
// TODO: REMOVE IT
@Argument(value = "-Xir-base-class-in-metadata", description = "Write base class into metadata")
var irBaseClassInMetadata: Boolean by FreezableVar(false)
@@ -236,7 +235,6 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-per-file", description = "Splits generated .js per-file")
var irPerFile: Boolean by FreezableVar(false)
// TODO: REMOVE IT
@Argument(value = "-Xir-new-ir2js", description = "New fragment-based ir2js")
var irNewIr2Js: Boolean by FreezableVar(true)
@@ -350,15 +348,19 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
)
var legacyDeprecatedNoWarn: Boolean by FreezableVar(false)
private fun MessageCollector.deprecationWarn(value: Boolean, defaultValue: Boolean, name: String) {
if (value != defaultValue) {
report(CompilerMessageSeverity.WARNING, "'$name' is deprecated and ignored, it will be removed in a future release")
}
}
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> {
// TODO: 'enableJsScripting' is used in intellij tests
// Drop it after removing the usage from the intellij repository:
// https://github.com/JetBrains/intellij-community/blob/master/plugins/kotlin/gradle/gradle-java/tests/test/org/jetbrains/kotlin/gradle/CompilerArgumentsCachingTest.kt#L329
if (enableJsScripting) {
collector.report(
CompilerMessageSeverity.WARNING, "'-Xenable-js-scripting' is deprecated and will be removed in a future release"
)
}
collector.deprecationWarn(enableJsScripting, false, "-Xenable-js-scripting")
collector.deprecationWarn(irBaseClassInMetadata, false, "-Xir-base-class-in-metadata")
collector.deprecationWarn(irNewIr2Js, true, "-Xir-new-ir2js")
return super.configureAnalysisFlags(collector, languageVersion).also {
it[allowFullyQualifiedNameInKClass] = wasm && wasmKClassFqn //Only enabled WASM BE supports this flag