[K/JS] Rework main function call to support it in per-file

This commit is contained in:
Artem Kobzar
2023-10-04 12:13:20 +00:00
committed by Space Team
parent faae5f9b38
commit eef57f216c
57 changed files with 1091 additions and 172 deletions
@@ -0,0 +1,25 @@
// EXPECTED_REACHABLE_NODES: 1296
// ES_MODULES
// CALL_MAIN
import kotlin.coroutines.*
var ok: String = "fail"
var callback: () -> Unit = {}
suspend fun main() {
suspendCoroutine<Unit> { cont ->
callback = {
cont.resume(Unit)
}
}
ok = "OK"
}
fun box(): String {
if ("fail" != ok) error("Fail")
callback()
return ok
}