JS: implementing try/finally in coroutines
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
var globalResult = ""
|
||||
var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = java.util.ArrayList<() -> Unit>()
|
||||
val postponedActions = mutableListOf<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String, x: Continuation<String>) {
|
||||
postponedActions.add {
|
||||
@@ -71,7 +71,7 @@ fun box(): String {
|
||||
|
||||
builder(expectException = true) {
|
||||
try {
|
||||
suspendWithException(java.lang.RuntimeException("OK"))
|
||||
suspendWithException(RuntimeException("OK"))
|
||||
} finally {
|
||||
if (suspendWithValue("G") != "G") throw RuntimeException("fail 2")
|
||||
wasCalled = true
|
||||
|
||||
Reference in New Issue
Block a user