summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/reporters/Reporter.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-02-09 15:25:31 +0000
committermichelou <michelou@epfl.ch>2007-02-09 15:25:31 +0000
commitcc20f5fbb5321eec19109355eb843545f3b0d453 (patch)
treec453865cd6c9836a7f47e51ce1e7e72572938bc8 /src/compiler/scala/tools/nsc/reporters/Reporter.scala
parent04cbd87417cc0a0ffae59e434cb8e129d8fbb0eb (diff)
downloadscala-cc20f5fbb5321eec19109355eb843545f3b0d453.tar.gz
scala-cc20f5fbb5321eec19109355eb843545f3b0d453.tar.bz2
scala-cc20f5fbb5321eec19109355eb843545f3b0d453.zip
minor changes in reporters/*.scala
Diffstat (limited to 'src/compiler/scala/tools/nsc/reporters/Reporter.scala')
-rw-r--r--src/compiler/scala/tools/nsc/reporters/Reporter.scala67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
index cbfab874e4..54690ba03b 100644
--- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
@@ -1,60 +1,61 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-\* */
-
+/* NSC -- new Scala compiler
+ * Copyright 2002-2007 LAMP/EPFL
+ * @author Martin Odersky
+ */
// $Id$
-package scala.tools.nsc.reporters;
-import scala.tools.nsc.util.Position;
+package scala.tools.nsc.reporters
+import scala.tools.nsc.util.Position
/**
* This interface provides methods to issue information, warning and
* error messages.
*/
abstract class Reporter {
- abstract class Severity(val code : Int);
- object INFO extends Severity(0);
- object WARNING extends Severity(1);
- object ERROR extends Severity(2);
+ abstract class Severity(val code: Int)
+ object INFO extends Severity(0)
+ object WARNING extends Severity(1)
+ object ERROR extends Severity(2)
- def reset : Unit = {
- errors = 0;
- warnings = 0;
+ def reset: Unit = {
+ errors = 0
+ warnings = 0
cancelled = false
}
- def count(severity : Severity): Int = severity match {
- case ERROR => errors;
- case WARNING => warnings;
- case INFO => 0;
+
+ def count(severity: Severity): Int = severity match {
+ case ERROR => errors
+ case WARNING => warnings
+ case INFO => 0
}
- def incr(severity : Severity): Unit = severity match {
- case ERROR => errors = errors + 1;
- case WARNING => warnings = warnings + 1;;
+
+ def incr(severity: Severity): Unit = severity match {
+ case ERROR => errors = errors + 1
+ case WARNING => warnings = warnings + 1
case INFO => {}
}
- var errors : Int = 0;
- var warnings : Int = 0;
+ var errors : Int = 0
+ var warnings : Int = 0
var cancelled: boolean = false
def hasErrors: boolean = errors != 0 || cancelled
- protected def info0(pos : Position, msg : String, severity : Severity, force : Boolean) : Unit;
+ protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean): Unit
- def info(pos : Position, msg : String, force : Boolean) : Unit = info0(pos, msg, INFO , force);
- def warning(pos : Position, msg : String ) : Unit = info0(pos, msg, WARNING, false);
- def error(pos : Position, msg : String ) : Unit = info0(pos, msg, ERROR, false);
+ def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO , force)
+ def warning(pos: Position, msg: String ): Unit = info0(pos, msg, WARNING, false)
+ def error(pos: Position, msg: String ): Unit = info0(pos, msg, ERROR, false)
/** An error that could possibly be fixed if the unit were longer.
- * This is used, for example, when the interpreter tries
- * to distinguish fatal errors from those that are due to
- * needing more lines of input from the user. */
- var incompleteInputError: ((Position,String) => Unit) = error
+ * This is used, for example, when the interpreter tries
+ * to distinguish fatal errors from those that are due to
+ * needing more lines of input from the user.
+ */
+ var incompleteInputError: (Position, String) => Unit = error
- def withIncompleteHandler[T](handler: ((Position,String) => Unit))(thunk: =>T) = {
+ def withIncompleteHandler[T](handler: (Position, String) => Unit)(thunk: => T) = {
val savedHandler = incompleteInputError
try {
incompleteInputError = handler