diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-17 22:25:47 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-19 15:53:47 +0100 |
commit | 09d02bd3670b947da147aec40835822d894b17b0 (patch) | |
tree | 01e81ad97df8b0e3e59cb72b3b77893e1d6f1070 /test/test/DottyTest.scala | |
parent | 5cbd2fbc8409b446f8751792b006693e1d091055 (diff) | |
download | dotty-09d02bd3670b947da147aec40835822d894b17b0.tar.gz dotty-09d02bd3670b947da147aec40835822d894b17b0.tar.bz2 dotty-09d02bd3670b947da147aec40835822d894b17b0.zip |
Allow MiniPhase to be DenotTransformer
All MiniPhases now as are full-fledged phases,
and are given their own periods and can register DenotTransformers.
MiniPhases belonging to same group(list) will be squashed to single phase.
Diffstat (limited to 'test/test/DottyTest.scala')
-rw-r--r-- | test/test/DottyTest.scala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/test/DottyTest.scala b/test/test/DottyTest.scala index ba67f14ce..fcc211175 100644 --- a/test/test/DottyTest.scala +++ b/test/test/DottyTest.scala @@ -41,15 +41,16 @@ class DottyTest { private def compilerWithChecker(phase: String)(assertion:(tpd.Tree, Context) => Unit) = new Compiler { override def phases = { val allPhases = super.phases - val targetPhase = allPhases.find{p=> p.name == phase} - assert(targetPhase isDefined) - val phasesBefore = allPhases.takeWhile(x=> ! (x eq targetPhase.get)) - - val checker = new Phase{ + val targetPhase = allPhases.flatten.find(p => p.name == phase).get + val groupsBefore = allPhases.takeWhile(x => !x.contains(targetPhase)) + val lastGroup = allPhases.find(x => x.contains(targetPhase)).get.takeWhile(x => !(x eq targetPhase)) + val checker = new Phase { def name = "assertionChecker" override def run(implicit ctx: Context): Unit = assertion(ctx.compilationUnit.tpdTree, ctx) } - phasesBefore:::List(targetPhase.get, checker) + val lastGroupAppended = List(lastGroup ::: targetPhase :: Nil) + + groupsBefore ::: lastGroupAppended ::: List(List(checker)) } } |