diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-06-10 09:44:24 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-07-04 15:26:54 +0200 |
commit | f2b76e80094219db1f72a7a56d02f21bab1fc9eb (patch) | |
tree | d4c7e7f4c41e57c9bba609ad0eb13409b570bca6 /src/compiler | |
parent | ffb0e25fc8ec9d6ecb0cd806bc534e9430e37bd4 (diff) | |
download | scala-f2b76e80094219db1f72a7a56d02f21bab1fc9eb.tar.gz scala-f2b76e80094219db1f72a7a56d02f21bab1fc9eb.tar.bz2 scala-f2b76e80094219db1f72a7a56d02f21bab1fc9eb.zip |
Pure refactor: reorder definitions
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/reporters/Reporter.scala | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index 766a35960b..1a8794d217 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -16,6 +16,29 @@ import scala.reflect.internal.util._ abstract class Reporter { protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean): Unit + /** Informational messages. If `!force`, they may be suppressed. */ + final def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force) + + /** For sending a message which should not be labeled as a warning/error, + * but also shouldn't require -verbose to be visible. + */ + def echo(msg: String): Unit = info(NoPosition, msg, force = true) + def echo(pos: Position, msg: String): Unit = info(pos, msg, force = true) + + /** Warnings and errors. */ + def warning(pos: Position, msg: String): Unit = info0(pos, msg, WARNING, force = false) + def error(pos: Position, msg: String): Unit = info0(pos, msg, ERROR, force = false) + + def flush(): Unit = { } + + // overridden by sbt, IDE + def reset(): Unit = { + INFO.count = 0 + WARNING.count = 0 + ERROR.count = 0 + cancelled = false + } + object severity extends Enumeration class Severity(val id: Int) extends severity.Value { var count: Int = 0 @@ -40,35 +63,21 @@ abstract class Reporter { } // used by sbt (via unit.cancel) to cancel a compile (see hasErrors) - var cancelled = false - def hasErrors = ERROR.count > 0 || cancelled - def hasWarnings = WARNING.count > 0 + var cancelled: Boolean = false - /** For sending a message which should not be labeled as a warning/error, - * but also shouldn't require -verbose to be visible. - */ - def echo(msg: String): Unit = info(NoPosition, msg, force = true) - def echo(pos: Position, msg: String): Unit = info(pos, msg, force = true) + // overridden by sbt + def hasErrors: Boolean = ERROR.count > 0 || cancelled - /** Informational messages. If `!force`, they may be suppressed. */ - final def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force) + // overridden by sbt + def hasWarnings: Boolean = WARNING.count > 0 - /** Warnings and errors. */ - def warning(pos: Position, msg: String): Unit = info0(pos, msg, WARNING, force = false) - def error(pos: Position, msg: String): Unit = info0(pos, msg, ERROR, force = false) + // TODO def incompleteInputError(pos: Position, msg: String): Unit = { if (incompleteHandled) incompleteHandler(pos, msg) else error(pos, msg) } - // overridden by sbt, IDE: - // `comment` is unrelated to reporting and should move out (IDE receives comments from ScaladocAnalyzer) - def comment(pos: Position, msg: String) {} - def flush() { } - def reset() { - INFO.count = 0 - ERROR.count = 0 - WARNING.count = 0 - cancelled = false - } + // overridden by sbt, IDE -- should move out of this interface + // it's unrelated to reporting (IDE receives comments from ScaladocAnalyzer) + def comment(pos: Position, msg: String): Unit = {} } |