[IR] Remove custom error messages for missing IrDeclaration.parent
This is to remove custom logic from those classes, so that source generator will be able to generate them in a straight-forward way. Otherwise, it would need to be thought about those special cases, which is better to be avoided. It is also a small step for future work, which likely involves making parent property nullable. Unfortunately, this change causes a loss of some details from exception messages. ^KT-65773 In Progress
This commit is contained in:
committed by
Space Team
parent
f6b2a5915e
commit
92c56d0535
@@ -30,13 +30,7 @@ class IrScriptImpl(
|
|||||||
) : IrScript() {
|
) : IrScript() {
|
||||||
override var origin: IrDeclarationOrigin = SCRIPT_ORIGIN
|
override var origin: IrDeclarationOrigin = SCRIPT_ORIGIN
|
||||||
|
|
||||||
private var _parent: IrDeclarationParent? = null
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var parent: IrDeclarationParent
|
|
||||||
get() = _parent
|
|
||||||
?: throw UninitializedPropertyAccessException("Parent not initialized: $this")
|
|
||||||
set(v) {
|
|
||||||
_parent = v
|
|
||||||
}
|
|
||||||
|
|
||||||
override var annotations: List<IrConstructorCall> = SmartList()
|
override var annotations: List<IrConstructorCall> = SmartList()
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,7 @@ class IrVariableImpl(
|
|||||||
override var isConst: Boolean,
|
override var isConst: Boolean,
|
||||||
override var isLateinit: Boolean
|
override var isLateinit: Boolean
|
||||||
) : IrVariable() {
|
) : IrVariable() {
|
||||||
private var _parent: IrDeclarationParent? = null
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var parent: IrDeclarationParent
|
|
||||||
get() = _parent
|
|
||||||
?: throw UninitializedPropertyAccessException("Parent not initialized: $this")
|
|
||||||
set(v) {
|
|
||||||
_parent = v
|
|
||||||
}
|
|
||||||
|
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user