Skip to content

Commit

Permalink
Restore dot file output in PhaseAssembly
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Mar 1, 2024
1 parent 577ab8e commit ca28907
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/compiler/scala/tools/nsc/PhaseAssembly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,16 @@ trait PhaseAssembly {
def color(hex: String) = s""" [color="#$hex"]"""
def node(n: graph.Node) = s""""${n.allPhaseNames}(${n.level})""""

val buf = mutable.ListBuffer.empty[String]
buf += "digraph G {"
buf ++= edges.map(e => s"${node(e.frm)}->${node(e.to)}" + color(if (e.hard) "0000ff" else "000000"))
buf ++= extnodes.distinct.map(n => node(n) + color("00ff00"))
buf ++= fatnodes.distinct.map(n => node(n) + color("0000ff"))
buf += "}"

import scala.reflect.io._
val f = Path(d.file) / File(filename)
f.printlnAll("digraph G {")
f.printlnAll(edges.map(e => s"${node(e.frm)}->${node(e.to)}" + color(if (e.hard) "0000ff" else "000000")): _*)
f.printlnAll(extnodes.distinct.map(n => node(n) + color("00ff00")): _*)
f.printlnAll(fatnodes.distinct.map(n => node(n) + color("0000ff")): _*)
f.printlnAll("}")
f.printlnAll(buf.toList: _*)
}
}
}

0 comments on commit ca28907

Please sign in to comment.