diff options
author | Dmitry Petrashko <dark@d-d.me> | 2014-11-09 19:10:21 +0100 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2014-11-09 19:10:21 +0100 |
commit | a9481bbb42d0439ba98a1bce33051e20c23f74b6 (patch) | |
tree | fbd0256698469faeafb81770586fda57a59c5f5a | |
parent | 4180bc3d3761a4087e081b9c5307a74742ae3a48 (diff) | |
parent | 3c595635d4c19b682e0cd5642d56f3b3352eb4db (diff) | |
download | dotty-a9481bbb42d0439ba98a1bce33051e20c23f74b6.tar.gz dotty-a9481bbb42d0439ba98a1bce33051e20c23f74b6.tar.bz2 dotty-a9481bbb42d0439ba98a1bce33051e20c23f74b6.zip |
Merge pull request #211 from dotty-staging/phase-runOn
Phase.runOn is now List[ComliplationUnit] => List[ComliplationUnit]
-rw-r--r-- | src/dotty/tools/dotc/Run.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Phases.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/FrontEnd.scala | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala index a9948c54a..f7d89e897 100644 --- a/src/dotty/tools/dotc/Run.scala +++ b/src/dotty/tools/dotc/Run.scala @@ -46,7 +46,7 @@ class Run(comp: Compiler)(implicit ctx: Context) { .filterNot(ctx.settings.Yskip.value.containsPhase(_)) // TODO: skip only subphase for (phase <- phasesToRun) if (!ctx.reporter.hasErrors) { - phase.runOn(units) + 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)) diff --git a/src/dotty/tools/dotc/core/Phases.scala b/src/dotty/tools/dotc/core/Phases.scala index 476ce6e55..348789e14 100644 --- a/src/dotty/tools/dotc/core/Phases.scala +++ b/src/dotty/tools/dotc/core/Phases.scala @@ -192,8 +192,12 @@ object Phases { def run(implicit ctx: Context): Unit - def runOn(units: List[CompilationUnit])(implicit ctx: Context): Unit = - for (unit <- units) run(ctx.fresh.setPhase(this).setCompilationUnit(unit)) + def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = + units.map { unit => + val unitCtx = ctx.fresh.setPhase(this).setCompilationUnit(unit) + run(unitCtx) + unitCtx.compilationUnit + } def description: String = phaseName diff --git a/src/dotty/tools/dotc/typer/FrontEnd.scala b/src/dotty/tools/dotc/typer/FrontEnd.scala index 4c5e2549b..4f3b03fa1 100644 --- a/src/dotty/tools/dotc/typer/FrontEnd.scala +++ b/src/dotty/tools/dotc/typer/FrontEnd.scala @@ -40,13 +40,14 @@ class FrontEnd extends Phase { record("retainedTypedTrees", unit.tpdTree.treeSize) } - override def runOn(units: List[CompilationUnit])(implicit ctx: Context): Unit = { + override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = { val unitContexts = units map (unit => ctx.fresh.setCompilationUnit(unit)) unitContexts foreach (parse(_)) record("parsedTrees", ast.Trees.ntrees) unitContexts foreach (enterSyms(_)) unitContexts foreach (typeCheck(_)) record("totalTrees", ast.Trees.ntrees) + unitContexts.map(_.compilationUnit) } override def run(implicit ctx: Context): Unit = { |