JVM IR: Avoid patchDeclarationParents after inlining
The code in IrInlineUtils.kt already updates declaration parents.
This commit is contained in:
committed by
Alexander Udalov
parent
a18ac2ac91
commit
f0238766df
+1
-3
@@ -86,9 +86,7 @@ private class ArrayConstructorTransformer(
|
|||||||
+irCall(result.type.getClass()!!.functions.single { it.name == OperatorNameConventions.SET }).apply {
|
+irCall(result.type.getClass()!!.functions.single { it.name == OperatorNameConventions.SET }).apply {
|
||||||
dispatchReceiver = irGet(result)
|
dispatchReceiver = irGet(result)
|
||||||
putValueArgument(0, irGet(tempIndex))
|
putValueArgument(0, irGet(tempIndex))
|
||||||
val inlined = generator
|
val inlined = generator.inline(parent, listOf(tempIndex))
|
||||||
.inline(parent, listOf(tempIndex))
|
|
||||||
.patchDeclarationParents(scope.getLocalDeclarationParent())
|
|
||||||
putValueArgument(1, inlined)
|
putValueArgument(1, inlined)
|
||||||
}
|
}
|
||||||
val inc = index.type.getClass()!!.functions.single { it.name == OperatorNameConventions.INC }
|
val inc = index.type.getClass()!!.functions.single { it.name == OperatorNameConventions.INC }
|
||||||
|
|||||||
+1
-4
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.ir.expressions.IrCall
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
|
||||||
import org.jetbrains.kotlin.ir.util.getPackageFragment
|
import org.jetbrains.kotlin.ir.util.getPackageFragment
|
||||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
|
|
||||||
internal val assertionPhase = makeIrFilePhase(
|
internal val assertionPhase = makeIrFilePhase(
|
||||||
@@ -105,9 +104,7 @@ private class AssertionLowering(private val context: JvmBackendContext) :
|
|||||||
val generator = lambdaArgument?.asInlinable(this)
|
val generator = lambdaArgument?.asInlinable(this)
|
||||||
val constructor = this@AssertionLowering.context.ir.symbols.assertionErrorConstructor
|
val constructor = this@AssertionLowering.context.ir.symbols.assertionErrorConstructor
|
||||||
val throwError = irThrow(irCall(constructor).apply {
|
val throwError = irThrow(irCall(constructor).apply {
|
||||||
val message = generator?.inline(parent)?.patchDeclarationParents(scope.getLocalDeclarationParent())
|
putValueArgument(0, generator?.inline(parent) ?: irString("Assertion failed"))
|
||||||
?: irString("Assertion failed")
|
|
||||||
putValueArgument(0, message)
|
|
||||||
})
|
})
|
||||||
+irIfThen(irNot(assertCondition), throwError)
|
+irIfThen(irNot(assertCondition), throwError)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user