JS: support [suspend] fun main([args: Array<String>]) (KT-26628, KT-26572 fixed)

This commit is contained in:
Anton Bannykh
2018-09-10 19:33:04 +03:00
committed by Denis Zharkov
parent 7e9704e50d
commit ead9b31e03
10 changed files with 226 additions and 3 deletions
+30
View File
@@ -0,0 +1,30 @@
// EXPECTED_REACHABLE_NODES: 1299
// IGNORE_BACKEND: JS_IR
// 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) {
assertTrue(e === exception)
}
return "OK"
}