diff options
author | Martin Odersky <odersky@gmail.com> | 2011-02-07 12:45:57 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-02-07 12:45:57 +0000 |
commit | 2bfaf998adf7816f8a014fca13c86558180cbd73 (patch) | |
tree | 08132b6d81d219540e1414a1af1bbf84e2d7496a | |
parent | cd579b986641ed15687dfb5d665f2e67f656f7af (diff) | |
download | scala-2bfaf998adf7816f8a014fca13c86558180cbd73.tar.gz scala-2bfaf998adf7816f8a014fca13c86558180cbd73.tar.bz2 scala-2bfaf998adf7816f8a014fca13c86558180cbd73.zip |
Added missing file to last commit.
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Reporters.scala | 39 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/Power.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/reporters/Reporter.scala | 3 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Reporters.scala b/src/compiler/scala/tools/nsc/interactive/Reporters.scala new file mode 100644 index 0000000000..7538801b00 --- /dev/null +++ b/src/compiler/scala/tools/nsc/interactive/Reporters.scala @@ -0,0 +1,39 @@ +package scala.tools.nsc +package interactive + +import collection.mutable.ArrayBuffer +import util.Position +import reporters.Reporter + +trait Reporters { self: Global => + + case class Problem(pos: Position, msg: String, severity: Int) + + val otherProblems = new ArrayBuffer[Problem] + + class InteractiveReporter extends Reporter { + override def info0(pos: Position, msg: String, severity: Severity, force: Boolean): Unit = { + severity.count += 1 + val problems = + if (pos.isDefined) { + getUnit(pos.source) match { + case Some(unit) => + debugLog(pos.source.file.name + ":" + pos.line + ": " + msg) + unit.problems + case None => + debugLog(pos.source.file.name + "[not loaded] :" + pos.line + ": " + msg) + otherProblems + } + } else { + debugLog("[no position] :" + msg) + otherProblems + } + problems += Problem(pos, msg, severity.id) + } + + override def reset() { + super.reset() + otherProblems.clear() + } + } +}
\ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/interpreter/Power.scala b/src/compiler/scala/tools/nsc/interpreter/Power.scala index 7770f29a2e..8ad799a265 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Power.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Power.scala @@ -121,7 +121,7 @@ class Power(repl: ILoop, intp: IMain) { override def stopPhase(name: String) = name == "superaccessors" } - reporter.reset + reporter.reset() val run = new TyperRun run compileSources (code.toList.zipWithIndex map { case (s, i) => new BatchSourceFile("<console %d>".format(i), s) diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index cb8ef01ddd..e253a8f5f0 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -14,9 +14,8 @@ import scala.tools.nsc.util._ */ abstract class Reporter { object severity extends Enumeration - class Severity(_id: Int) extends severity.Value { + class Severity(val id: Int) extends severity.Value { var count: Int = 0 - def id = _id } val INFO = new Severity(0) val WARNING = new Severity(1) |