summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-05 17:41:47 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:35:04 +0200
commit10292e4acbb8eb0143a5a087c750ed9699f31807 (patch)
tree894a8cc7feda82bf802bdfa556a0fe41c21bf2d2 /src/reflect
parentb31c6d4f778df6b415c605a468b155cea0b84a16 (diff)
downloadscala-10292e4acbb8eb0143a5a087c750ed9699f31807.tar.gz
scala-10292e4acbb8eb0143a5a087c750ed9699f31807.tar.bz2
scala-10292e4acbb8eb0143a5a087c750ed9699f31807.zip
de-duplicate isUncheckedAnnotation/isSwitchAnnotation
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/TreeInfo.scala6
1 files changed, 6 insertions, 0 deletions
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