[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
@@ -1,3 +1,5 @@
import kotlin.coroutines.*
internal suspend fun testDefaltParam(stepId: Int): Int {
return callFun(ClassA2())
}
@@ -8,9 +10,22 @@ private suspend fun callFun(a: InterfaceA): Int {
return a.functionA(0, "", false)
}
suspend fun box(stepId: Int): String {
suspend fun suspendBox(stepId: Int): String {
if (testDefaltParam(stepId) != stepId) {
return "Fail"
}
return "OK"
}
fun runCoroutine(coroutine: suspend () -> String): String {
var result: String = "Uninitialized"
coroutine.startCoroutine(object : Continuation<String> {
override val context = EmptyCoroutineContext
override fun resumeWith(r: Result<String>) {
result = r.getOrThrow()
}
})
return result
}
fun box(stepId: Int) = runCoroutine { suspendBox(stepId) }