[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,30 @@
// EXPECTED_REACHABLE_NODES: 1299
// ES_MODULES
// CALL_MAIN
import kotlin.coroutines.*
var callback: () -> Unit = {}
val exception = Exception()
suspend fun main() {
suspendCoroutine<Unit> { cont ->
callback = {
cont.resume(Unit)
}
}
throw exception
}
fun box(): String {
try {
callback()
} catch (e: Exception) {
if (e !== exception) return "Fail"
}
return "OK"
}