aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-04 11:27:15 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-04 11:27:15 +0100
commit19b6784ef1cae9cd0af278c0c3afcee47c0a00ea (patch)
tree45fcb7127c86f2a3eb557f4d6ac70c07d35cc8a4 /src/dotty
parent73166c1cf7af36389656e90b8d88f1d2a2fb5786 (diff)
downloaddotty-19b6784ef1cae9cd0af278c0c3afcee47c0a00ea.tar.gz
dotty-19b6784ef1cae9cd0af278c0c3afcee47c0a00ea.tar.bz2
dotty-19b6784ef1cae9cd0af278c0c3afcee47c0a00ea.zip
Added capability to print tree positions
Controlled by option -Yprintpos
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala1
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index f1ca5bd6c..ef926c664 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -142,6 +142,7 @@ class ScalaSettings extends Settings.SettingGroup {
val noSelfCheck = BooleanSetting("-Yno-self-type-checks", "Suppress check for self-type conformance among inherited members.")
val YshowSuppressedErrors = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally supressed.")
val Yheartbeat = BooleanSetting("-Yheartbeat", "show heartbeat stack trace of compiler operations.")
+ val Yprintpos = BooleanSetting("-Yprintpos", "show tree positions")
def stop = stopAfter
/** Area-specific debug output.
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 0e2eb77f2..a62eb5acd 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -372,6 +372,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
if (tree.isType) txt = toText(tp)
else if (!tree.isDef) txt = "<" ~ txt ~ ":" ~ toText(tp) ~ ">"
}
+ if (ctx.settings.Yprintpos.value && !tree.isInstanceOf[WithoutTypeOrPos[_]])
+ txt = txt ~ "@" ~ tree.pos.toString
tree match {
case Block(_, _) | Template(_, _, _, _) => txt
case _ => txt.close