Skip to content

Commit

Permalink
[IR] KotlinLikeDumper: p.print("") -> p.printIndent()
Browse files Browse the repository at this point in the history
  • Loading branch information
bashor authored and teamcityserver committed Nov 25, 2020
1 parent c7d9b7a commit d9dbc01
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
// TODO special support for objects

declaration.printlnAnnotations()
p.print("")
p.printIndent()

declaration.run {
printModifiersWithNoIndent(
Expand Down Expand Up @@ -302,7 +302,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption

private fun IrAnnotationContainer.printlnAnnotations(prefix: String = "") {
annotations.forEach {
p.print("")
p.printIndent()
it.printAnAnnotationWithNoIndent(prefix)
p.printlnWithNoIndent()
}
Expand Down Expand Up @@ -538,7 +538,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption

override fun visitTypeAlias(declaration: IrTypeAlias, data: IrDeclaration?) {
declaration.printlnAnnotations()
p.print("")
p.printIndent()

printVisibility(declaration.visibility)
p(declaration.isActual, "actual")
Expand All @@ -559,7 +559,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
declaration.correspondingClass?.let { p.println() }

declaration.printlnAnnotations()
p.print("")
p.printIndent()
p.printWithNoIndent(declaration.name)
declaration.initializerExpression?.let {
p.printWithNoIndent(" = ")
Expand All @@ -575,7 +575,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: IrDeclaration?) {
// Looks like IrAnonymousInitializer has annotations accidentally. No tests.
declaration.printlnAnnotations()
p.print("")
p.printIndent()

// TODO looks like there are no irText tests for isStatic flag
p(declaration.isStatic, commentBlockH("static"))
Expand Down Expand Up @@ -603,7 +603,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
// TODO return type?

declaration.printlnAnnotations()
p.print("")
p.printIndent()

declaration.run {
printModifiersWithNoIndent(
Expand Down Expand Up @@ -653,7 +653,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
if (options.printFakeOverridesStrategy == FakeOverridesStrategy.NONE && declaration.isFakeOverride) return

declaration.printlnAnnotations()
p.print("")
p.printIndent()

// TODO better rendering for modifiers on property and accessors
// modifiers that could be different between accessors and property have a comment
Expand Down Expand Up @@ -739,7 +739,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption

override fun visitField(declaration: IrField, data: IrDeclaration?) {
declaration.printlnAnnotations()
p.print("")
p.printIndent()

declaration.run {
printModifiersWithNoIndent(
Expand Down Expand Up @@ -788,7 +788,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption

override fun visitVariable(declaration: IrVariable, data: IrDeclaration?) {
declaration.printlnAnnotations()
p.print("")
p.printIndent()

p(declaration.isLateinit, "lateinit")
p(declaration.isConst, "const")
Expand All @@ -810,7 +810,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption

override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: IrDeclaration?) {
declaration.printlnAnnotations()
p.print("")
p.printIndent()

// TODO think about better rendering
declaration.run { printVariable(isVar, name, type) }
Expand Down

0 comments on commit d9dbc01

Please sign in to comment.