aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Compiler.scala
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2015-06-29 10:05:41 +0200
committerodersky <odersky@gmail.com>2015-06-29 10:05:41 +0200
commitbf6d805103f8d859c98f09e2dc12fe8f48208597 (patch)
tree977554b896de3dd869bc95ac697091406c6c102b /src/dotty/tools/dotc/Compiler.scala
parent68b4e6ce51ee8b4981d8a8369d84a45bba8a237c (diff)
parent840aa9354a9708548cf0e21be08a552403851c97 (diff)
downloaddotty-bf6d805103f8d859c98f09e2dc12fe8f48208597.tar.gz
dotty-bf6d805103f8d859c98f09e2dc12fe8f48208597.tar.bz2
dotty-bf6d805103f8d859c98f09e2dc12fe8f48208597.zip
Merge pull request #662 from dotty-staging/add/resident-compiler
Add/resident compiler
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)
}
}