diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-10-10 21:31:53 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-10-10 21:31:53 +0200 |
commit | 550c643a2a9ad785318e9a727ddc82e3e2f244aa (patch) | |
tree | 951f3198028ccde444aeffe10607214b0d6d24e9 /bridge/src | |
parent | d490f7d9ebe072b5ade305265100c7bc433885a9 (diff) | |
download | dotty-550c643a2a9ad785318e9a727ddc82e3e2f244aa.tar.gz dotty-550c643a2a9ad785318e9a727ddc82e3e2f244aa.tar.bz2 dotty-550c643a2a9ad785318e9a727ddc82e3e2f244aa.zip |
Adopt delegating reporter to new scheme
Diffstat (limited to 'bridge/src')
-rw-r--r-- | bridge/src/main/scala/xsbt/DelegatingReporter.scala | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bridge/src/main/scala/xsbt/DelegatingReporter.scala b/bridge/src/main/scala/xsbt/DelegatingReporter.scala index 726570d71..446ef287e 100644 --- a/bridge/src/main/scala/xsbt/DelegatingReporter.scala +++ b/bridge/src/main/scala/xsbt/DelegatingReporter.scala @@ -6,6 +6,8 @@ package xsbt import dotty.tools._ import dotc._ import reporting._ +import reporting.diagnostic.MessageContainer +import reporting.diagnostic.messages import core.Contexts._ import xsbti.{Maybe, Position} @@ -16,19 +18,19 @@ final class DelegatingReporter(delegate: xsbti.Reporter) extends Reporter override def printSummary(implicit ctx: Context): Unit = delegate.printSummary() - def doReport(d: Diagnostic)(implicit ctx: Context): Unit = { - val severity = - d match { - case _: Reporter.Error => xsbti.Severity.Error - case _: Reporter.Warning => xsbti.Severity.Warn + def doReport(cont: MessageContainer)(implicit ctx: Context): Unit = { + val severity = + cont match { + case _: messages.Error => xsbti.Severity.Error + case _: messages.Warning => xsbti.Severity.Warn case _ => xsbti.Severity.Info } - val pos = - if (d.pos.exists) Some(d.pos) + val pos = + if (cont.pos.exists) Some(cont.pos) else None - val file = - if (d.pos.source.file.exists) Option(d.pos.source.file.file) + val file = + if (cont.pos.source.file.exists) Option(cont.pos.source.file.file) else None val offset0 = pos.map(_.point) @@ -43,16 +45,16 @@ final class DelegatingReporter(delegate: xsbti.Reporter) extends Reporter def sourcePath: Maybe[String] = maybe(file.map(_.getPath)) } - delegate.log(position, d.message, severity) + delegate.log(position, cont.message, severity) } - private[this] def maybe[T](opt: Option[T]): Maybe[T] = opt match { + private[this] def maybe[T](opt: Option[T]): Maybe[T] = opt match { case None => Maybe.nothing[T] case Some(s) => Maybe.just[T](s) } import java.lang.{ Integer => I } - private[this] def maybeInt(opt: Option[Int]): Maybe[I] = opt match { + private[this] def maybeInt(opt: Option[Int]): Maybe[I] = opt match { case None => Maybe.nothing[I] case Some(s) => Maybe.just[I](s) } -}
\ No newline at end of file +} |