[K/JS] Compile Kotlin coroutines as JS generator ^KT-63038 Fixed

This commit is contained in:
Artem Kobzar
2023-12-18 17:13:07 +00:00
committed by Space Team
parent 4d07fdf97e
commit 2530cba82a
73 changed files with 2240 additions and 144 deletions
@@ -67,6 +67,7 @@ fun copyK2JSCompilerArguments(from: K2JSCompilerArguments, to: K2JSCompilerArgum
to.target = from.target
to.typedArrays = from.typedArrays
to.useEsClasses = from.useEsClasses
to.useEsGenerators = from.useEsGenerators
to.wasm = from.wasm
to.wasmDebug = from.wasmDebug
to.wasmEnableArrayRangeChecks = from.wasmEnableArrayRangeChecks
@@ -504,6 +504,16 @@ In combination with '-meta-info', this generates both IR and pre-IR versions of
field = value
}
@Argument(
value = "-Xes-generators",
description = "Enable ES2015 generator functions usage inside the compiled code"
)
var useEsGenerators = false
set(value) {
checkFrozen()
field = value
}
@GradleOption(
value = DefaultValue.BOOLEAN_TRUE_DEFAULT,
gradleInputType = GradleInputTypes.INPUT,
@@ -208,6 +208,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
configurationJs.put(JSConfigurationKeys.PROPERTY_LAZY_INITIALIZATION, arguments.irPropertyLazyInitialization)
configurationJs.put(JSConfigurationKeys.GENERATE_POLYFILLS, arguments.generatePolyfills)
configurationJs.put(JSConfigurationKeys.GENERATE_DTS, arguments.generateDts)
configurationJs.put(JSConfigurationKeys.COMPILE_SUSPEND_AS_JS_GENERATOR, arguments.useEsGenerators)
configurationJs.put(JSConfigurationKeys.GENERATE_INLINE_ANONYMOUS_FUNCTIONS, arguments.irGenerateInlineAnonymousFunctions)
arguments.platformArgumentsProviderJsExpression?.let {