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
@@ -139,4 +139,7 @@ class IrFakeOverrideFunctionImpl(
symbol.bind(this)
return this
}
override val isBound: Boolean
get() = _symbol != null
}
@@ -126,4 +126,7 @@ class IrFakeOverridePropertyImpl(
symbol.bind(this)
return this
}
override val isBound: Boolean
get() = _symbol != null
}
@@ -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" }
@@ -14,4 +14,6 @@ interface IrFakeOverrideFunction : IrDeclaration {
var modality: Modality
fun acquireSymbol(symbol: IrSimpleFunctionSymbol): IrSimpleFunction
val isBound: Boolean
}
@@ -16,4 +16,6 @@ interface IrFakeOverrideProperty : IrDeclaration {
var setter: IrSimpleFunction?
fun acquireSymbol(symbol: IrPropertySymbol): IrProperty
val isBound: Boolean
}