aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/Reporter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-13 14:43:32 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-13 14:43:32 +0100
commita7de2380c1d0864a4b54a3e9630543bebeac2c31 (patch)
tree0f62678f6de2c1d6029bc5cd059225fad5311a93 /src/dotty/tools/dotc/reporting/Reporter.scala
parent7a482f18a47945e118c3ab44697b8b8bebe4002a (diff)
downloaddotty-a7de2380c1d0864a4b54a3e9630543bebeac2c31.tar.gz
dotty-a7de2380c1d0864a4b54a3e9630543bebeac2c31.tar.bz2
dotty-a7de2380c1d0864a4b54a3e9630543bebeac2c31.zip
Making some traces conditional on printers being enabled.
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 2faf1a481..913290a00 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -135,6 +135,10 @@ trait Reporting { this: Context =>
if (cond) traceIndented(question, show)(op)
else op
+ def traceIndented[T](printer: config.Printers.Printer, question: => String, show: Boolean = false)(op: => T): T =
+ if (printer ne config.Printers.noPrinter) traceIndented(question, show)(op)
+ else op
+
def traceIndented[T](question: => String, show: Boolean = false)(op: => T): T = {
def resStr(res: Any): String = res match {
case res: printing.Showable if show => res.show
@@ -142,6 +146,7 @@ trait Reporting { this: Context =>
}
traceIndented[T](s"==> $question?", (res: Any) => s"<== $question = ${resStr(res)}")(op)
}
+
def traceIndented[T](leading: => String, trailing: Any => String)(op: => T): T = {
var finalized = false
var logctx = this
@@ -218,7 +223,7 @@ abstract class Reporter {
def hasErrors = count(ERROR.level) > 0
def hasWarnings = count(WARNING.level) > 0
-
+
def errorCounts: Any = count.clone
def wasSilent[T](counts: Any): Boolean = {