aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/Reporter.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-02-03 21:12:37 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-02-04 19:25:33 +0100
commitd6a52eec2221101973c6b28f54aa20319f0e8b6f (patch)
tree50e4269a13b1949146617fa4542f0fb4762a594e /src/dotty/tools/dotc/reporting/Reporter.scala
parentcf1413bfc89308aa4b44aa1b76019c168c32a343 (diff)
downloaddotty-d6a52eec2221101973c6b28f54aa20319f0e8b6f.tar.gz
dotty-d6a52eec2221101973c6b28f54aa20319f0e8b6f.tar.bz2
dotty-d6a52eec2221101973c6b28f54aa20319f0e8b6f.zip
Reporter: make summary available without a Context
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index f98d85ce9..5ed7360da 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -247,12 +247,23 @@ abstract class Reporter {
incompleteHandler(d)(ctx)
- /** Print a summary */
- def printSummary(implicit ctx: Context): Unit = {
- if (warningCount > 0) ctx.println(countString(warningCount, "warning") + " found")
- if (errorCount > 0) ctx.println(countString(errorCount, "error") + " found")
+ /** Summary of warnings and errors */
+ def summary: String = {
+ val b = new mutable.ListBuffer[String]
+ if (warningCount > 0)
+ b += countString(warningCount, "warning") + " found"
+ if (errorCount > 0)
+ b += countString(errorCount, "error") + " found"
for ((settingName, count) <- unreportedWarnings)
- ctx.println(s"there were $count ${settingName.tail} warning(s); re-run with $settingName for details")
+ b += s"there were $count ${settingName.tail} warning(s); re-run with $settingName for details"
+ b.mkString("\n")
+ }
+
+ /** Print the summary of warnings and errors */
+ def printSummary(implicit ctx: Context): Unit = {
+ val s = summary
+ if (s != "")
+ ctx.println(s)
}
/** Returns a string meaning "n elements". */