diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast/untpd.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/untpd.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala index e14c6714b..7020e4dac 100644 --- a/compiler/src/dotty/tools/dotc/ast/untpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala @@ -9,6 +9,7 @@ import Decorators._ import util.Property import language.higherKinds import collection.mutable.ListBuffer +import reflect.ClassTag object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { @@ -39,9 +40,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def withName(name: Name)(implicit ctx: Context) = cpy.ModuleDef(this)(name.toTermName, impl) } - /** mods case name impl */ - case class EnumDef(name: TypeName, impl: Template) extends MemberDef - case class ParsedTry(expr: Tree, handler: Tree, finalizer: Tree) extends TermTree case class SymbolLit(str: String) extends TermTree @@ -192,6 +190,10 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def hasFlags = flags != EmptyFlags def hasAnnotations = annotations.nonEmpty def hasPrivateWithin = privateWithin != tpnme.EMPTY + def hasMod[T: ClassTag] = { + val cls = implicitly[ClassTag[T]].runtimeClass + mods.exists(mod => cls.isAssignableFrom(mod.getClass)) + } } @sharable val EmptyModifiers: Modifiers = new Modifiers() |