[FIR2IR] Minor: reuse calculated expression

This commit is contained in:
Ivan Kochurkin
2021-12-02 23:42:28 +03:00
committed by Space
parent 522d2064bb
commit fa41e0f5a9
3 changed files with 14 additions and 17 deletions
@@ -166,10 +166,11 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : IrEle
private fun propertyReferenceKind(expression: IrCallableReference<*>, mutable: Boolean, i: Int): PropertyReferenceKind {
check(i in 0..2) { "Incorrect number of receivers ($i) for property reference: ${expression.render()}" }
val symbols = context.ir.symbols
return PropertyReferenceKind(
context.ir.symbols.getPropertyReferenceClass(mutable, i, false),
context.ir.symbols.getPropertyReferenceClass(mutable, i, true),
context.ir.symbols.reflection.owner.functions.single {
symbols.getPropertyReferenceClass(mutable, i, false),
symbols.getPropertyReferenceClass(mutable, i, true),
symbols.reflection.owner.functions.single {
it.name.asString() == (if (mutable) "mutableProperty$i" else "property$i")
}
)