IR symbols: enhance exception messages / toString() a bit

This commit is contained in:
Mikhail Glukhikh
2020-05-28 22:58:37 +03:00
parent b6cdcc8d50
commit ffdab473e2
2 changed files with 6 additions and 6 deletions
@@ -22,11 +22,11 @@ import org.jetbrains.kotlin.ir.descriptors.*
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.render
abstract class IrSymbolBase<out D : DeclarationDescriptor>(override val descriptor: D) : IrSymbol {
override fun toString(): String {
if (isBound) return owner.dump()
if (isBound) return owner.render()
return "Unbound private symbol ${super.toString()}"
}
}
@@ -60,7 +60,7 @@ abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolO
if (_owner == null) {
_owner = owner
} else {
throw IllegalStateException("${javaClass.simpleName} is already bound")
throw IllegalStateException("${javaClass.simpleName} is already bound: ${owner.render()}")
}
}
@@ -10,14 +10,14 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.render
abstract class IrPublicSymbolBase<out D : DeclarationDescriptor>(
override val descriptor: D,
override val signature: IdSignature
) : IrSymbol {
override fun toString(): String {
if (isBound) return owner.dump()
if (isBound) return owner.render()
return "Unbound public symbol for $signature"
}
}
@@ -46,7 +46,7 @@ abstract class IrBindablePublicSymbolBase<out D : DeclarationDescriptor, B : IrS
if (_owner == null) {
_owner = owner
} else {
throw IllegalStateException("${javaClass.simpleName} for $signature is already bound")
throw IllegalStateException("${javaClass.simpleName} for $signature is already bound: ${owner.render()}")
}
}