From 26b8ec48adec709cf2b07b470ada774c708e96a4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 29 Mar 2014 15:02:51 +0100 Subject: Adapting containsPhase to phase groups A list of names contains a phasegroup if it contains any phase in the group. --- src/dotty/tools/dotc/core/Decorators.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/Decorators.scala') diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala index cd9680e64..21f914d99 100644 --- a/src/dotty/tools/dotc/core/Decorators.scala +++ b/src/dotty/tools/dotc/core/Decorators.scala @@ -6,6 +6,7 @@ import Symbols._ import Contexts._, Names._, Phases._, printing.Texts._, printing.Printer import util.Positions.Position, util.SourcePosition import collection.mutable.ListBuffer +import dotty.tools.dotc.transform.TreeTransforms._ import scala.language.implicitConversions /** This object provides useful implicit decorators for types defined elsewhere */ @@ -127,8 +128,10 @@ object Decorators { * one of the names in the list of strings. */ implicit class PhaseListDecorator(val names: List[String]) extends AnyVal { - def containsPhase(phase: Phase) = - names exists (phase.name.startsWith) + def containsPhase(phase: Phase): Boolean = phase match { + case phase: TreeTransformer => phase.transformations.exists(containsPhase) + case _ => names exists (phase.name.startsWith) + } } implicit def sourcePos(pos: Position)(implicit ctx: Context): SourcePosition = -- cgit v1.2.3