summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-06-14 02:26:07 +0000
committerPaul Phillips <paulp@improving.org>2011-06-14 02:26:07 +0000
commit4ba275137e02e485de1b1447e780b97c4e0b3cbd (patch)
treec3be99189fbb8dd21bc6dbf58e8ea7b4daa3a5e4 /src/compiler/scala/tools/nsc/Global.scala
parentf02512706f53ea743a8b8b3df27d20810f14ea4e (diff)
downloadscala-4ba275137e02e485de1b1447e780b97c4e0b3cbd.tar.gz
scala-4ba275137e02e485de1b1447e780b97c4e0b3cbd.tar.bz2
scala-4ba275137e02e485de1b1447e780b97c4e0b3cbd.zip
Documented what I could figure out about late f...
Documented what I could figure out about late flags and anti-flags. Eliminated some indirection in flag usage. Made -Xshow-phases print out more info about flags if -Ydebug is also given. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index d322ce8382..2cf8246db1 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -645,6 +645,28 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
}
line1 :: line2 :: descs mkString
}
+ /** Summary of the per-phase values of nextFlags and newFlags, shown
+ * with -Xshow-phases if -Ydebug also given.
+ */
+ def phaseFlagDescriptions: String = {
+ val width = phaseNames map (_.length) max
+ val fmt = "%" + width + "s %2s %s\n"
+
+ val line1 = fmt.format("phase name", "id", "new flags")
+ val line2 = fmt.format("----------", "--", "---------")
+ val descs = phaseDescriptors.zipWithIndex map {
+ case (ph, idx) =>
+ def fstr1 = if (ph.phaseNewFlags == 0L) "" else "[START] " + Flags.flagsToString(ph.phaseNewFlags)
+ def fstr2 = if (ph.phaseNextFlags == 0L) "" else "[END] " + Flags.flagsToString(ph.phaseNextFlags)
+ val fstr = (
+ if (ph.ownPhase.id == 1) Flags.flagsToString(Flags.InitialFlags)
+ else if (ph.phaseNewFlags != 0L && ph.phaseNextFlags != 0L) fstr1 + " " + fstr2
+ else fstr1 + fstr2
+ )
+ fmt.format(ph.phaseName, idx + 1, fstr)
+ }
+ line1 :: line2 :: descs mkString
+ }
// ----------- Runs ---------------------------------------