Skip to content

Commit

Permalink
[IR] KotlinLikeDumper: minor updates for error nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
bashor authored and teamcityserver committed Nov 25, 2020
1 parent a128cdc commit b129788
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.Printer

// TODO look at
// IrSourcePrinter.kt -- androidx-master-dev/frameworks/support/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/IrSourcePrinter.kt
// DumpIrTree.kt -- compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt
Expand Down Expand Up @@ -1217,6 +1218,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
}

override fun visitErrorDeclaration(declaration: IrErrorDeclaration, data: IrDeclaration?) {
// TODO declaration.printlnAnnotations()
p.println("/* ERROR DECLARATION */")
}

Expand All @@ -1226,8 +1228,17 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
}

override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: IrDeclaration?) {
// TODO receiver, arguments
// TODO description
// TODO better rendering
p.printWithNoIndent("error(\"\") /* ERROR CALL */")
expression.explicitReceiver?.let {
it.accept(this, data)
p.printWithNoIndent("; ")
}
expression.arguments.forEach { arg ->
arg.accept(this, data)
p.printWithNoIndent("; ")
}
}

private fun commentBlock(text: String) = "/* $text */"
Expand Down

0 comments on commit b129788

Please sign in to comment.