aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Compiler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-15 17:12:01 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-29 09:01:01 +0200
commit24825d6862a137f69cf2e6687742173b01cc79c7 (patch)
tree74a3032aeddeaf4d73628c2d9fc68045aba5f66c /src/dotty/tools/dotc/Compiler.scala
parent6beb1b402f84d4a3f3096a1fca2f71b69fb03c1a (diff)
downloaddotty-24825d6862a137f69cf2e6687742173b01cc79c7.tar.gz
dotty-24825d6862a137f69cf2e6687742173b01cc79c7.tar.bz2
dotty-24825d6862a137f69cf2e6687742173b01cc79c7.zip
Make reporter ised in Compiler configurable
Not needed right now, but will be useful later.
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 e9b0a9676..6e2cab40d 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}
@@ -94,7 +94,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
@@ -106,20 +106,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)
}
}