Skip to content

Commit

Permalink
JVM_IR: simplify resolveFakeOverride call in SyntheticAccessorLowering
Browse files Browse the repository at this point in the history
(cherry picked from commit 7e6782d)
  • Loading branch information
Georgy Bronnikov authored and Space committed Jul 6, 2021
1 parent 3843893 commit 70522f6
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,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 " +
Expand Down Expand Up @@ -765,16 +766,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? {
Expand Down

0 comments on commit 70522f6

Please sign in to comment.