JVM_IR: simplify resolveFakeOverride call in SyntheticAccessorLowering

This commit is contained in:
Georgy Bronnikov
2021-05-21 15:02:31 +03:00
parent fca804de14
commit 7e6782d684
@@ -738,7 +738,8 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
is IrField -> {
val correspondingProperty = declarationRaw.correspondingPropertySymbol?.owner
if (correspondingProperty != null && correspondingProperty.isFakeOverride) {
val realProperty = correspondingProperty.resolveFakeOverrideForProperty()
val realProperty = correspondingProperty.resolveFakeOverride()
?: throw AssertionError("No real override for ${correspondingProperty.render()}")
realProperty.backingField
?: throw AssertionError(
"Fake override property ${correspondingProperty.render()} with backing field " +
@@ -771,16 +772,6 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
}
}
private fun IrProperty.resolveFakeOverrideForProperty(): IrProperty {
if (!isFakeOverride) return this
return this.overriddenSymbols
.map { it.owner }
.collectAndFilterRealOverrides()
.firstOrNull()
?: throw AssertionError("No real override for ${this.render()}")
}
private class OuterClassInfo(val outerClass: IrClass, val throughCrossinlineLambda: Boolean)
private fun getOuterClassInfo(): OuterClassInfo? {