dumpKotlinLike: add a flag to treat else as true
Deserialized IR always has `true` instead of `else` branch. Dumping `else` as `true` helps comparing regular and serialized IR.
This commit is contained in:
committed by
TeamCityServer
parent
cf2c686630
commit
1b2f4ad071
@@ -58,6 +58,7 @@ class KotlinLikeDumpOptions(
|
||||
// TODO support
|
||||
val labelPrintingStrategy: LabelPrintingStrategy = LabelPrintingStrategy.NEVER,
|
||||
val printFakeOverridesStrategy: FakeOverridesStrategy = FakeOverridesStrategy.ALL,
|
||||
val printElseAsTrue: Boolean = false,
|
||||
/*
|
||||
TODO add more options:
|
||||
always print visibility?
|
||||
@@ -1244,7 +1245,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
|
||||
override fun visitElseBranch(branch: IrElseBranch, data: IrDeclaration?) {
|
||||
p.printIndent()
|
||||
if ((branch.condition as? IrConst<*>)?.value == true) {
|
||||
p.printWithNoIndent("else")
|
||||
p.printWithNoIndent(if (options.printElseAsTrue) "true" else "else")
|
||||
} else {
|
||||
p.printWithNoIndent("/* else */ ")
|
||||
branch.condition.accept(this, data)
|
||||
|
||||
Reference in New Issue
Block a user