[IR] KotlinLikeDumper: process specially when IrElseBranch's condition is not true constant

This commit is contained in:
Zalim Bashorov
2020-11-17 02:18:50 +03:00
committed by teamcityserver
parent 503370c9c2
commit f9fe82e735
@@ -1173,8 +1173,13 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) {
p.printIndent()
// TODO assert that condition is `true`
p.printWithNoIndent("else -> ")
if ((branch.condition as? IrConst<*>)?.value == true) {
p.printWithNoIndent("else")
} else {
p.printWithNoIndent("/* else */ ")
branch.condition.accept(this, data)
}
p.printWithNoIndent(" -> ")
branch.result.accept(this, data)
p.println()
}