[IR] Support disabling of rendering IrErrorType inner KotlinType
This commit is contained in:
committed by
teamcityserver
parent
2eac442705
commit
1831c0a14b
@@ -49,7 +49,7 @@ class DumpIrTreeVisitor(
|
|||||||
) : IrElementVisitor<Unit, String> {
|
) : IrElementVisitor<Unit, String> {
|
||||||
|
|
||||||
private val printer = Printer(out, " ")
|
private val printer = Printer(out, " ")
|
||||||
private val elementRenderer = RenderIrElementVisitor(normalizeNames)
|
private val elementRenderer = RenderIrElementVisitor(normalizeNames, !stableOrder)
|
||||||
private fun IrType.render() = elementRenderer.renderType(this)
|
private fun IrType.render() = elementRenderer.renderType(this)
|
||||||
|
|
||||||
private fun List<IrDeclaration>.ordered(): List<IrDeclaration> {
|
private fun List<IrDeclaration>.ordered(): List<IrDeclaration> {
|
||||||
@@ -95,6 +95,12 @@ class DumpIrTreeVisitor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment, data: String) {
|
||||||
|
declaration.dumpLabeledElementWith(data) {
|
||||||
|
declaration.declarations.ordered().dumpElements()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun visitFile(declaration: IrFile, data: String) {
|
override fun visitFile(declaration: IrFile, data: String) {
|
||||||
declaration.dumpLabeledElementWith(data) {
|
declaration.dumpLabeledElementWith(data) {
|
||||||
dumpAnnotations(declaration)
|
dumpAnnotations(declaration)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.utils.addIfNotNull
|
|||||||
fun IrElement.render() =
|
fun IrElement.render() =
|
||||||
accept(RenderIrElementVisitor(), null)
|
accept(RenderIrElementVisitor(), null)
|
||||||
|
|
||||||
class RenderIrElementVisitor(private val normalizeNames: Boolean = false) : IrElementVisitor<String, Nothing?> {
|
class RenderIrElementVisitor(private val normalizeNames: Boolean = false, private val verboseErrorTypes: Boolean = true) : IrElementVisitor<String, Nothing?> {
|
||||||
private val nameMap: MutableMap<IrVariableSymbol, String> = mutableMapOf()
|
private val nameMap: MutableMap<IrVariableSymbol, String> = mutableMapOf()
|
||||||
private var temporaryIndex: Int = 0
|
private var temporaryIndex: Int = 0
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ class RenderIrElementVisitor(private val normalizeNames: Boolean = false) : IrEl
|
|||||||
when (this) {
|
when (this) {
|
||||||
is IrDynamicType -> "dynamic"
|
is IrDynamicType -> "dynamic"
|
||||||
|
|
||||||
is IrErrorType -> "IrErrorType($originalKotlinType)"
|
is IrErrorType -> "IrErrorType(${if (verboseErrorTypes) originalKotlinType else null})"
|
||||||
|
|
||||||
is IrSimpleType -> buildTrimEnd {
|
is IrSimpleType -> buildTrimEnd {
|
||||||
append(classifier.renderClassifierFqn())
|
append(classifier.renderClassifierFqn())
|
||||||
|
|||||||
Reference in New Issue
Block a user