aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Run.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2015-05-02 18:48:08 +0200
committerDmitry Petrashko <dark@d-d.me>2015-05-02 18:48:08 +0200
commitac46a0e4489bba4f76863cc1491bf2b8441ed1cb (patch)
tree35cb0aa59d10931f6201f1069d70172a43228a86 /src/dotty/tools/dotc/Run.scala
parent2dbabca38cee0ff27c92a9a7079959b2461c9869 (diff)
parent10a5f9198f03ae5b8dc54f1113f98da585c4e81a (diff)
downloaddotty-ac46a0e4489bba4f76863cc1491bf2b8441ed1cb.tar.gz
dotty-ac46a0e4489bba4f76863cc1491bf2b8441ed1cb.tar.bz2
dotty-ac46a0e4489bba4f76863cc1491bf2b8441ed1cb.zip
Merge pull request #507 from dotty-staging/add/from-tasty
Compile from Tasty
Diffstat (limited to 'src/dotty/tools/dotc/Run.scala')
-rw-r--r--src/dotty/tools/dotc/Run.scala30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala
index 3d4cd988e..c99f5efb9 100644
--- a/src/dotty/tools/dotc/Run.scala
+++ b/src/dotty/tools/dotc/Run.scala
@@ -43,23 +43,25 @@ class Run(comp: Compiler)(implicit ctx: Context) {
* or we need to assmeble phases on each run, and take -Yskip, -Ystop into
* account. I think the latter would be preferable.
*/
- def compileSources(sources: List[SourceFile]) = Stats.monitorHeartBeat {
+ def compileSources(sources: List[SourceFile]) =
if (sources forall (_.exists)) {
- val phases = ctx.squashPhases(ctx.phasePlan,
- ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, ctx.settings.YstopAfter.value, ctx.settings.Ycheck.value)
- ctx.usePhases(phases)
units = sources map (new CompilationUnit(_))
- for (phase <- ctx.allPhases)
- if (!ctx.reporter.hasErrors) {
- if (ctx.settings.verbose.value) println(s"[$phase]")
- units = phase.runOn(units)
- def foreachUnit(op: Context => Unit)(implicit ctx: Context): Unit =
- for (unit <- units) op(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))
- if (ctx.settings.Xprint.value.containsPhase(phase))
- foreachUnit(printTree)
-
- }
+ compileUnits()
}
+
+ protected def compileUnits() = Stats.monitorHeartBeat {
+ val phases = ctx.squashPhases(ctx.phasePlan,
+ ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, ctx.settings.YstopAfter.value, ctx.settings.Ycheck.value)
+ ctx.usePhases(phases)
+ for (phase <- ctx.allPhases)
+ if (!ctx.reporter.hasErrors) {
+ if (ctx.settings.verbose.value) println(s"[$phase]")
+ units = phase.runOn(units)
+ def foreachUnit(op: Context => Unit)(implicit ctx: Context): Unit =
+ for (unit <- units) op(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))
+ if (ctx.settings.Xprint.value.containsPhase(phase))
+ foreachUnit(printTree)
+ }
}
private def printTree(ctx: Context) = {