IR: generate lambdas in place in Psi2Ir
even when arguments are to be rearranged. Lambdas have no side effects, and storing them in temporary variables prevents processing in the backend (such as inserting continuation parameter in AddContinuationLowering).
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
inline fun callAction(aux: Int, action: () -> String): String {
|
||||
return action()
|
||||
}
|
||||
|
||||
suspend fun get() = "OK"
|
||||
|
||||
suspend fun callSuspend(): String {
|
||||
return callAction(action = {
|
||||
get()
|
||||
}, aux = 0)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var v = "fail"
|
||||
builder {
|
||||
v = callSuspend()
|
||||
}
|
||||
return v
|
||||
}
|
||||
Reference in New Issue
Block a user