diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-27 21:24:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-28 12:07:28 +0200 |
commit | 12f2ee7042c8f44a81afa54bdf261d4cd2a31b9c (patch) | |
tree | e46becdab2b8b1ec91a218e6f5091688f10b7e48 /src/dotty/tools/dotc/Run.scala | |
parent | dad799912e80377310d6f2408a78344dc2112d8b (diff) | |
download | dotty-12f2ee7042c8f44a81afa54bdf261d4cd2a31b9c.tar.gz dotty-12f2ee7042c8f44a81afa54bdf261d4cd2a31b9c.tar.bz2 dotty-12f2ee7042c8f44a81afa54bdf261d4cd2a31b9c.zip |
Compiler for embedded TASTY info.
`FromTasty` is a main module which compiles TASTY info instead of sources.
Diffstat (limited to 'src/dotty/tools/dotc/Run.scala')
-rw-r--r-- | src/dotty/tools/dotc/Run.scala | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala index af9c878f0..a008214c9 100644 --- a/src/dotty/tools/dotc/Run.scala +++ b/src/dotty/tools/dotc/Run.scala @@ -38,23 +38,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) = { |