JVM IR: Avoid patchDeclarationParents after inlining

The code in IrInlineUtils.kt already updates declaration parents.
This commit is contained in:
Steven Schäfer
2022-06-10 14:17:42 +02:00
committed by Alexander Udalov
parent a18ac2ac91
commit f0238766df
2 changed files with 2 additions and 7 deletions
@@ -86,9 +86,7 @@ private class ArrayConstructorTransformer(
+irCall(result.type.getClass()!!.functions.single { it.name == OperatorNameConventions.SET }).apply {
dispatchReceiver = irGet(result)
putValueArgument(0, irGet(tempIndex))
val inlined = generator
.inline(parent, listOf(tempIndex))
.patchDeclarationParents(scope.getLocalDeclarationParent())
val inlined = generator.inline(parent, listOf(tempIndex))
putValueArgument(1, inlined)
}
val inc = index.type.getClass()!!.functions.single { it.name == OperatorNameConventions.INC }
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.ir.expressions.IrCall
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
import org.jetbrains.kotlin.ir.util.getPackageFragment
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
internal val assertionPhase = makeIrFilePhase(
@@ -105,9 +104,7 @@ private class AssertionLowering(private val context: JvmBackendContext) :
val generator = lambdaArgument?.asInlinable(this)
val constructor = this@AssertionLowering.context.ir.symbols.assertionErrorConstructor
val throwError = irThrow(irCall(constructor).apply {
val message = generator?.inline(parent)?.patchDeclarationParents(scope.getLocalDeclarationParent())
?: irString("Assertion failed")
putValueArgument(0, message)
putValueArgument(0, generator?.inline(parent) ?: irString("Assertion failed"))
})
+irIfThen(irNot(assertCondition), throwError)
}