IR: do not copy call in ForLoopsLowering
This is just a refactoring/optimization that makes use of the fact that IrCall.symbol is now mutable.
This commit is contained in:
committed by
Space Team
parent
bb4d25dfc9
commit
42057b7fe0
+8
-10
@@ -17,12 +17,14 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
|
||||
import org.jetbrains.kotlin.ir.types.getClass
|
||||
import org.jetbrains.kotlin.ir.types.isNothing
|
||||
import org.jetbrains.kotlin.ir.types.isStrictSubtypeOfClass
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.util.dump
|
||||
import org.jetbrains.kotlin.ir.util.functions
|
||||
import org.jetbrains.kotlin.ir.util.hasEqualFqName
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.ir.visitors.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
@@ -343,14 +345,10 @@ private class RangeLoopTransformer(
|
||||
val loopCondition = loop.condition as? IrCall ?: return
|
||||
loopCondition.dispatchReceiver?.type = receiverType
|
||||
|
||||
val nextCall = loopVariable.initializer as? IrCall ?: return
|
||||
loopVariable.initializer = with(nextCall) {
|
||||
IrCallImpl(
|
||||
startOffset, endOffset, type, next.symbol, typeArgumentsCount, valueArgumentsCount, origin, superQualifierSymbol
|
||||
).apply {
|
||||
copyTypeAndValueArgumentsFrom(nextCall)
|
||||
dispatchReceiver?.type = receiverType
|
||||
}
|
||||
val nextCall = loopVariable.initializer
|
||||
if (nextCall is IrCall) {
|
||||
nextCall.symbol = next.symbol
|
||||
nextCall.dispatchReceiver?.type = receiverType
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user