IR: do not inherit IrFakeOverride* from IrFunction/IrProperty

This will help to reduce boilerplate after making the latter classes.

Without this change, IrFunctionCommonImpl would not be able to be a
class because it would introduce a diamond class hierarchy, and thus
that would require copying all its contents to IrFunctionImpl and
IrFakeOverrideFunctionImpl.
This commit is contained in:
Alexander Udalov
2020-07-21 22:57:12 +02:00
parent 4892737cc9
commit f240d51d2c
10 changed files with 20 additions and 20 deletions
@@ -189,7 +189,7 @@ object PersistentIrFactory : IrFactory {
isDelegated: Boolean,
isExternal: Boolean,
isExpect: Boolean,
): IrFakeOverrideProperty =
): IrProperty =
PersistentIrFakeOverrideProperty(
startOffset, endOffset, origin, name, visibility, modality,
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
@@ -133,10 +133,11 @@ internal class PersistentIrFakeOverrideFunction(
get() = _symbol?.descriptor ?: WrappedSimpleFunctionDescriptor()
@OptIn(ObsoleteDescriptorBasedAPI::class)
override fun acquireSymbol(symbol: IrSimpleFunctionSymbol) {
override fun acquireSymbol(symbol: IrSimpleFunctionSymbol): IrSimpleFunction {
assert(_symbol == null) { "$this already has symbol _symbol" }
_symbol = symbol
symbol.bind(this)
(symbol.descriptor as? WrappedSimpleFunctionDescriptor)?.bind(this)
return this
}
}
@@ -140,10 +140,11 @@ internal class PersistentIrFakeOverrideProperty(
get() = _symbol?.descriptor ?: WrappedPropertyDescriptor()
@OptIn(ObsoleteDescriptorBasedAPI::class)
override fun acquireSymbol(symbol: IrPropertySymbol) {
override fun acquireSymbol(symbol: IrPropertySymbol): IrProperty {
assert(_symbol == null) { "$this already has symbol _symbol" }
_symbol = symbol
symbol.bind(this)
(symbol.descriptor as? WrappedPropertyDescriptor)?.bind(this)
return this
}
}