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
@@ -185,7 +185,7 @@ object IrFactoryImpl : IrFactory {
isDelegated: Boolean,
isExternal: Boolean,
isExpect: Boolean,
): IrFakeOverrideProperty =
): IrProperty =
IrFakeOverridePropertyImpl(
startOffset, endOffset, origin, name, visibility, modality,
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
@@ -104,10 +104,11 @@ class IrFakeOverrideFunctionImpl(
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
}
}
@@ -103,10 +103,11 @@ class IrFakeOverridePropertyImpl(
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
}
}