summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/Trees.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-27 16:30:01 -0800
committerPaul Phillips <paulp@improving.org>2012-01-28 00:43:06 -0800
commite61eff23df977eeed19bfe253b01b69cce47dfa3 (patch)
treeb4db063cc658a51142e03e4e5d1570c0d525321e /src/compiler/scala/reflect/internal/Trees.scala
parent0d0cdea28ec142a3e6da7a29b8130138a41ae782 (diff)
downloadscala-e61eff23df977eeed19bfe253b01b69cce47dfa3.tar.gz
scala-e61eff23df977eeed19bfe253b01b69cce47dfa3.tar.bz2
scala-e61eff23df977eeed19bfe253b01b69cce47dfa3.zip
Unsealed AnyVal.
Hacks here and there to allow them to survive at least to erasure. Since nothing is done with them there yet, they inevitably crash and burn a little ways beyond that.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Trees.scala')
-rw-r--r--src/compiler/scala/reflect/internal/Trees.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/scala/reflect/internal/Trees.scala b/src/compiler/scala/reflect/internal/Trees.scala
index 5bb0c98bfb..7ce087df2f 100644
--- a/src/compiler/scala/reflect/internal/Trees.scala
+++ b/src/compiler/scala/reflect/internal/Trees.scala
@@ -10,6 +10,18 @@ import Flags._
import api.Modifier
trait Trees extends api.Trees { self: SymbolTable =>
+
+ // Belongs in TreeInfo but then I can't reach it from TreePrinters.
+ def isReferenceToScalaMember(t: Tree, Id: Name) = t match {
+ case Ident(Id) => true
+ case Select(Ident(nme.scala_), Id) => true
+ case Select(Select(Ident(nme.ROOTPKG), nme.scala_), Id) => true
+ case _ => false
+ }
+ /** Is the tree Predef, scala.Predef, or _root_.scala.Predef?
+ */
+ def isReferenceToPredef(t: Tree) = isReferenceToScalaMember(t, nme.Predef)
+ def isReferenceToAnyVal(t: Tree) = isReferenceToScalaMember(t, tpnme.AnyVal)
// --- modifiers implementation ---------------------------------------