Break/finally chain in suspend function test fix & workaround
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JS_IR
|
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
// IGNORE_BACKEND: JS_IR
|
||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
@@ -47,8 +47,8 @@ fun box(): String {
|
|||||||
result += "@"
|
result += "@"
|
||||||
for (y in listOf("F", "G")) {
|
for (y in listOf("F", "G")) {
|
||||||
try {
|
try {
|
||||||
result += suspendWithResult(z)
|
result += suspendWithResult(y)
|
||||||
if (z == "G") {
|
if (y == "G") {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -280,7 +280,18 @@ class CoroutineFunctionTransformer(private val function: JsFunction, name: Strin
|
|||||||
statements += block.statements
|
statements += block.statements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val switchStatement = JsSwitch(stateRef.deepCopy(), cases)
|
|
||||||
|
// NOTE: temporary workaround to let tests run without hanging
|
||||||
|
// TODO: probably default statement should be removed asap the issue about nested break & finally is fixed
|
||||||
|
val defaultCase = JsDefault().apply {
|
||||||
|
val block = JsBlock(
|
||||||
|
assignment(stateRef, JsIntLiteral(indexOfGlobalCatch)).makeStmt(),
|
||||||
|
JsThrow(JsNew(JsNameRef("Error"), listOf(JsStringLiteral("State Machine Unreachable execution"))))
|
||||||
|
)
|
||||||
|
statements += block
|
||||||
|
}
|
||||||
|
|
||||||
|
val switchStatement = JsSwitch(stateRef.deepCopy(), cases + defaultCase)
|
||||||
val loop = JsDoWhile(JsBooleanLiteral(true), JsTry(JsBlock(switchStatement), catch, null))
|
val loop = JsDoWhile(JsBooleanLiteral(true), JsTry(JsBlock(switchStatement), catch, null))
|
||||||
|
|
||||||
return listOf(loop)
|
return listOf(loop)
|
||||||
|
|||||||
Reference in New Issue
Block a user