FIR2IR: wrap do-while loop in IrBlock

"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
This commit is contained in:
Jinseong Jeon
2021-03-18 00:29:09 -07:00
committed by TeamCityServer
parent 08670114c8
commit 7898d167f3
13 changed files with 197 additions and 161 deletions
+10 -8
View File
@@ -223,14 +223,16 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
private set
protected override fun computeNext() {
do// COMPOSITE {
val <unary>: Int = <this>.<get-index>()
<this>.<set-index>(<set-?> = <unary>.inc())
<unary>
// } while (when {
less(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> EQEQ(arg0 = <this>.<get-data>().get(index = <this>.<get-index>()), arg1 = null)
else -> false
})
{ // BLOCK
do// COMPOSITE {
val <unary>: Int = <this>.<get-index>()
<this>.<set-index>(<set-?> = <unary>.inc())
<unary>
// } while (when {
less(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> EQEQ(arg0 = <this>.<get-data>().get(index = <this>.<get-index>()), arg1 = null)
else -> false
})
}
when {
greaterOrEqual(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> <this>.done()
else -> <this>.setNext(value = <this>.<get-data>().get(index = <this>.<get-index>()) as T)