From d551188a1d38754760a738d4c064156d7e1b5f89 Mon Sep 17 00:00:00 2001 From: Philippe Suter <philippe.suter@gmail.com> Date: Wed, 30 Mar 2011 23:33:13 +0000 Subject: [PATCH] more defaults in reporters. --- src/purescala/Reporter.scala | 38 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/purescala/Reporter.scala b/src/purescala/Reporter.scala index a9bb02141..c8e0c485b 100644 --- a/src/purescala/Reporter.scala +++ b/src/purescala/Reporter.scala @@ -9,15 +9,15 @@ abstract class Reporter { def info(msg: Any) : Unit def fatalError(msg: Any) : Nothing - def error(definition: Definition, msg: Any) : Unit - def warning(definition: Definition, msg: Any) : Unit - def info(definition: Definition, msg: Any) : Unit - def fatalError(definition: Definition, msg: Any) : Nothing - - def error(expr: Expr, msg: Any) : Unit - def warning(expr: Expr, msg: Any) : Unit - def info(expr: Expr, msg: Any) : Unit - def fatalError(expr: Expr, msg: Any) : Nothing + def error(definition: Definition, msg: Any) : Unit = error(msg) + def warning(definition: Definition, msg: Any) : Unit = warning(msg) + def info(definition: Definition, msg: Any) : Unit = info(msg) + def fatalError(definition: Definition, msg: Any) : Nothing = fatalError(msg) + + def error(expr: Expr, msg: Any) : Unit = error(msg) + def warning(expr: Expr, msg: Any) : Unit = warning(msg) + def info(expr: Expr, msg: Any) : Unit = info(msg) + def fatalError(expr: Expr, msg: Any) : Nothing = fatalError(msg) } class DefaultReporter extends Reporter { @@ -44,21 +44,17 @@ class DefaultReporter extends Reporter { def warning(msg: Any) = output(reline(warningPfx, msg.toString)) def info(msg: Any) = output(reline(infoPfx, msg.toString)) def fatalError(msg: Any) = { output(reline(fatalPfx, msg.toString)); exit(0) } - def error(definition: Definition, msg: Any) = output(reline(errorPfx, PrettyPrinter(definition) + "\n" + msg.toString)) - def warning(definition: Definition, msg: Any) = output(reline(warningPfx, PrettyPrinter(definition) + "\n" + msg.toString)) - def info(definition: Definition, msg: Any) = output(reline(infoPfx, PrettyPrinter(definition) + "\n" + msg.toString)) - def fatalError(definition: Definition, msg: Any) = { output(reline(fatalPfx, PrettyPrinter(definition) + "\n" + msg.toString)); exit(0) } - def error(expr: Expr, msg: Any) = output(reline(errorPfx, PrettyPrinter(expr) + "\n" + msg.toString)) - def warning(expr: Expr, msg: Any) = output(reline(warningPfx, PrettyPrinter(expr) + "\n" + msg.toString)) - def info(expr: Expr, msg: Any) = output(reline(infoPfx, PrettyPrinter(expr) + "\n" + msg.toString)) - def fatalError(expr: Expr, msg: Any) = { output(reline(fatalPfx, PrettyPrinter(expr) + "\n" + msg.toString)); exit(0) } + override def error(definition: Definition, msg: Any) = output(reline(errorPfx, PrettyPrinter(definition) + "\n" + msg.toString)) + override def warning(definition: Definition, msg: Any) = output(reline(warningPfx, PrettyPrinter(definition) + "\n" + msg.toString)) + override def info(definition: Definition, msg: Any) = output(reline(infoPfx, PrettyPrinter(definition) + "\n" + msg.toString)) + override def fatalError(definition: Definition, msg: Any) = { output(reline(fatalPfx, PrettyPrinter(definition) + "\n" + msg.toString)); exit(0) } + override def error(expr: Expr, msg: Any) = output(reline(errorPfx, PrettyPrinter(expr) + "\n" + msg.toString)) + override def warning(expr: Expr, msg: Any) = output(reline(warningPfx, PrettyPrinter(expr) + "\n" + msg.toString)) + override def info(expr: Expr, msg: Any) = output(reline(infoPfx, PrettyPrinter(expr) + "\n" + msg.toString)) + override def fatalError(expr: Expr, msg: Any) = { output(reline(fatalPfx, PrettyPrinter(expr) + "\n" + msg.toString)); exit(0) } } class QuietReporter extends DefaultReporter { override def warning(msg: Any) = {} override def info(msg: Any) = {} - override def warning(definition: Definition, msg: Any) = {} - override def info(definition: Definition, msg: Any) = {} - override def warning(expr: Expr, msg: Any) = {} - override def info(expr: Expr, msg: Any) = {} } -- GitLab