-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
amm/compiler/src/main/scala-2.13.12+/ammonite/compiler/MakeReporter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ammonite.compiler | ||
|
||
import ammonite.util.Classpath | ||
|
||
import scala.reflect.internal.util.{CodeAction, Position} | ||
import scala.reflect.io.FileZipArchive | ||
import scala.tools.nsc | ||
import scala.tools.nsc.classpath.{AggregateClassPath, ZipAndJarClassPathFactory} | ||
import scala.tools.nsc.{Global, Settings} | ||
import scala.tools.nsc.interactive.{InteractiveAnalyzer, Global => InteractiveGlobal} | ||
import scala.tools.nsc.plugins.Plugin | ||
import scala.tools.nsc.reporters.FilteringReporter | ||
import scala.tools.nsc.typechecker.Analyzer | ||
|
||
object MakeReporter { | ||
|
||
type Reporter = scala.tools.nsc.reporters.Reporter | ||
|
||
def makeReporter(errorLogger: (Position, String) => Unit, | ||
warningLogger: (Position, String) => Unit, | ||
infoLogger: (Position, String) => Unit, | ||
outerSettings: Settings): Reporter = | ||
new FilteringReporter { | ||
|
||
override | ||
def doReport(pos: scala.reflect.internal.util.Position, | ||
msg: String, | ||
severity: Severity, | ||
actions: List[CodeAction]): Unit = | ||
display(pos, msg, severity) | ||
|
||
def display(pos: Position, msg: String, severity: Severity) = | ||
severity match{ | ||
case ERROR => | ||
Classpath.traceClasspathProblem(s"ERROR: $msg") | ||
errorLogger(pos, msg) | ||
case WARNING => | ||
warningLogger(pos, msg) | ||
case INFO => | ||
infoLogger(pos, msg) | ||
} | ||
|
||
def settings = outerSettings | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters