aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/ThrowingReporter.scala
blob: 25adc6a415fce2e042a5e3a0fe867072ddbbbbf4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package dotty.tools
package dotc
package reporting

import core.Contexts.Context
import collection.mutable
import diagnostic.Message
import Reporter._

/**
 * This class implements a Reporter that throws all errors and sends warnings and other
 * info to the underlying reporter.
 */
class ThrowingReporter(reportInfo: Reporter) extends Reporter {
  def doReport(m: Message)(implicit ctx: Context): Unit = m match {
    case _: Error => throw m
    case _ => reportInfo.doReport(m)
  }
}