[Wasm] Enable for loops optimization
This commit is contained in:
committed by
Svyatoslav Kuzmich
parent
233bb47b99
commit
7f26deb5e6
+3
-1
@@ -382,7 +382,9 @@ internal class IndexedGetLoopHeader(
|
||||
with(builder) {
|
||||
// loopVariable = objectVariable[inductionVariable]
|
||||
val indexedGetFun = with(headerInfo.expressionHandler) { headerInfo.objectVariable.type.getFunction }
|
||||
val get = irCall(indexedGetFun.symbol).apply {
|
||||
// Making sure that expression type has type of the variable when it exists.
|
||||
// Return type of get function can be a type parameter (for example Array<T>::get) which is not a subtype of loopVariable type.
|
||||
val get = irCall(indexedGetFun.symbol, type = loopVariable?.type ?: indexedGetFun.returnType).apply {
|
||||
dispatchReceiver = irGet(headerInfo.objectVariable)
|
||||
putValueArgument(0, irGet(inductionVariable))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user