diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-23 12:26:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-23 12:28:05 +0200 |
commit | c90e09fc7bd79c3bf9c95ce87f3c11cb3dfd4405 (patch) | |
tree | 85ca8768f5d4544bf6c5940393a18abaf90b4a57 /src/dotty | |
parent | 625d7ad00d43fb77df55c1ace30db1e6ccdf6179 (diff) | |
download | dotty-c90e09fc7bd79c3bf9c95ce87f3c11cb3dfd4405.tar.gz dotty-c90e09fc7bd79c3bf9c95ce87f3c11cb3dfd4405.tar.bz2 dotty-c90e09fc7bd79c3bf9c95ce87f3c11cb3dfd4405.zip |
Changed Throwing reporting scheme.
Changed ThrowingReporter to use an underlying reporter for issuing messages below ERROR.
Made ThrowingReporters the default in initialContext.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TyperState.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 5 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/ThrowingReporter.scala | 4 |
5 files changed, 9 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 841b83376..761f7764e 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -320,7 +320,7 @@ object Contexts { outer = NoContext period = InitialPeriod mode = Mode.None - typerState = new TyperState(new ConsoleReporter()(this)) + typerState = new TyperState(new ThrowingReporter(new ConsoleReporter()(this))) printerFn = new RefinedPrinter(_) owner = NoSymbol sstate = settings.defaultState diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index fe39135d9..d0d517c19 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -368,7 +368,7 @@ object Symbols { * the class containing this symbol was generated, null if not applicable. * Overridden in ClassSymbol */ - def associatedFile(implicit ctx: Context): AbstractFile = + def associatedFile(implicit ctx: Context): AbstractFile = denot.topLevelClass.symbol.associatedFile /** The class file from which this class was generated, null if not applicable. */ diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index d14f6c24b..f7631fa22 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -11,7 +11,7 @@ import printing.{Showable, Printer} import printing.Texts._ import annotation.elidable -class TyperState(val reporter: Reporter = ThrowingReporter) extends DotClass with Showable { +class TyperState(val reporter: Reporter) extends DotClass with Showable { /** The current constraint set */ def constraint: Constraint = new Constraint(SimpleMap.Empty) diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 03249a082..9ef16d67a 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -127,7 +127,10 @@ trait Reporting { this: Context => if (this.settings.debug.value) warning(msg, pos) def debugTraceIndented[T](question: => String)(op: => T): T = - if (this.settings.debugTrace.value) traceIndented(question)(op) + conditionalTraceIndented(this.settings.debugTrace.value, question)(op) + + def conditionalTraceIndented[T](cond: Boolean, question: => String, show: Boolean = false)(op: => T): T = + if (cond) traceIndented(question, show)(op) else op def traceIndented[T](question: => String, show: Boolean = false)(op: => T): T = { diff --git a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala index f1ee8ddb7..d44a08fb6 100644 --- a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala +++ b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala @@ -9,7 +9,7 @@ import Reporter._ /** * This class implements a Reporter that stores all messages */ -object ThrowingReporter extends Reporter { +class ThrowingReporter(reportInfo: Reporter) extends Reporter { protected def doReport(d: Diagnostic)(implicit ctx: Context): Unit = - if (d.severity == ERROR) throw d else println(d) + if (d.severity == ERROR) throw d else reportInfo.report(d) } |