aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Compiler.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/Compiler.scala')
-rw-r--r--src/dotty/tools/dotc/Compiler.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala
index dcb5ba373..a14aa3655 100644
--- a/src/dotty/tools/dotc/Compiler.scala
+++ b/src/dotty/tools/dotc/Compiler.scala
@@ -7,7 +7,7 @@ import Periods._
import Symbols._
import Scopes._
import typer.{FrontEnd, Typer, Mode, ImportInfo, RefChecks}
-import reporting.{ConsoleReporter, Reporter}
+import reporting.{Reporter, ConsoleReporter}
import Phases.Phase
import dotty.tools.dotc.transform._
import dotty.tools.dotc.transform.TreeTransforms.{TreeTransform, TreeTransformer}
@@ -93,7 +93,7 @@ class Compiler {
* for type checking.
* imports For each element of RootImports, an import context
*/
- def rootContext(implicit ctx: Context, r: Option[Reporter] = None): Context = {
+ def rootContext(implicit ctx: Context): Context = {
ctx.definitions.init(ctx)
ctx.setPhasePlan(phases)
val rootScope = new MutableScope
@@ -105,20 +105,22 @@ class Compiler {
.setOwner(defn.RootClass)
.setTyper(new Typer)
.setMode(Mode.ImplicitsEnabled)
- .setTyperState(new MutableTyperState(ctx.typerState, r.getOrElse(new ConsoleReporter()(ctx)), isCommittable = true))
+ .setTyperState(new MutableTyperState(ctx.typerState, rootReporter(ctx), isCommittable = true))
ctx.definitions.init(start) // set context of definitions to start
def addImport(ctx: Context, symf: () => Symbol) =
ctx.fresh.setImportInfo(ImportInfo.rootImport(symf)(ctx))
(start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport)
}
+ protected def rootReporter(implicit ctx: Context): Reporter = new ConsoleReporter()(ctx)
+
def reset()(implicit ctx: Context): Unit = {
ctx.base.reset()
ctx.runInfo.clear()
}
- def newRun(implicit ctx: Context, r: Option[Reporter] = None): Run = {
+ def newRun(implicit ctx: Context): Run = {
reset()
- new Run(this)(rootContext(ctx, r))
+ new Run(this)(rootContext)
}
}