8000 Simplify printTopLevelTree in JS printer · scala-js/scala-js@40c1401 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40c1401

Browse files
committed
Simplify printTopLevelTree in JS printer
Because it does not need to flatten blocks anymore, we can simply print it as a statement and add a trailing newline.
1 parent 28b1b65 commit 40c1401

File tree

1 file changed

+2
-13
lines changed
  • linker/shared/src/main/scala/org/scalajs/linker/backend/javascript

1 file changed

+2
-13
lines changed

linker/shared/src/main/scala/org/scalajs/linker/backend/javascript/Printers.scala

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,8 @@ object Printers {
6262
}
6363

6464
def printTopLevelTree(tree: Tree): Unit = {
65-
tree match {
66-
case Skip() =>
67-
// do not print anything
68-
case tree: Block =>
69-
var rest = tree.stats
70-
while (rest.nonEmpty) {
71-
printTopLevelTree(rest.head)
72-
rest = rest.tail
73-
}
74-
case _ =>
75-
printStat(tree)
76-
println()
77-
}
65+
printStat(tree)
66+
println()
7867
}
7968

8069
protected def printRow(ts: List[Tree], start: Char, end: Char): Unit = {

0 commit comments

Comments
 (0)
0