[JS IR] Add separate key to enable extensions in external interfaces

This commit is contained in:
Ilya Goncharov
2021-08-30 18:55:39 +03:00
committed by Space
parent 751914ca4d
commit ecefda58fb
2 changed files with 17 additions and 0 deletions
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.LanguageVersionSettings
@@ -214,6 +215,12 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
)
var friendModules: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xenable-extension-functions-in-externals",
description = "Enable extensions functions members in external interfaces"
)
var extensionFunctionsInExternals: Boolean by FreezableVar(false)
@Argument(value = "-Xmetadata-only", description = "Generate *.meta.js and *.kjsm files only")
var metadataOnly: Boolean by FreezableVar(false)
@@ -241,6 +248,14 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
)
}
}
override fun configureLanguageFeatures(collector: MessageCollector): MutableMap<LanguageFeature, LanguageFeature.State> {
return super.configureLanguageFeatures(collector).apply {
if (extensionFunctionsInExternals) {
this[LanguageFeature.JsEnableExtensionFunctionInExternals] = LanguageFeature.State.ENABLED
}
}
}
}
fun K2JSCompilerArguments.isPreIrBackendDisabled(): Boolean =
+2
View File
@@ -3,6 +3,8 @@ where advanced options include:
-Xcache-directories=<path> A path to cache directories
-Xenable-js-scripting Enable experimental support of .kts files using K/JS (with -Xir only)
-Xerror-tolerance-policy Set up error tolerance policy (NONE, SEMANTIC, SYNTAX, ALL)
-Xenable-extension-functions-in-externals
Enable extensions functions members in external interfaces
-Xfake-override-validator Enable IR fake override validator
-Xfriend-modules=<path> Paths to friend modules
-Xfriend-modules-disabled Disable internal declaration export