[IR] Add IrSymbolBase.toString() implementation
This commit is contained in:
+1
-2
@@ -590,8 +590,7 @@ class ExpressionCodegen(
|
|||||||
val index = frameMap.getIndex(irSymbol)
|
val index = frameMap.getIndex(irSymbol)
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
return index
|
return index
|
||||||
val dump = if (irSymbol.isBound) irSymbol.owner.dump() else "??? unbound symbol ???"
|
throw AssertionError("Non-mapped local declaration: $irSymbol\n in ${irFunction.dump()}")
|
||||||
throw AssertionError("Non-mapped local declaration: $dump\n in ${irFunction.dump()}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handlePlusMinus(expression: IrSetVariable, value: IrExpression?, isMinus: Boolean): Boolean {
|
private fun handlePlusMinus(expression: IrSetVariable, value: IrExpression?, isMinus: Boolean): Boolean {
|
||||||
|
|||||||
@@ -22,8 +22,14 @@ import org.jetbrains.kotlin.ir.descriptors.*
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
|
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||||
|
import org.jetbrains.kotlin.ir.util.dump
|
||||||
|
|
||||||
abstract class IrSymbolBase<out D : DeclarationDescriptor>(override val descriptor: D) : IrSymbol
|
abstract class IrSymbolBase<out D : DeclarationDescriptor>(override val descriptor: D) : IrSymbol {
|
||||||
|
override fun toString(): String {
|
||||||
|
if (isBound) return owner.dump()
|
||||||
|
return "Unbound private symbol ${super.toString()}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolOwner>(descriptor: D) :
|
abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolOwner>(descriptor: D) :
|
||||||
IrBindableSymbol<D, B>, IrSymbolBase<D>(descriptor) {
|
IrBindableSymbol<D, B>, IrSymbolBase<D>(descriptor) {
|
||||||
@@ -48,7 +54,7 @@ abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolO
|
|||||||
|
|
||||||
private var _owner: B? = null
|
private var _owner: B? = null
|
||||||
override val owner: B
|
override val owner: B
|
||||||
get() = _owner ?: throw IllegalStateException("Symbol is unbound")
|
get() = _owner ?: throw IllegalStateException("Symbol with ${javaClass.simpleName} is unbound")
|
||||||
|
|
||||||
override fun bind(owner: B) {
|
override fun bind(owner: B) {
|
||||||
if (_owner == null) {
|
if (_owner == null) {
|
||||||
|
|||||||
@@ -10,8 +10,17 @@ import org.jetbrains.kotlin.ir.declarations.*
|
|||||||
import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||||
|
import org.jetbrains.kotlin.ir.util.dump
|
||||||
|
|
||||||
abstract class IrPublicSymbolBase<out D : DeclarationDescriptor>(override val descriptor: D, override val signature: IdSignature) : IrSymbol
|
abstract class IrPublicSymbolBase<out D : DeclarationDescriptor>(
|
||||||
|
override val descriptor: D,
|
||||||
|
override val signature: IdSignature
|
||||||
|
) : IrSymbol {
|
||||||
|
override fun toString(): String {
|
||||||
|
if (isBound) return owner.dump()
|
||||||
|
return "Unbound public symbol for $signature"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class IrBindablePublicSymbolBase<out D : DeclarationDescriptor, B : IrSymbolOwner>(descriptor: D, sig: IdSignature) :
|
abstract class IrBindablePublicSymbolBase<out D : DeclarationDescriptor, B : IrSymbolOwner>(descriptor: D, sig: IdSignature) :
|
||||||
IrBindableSymbol<D, B>, IrPublicSymbolBase<D>(descriptor, sig) {
|
IrBindableSymbol<D, B>, IrPublicSymbolBase<D>(descriptor, sig) {
|
||||||
|
|||||||
Reference in New Issue
Block a user