IR: .isBound API for F/O declarations

Fake override functions and properties may not be bound to symbols.
This API allows to know if such declaration is actually bound
This commit is contained in:
Anton Bannykh
2021-07-06 17:23:32 +03:00
committed by teamcityserver
parent 6c734289be
commit 76f0684d7c
6 changed files with 18 additions and 1 deletions
@@ -75,7 +75,11 @@ internal class PersistentIrFakeOverrideFunction(
private var _symbol: IrSimpleFunctionSymbol? = null
override val symbol: IrSimpleFunctionSymbol
get() = _symbol ?: error("$this has not acquired a symbol yet")
get() = _symbol ?:
error("$this has not acquired a symbol yet")
override val isBound: Boolean
get() = _symbol != null
@ObsoleteDescriptorBasedAPI
override val descriptor
@@ -80,6 +80,9 @@ internal class PersistentIrFakeOverrideProperty(
override val descriptor
get() = _symbol?.descriptor ?: this.toIrBasedDescriptor()
override val isBound: Boolean
get() = _symbol != null
@OptIn(ObsoleteDescriptorBasedAPI::class)
override fun acquireSymbol(symbol: IrPropertySymbol): IrProperty {
assert(_symbol == null) { "$this already has symbol _symbol" }