From 10292e4acbb8eb0143a5a087c750ed9699f31807 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 5 Jun 2012 17:41:47 +0200 Subject: de-duplicate isUncheckedAnnotation/isSwitchAnnotation --- src/reflect/scala/reflect/internal/TreeInfo.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/reflect') diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index 4b2105876d..698d219634 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -326,6 +326,12 @@ abstract class TreeInfo { case _ => false } + /** a Match(Typed(_, tpt), _) is unchecked if isUncheckedAnnotation(tpt.tpe) */ + def isUncheckedAnnotation(tpe: Type) = tpe hasAnnotation definitions.UncheckedClass + + /** a Match(Typed(_, tpt), _) must be translated into a switch if isSwitchAnnotation(tpt.tpe) */ + def isSwitchAnnotation(tpe: Type) = tpe hasAnnotation definitions.SwitchClass + /** can this type be a type pattern */ def mayBeTypePat(tree: Tree): Boolean = tree match { case CompoundTypeTree(Template(tps, _, Nil)) => tps exists mayBeTypePat -- cgit v1.2.3