Files
kotlin-fork/compiler/testData/cfg/controlStructures/For.values
T
Denis Zharkov 02b40326cc Fix incorrect coroutines codegen behavior
If all the suspension calls in a suspend function were "hidden"
under the for-convention (iterator/next/hasNext) calls,
control-flow didn't find them, thus supposing that there is no
suspension points and there is no need to generate a coroutine state machine

The solution is to add relevant calls to CFG

 #KT-15824 Fixed
2017-01-25 13:54:01 +03:00

23 lines
989 B
Plaintext
Vendored

== t1 ==
fun t1() {
for (i in 1..2) {
doSmth(i)
}
}
---------------------
<v6>: Int NEW: magic[LOOP_RANGE_ITERATION](1..2|<v5>) -> <v6>
1 <v0>: Int NEW: r(1) -> <v0>
2 <v1>: Int NEW: r(2) -> <v1>
1..2 <v5>: {<: Iterable<Int>} NEW: call(1..2, next) -> <v5>
i <v7>: Int NEW: r(i) -> <v7>
doSmth(i) <v8>: * NEW: call(doSmth(i), doSmth|<v7>) -> <v8>
{ doSmth(i) } <v8>: * COPY
for (i in 1..2) { doSmth(i) } !<v9>: *
{ for (i in 1..2) { doSmth(i) } } !<v9>: * COPY
=====================
== doSmth ==
fun doSmth(i: Int) {}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](i: Int) -> <v0>
=====================