aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-12 16:47:03 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-12 16:47:03 +0200
commit682cf32cbe5cebeccf9ea10caf43e74c9cecc7c0 (patch)
treed57f8e191ec41dcd019333fae68616b25ce7f1a0 /src/dotty/tools/dotc/core
parent1cf91fa7b14b62b6ba67971b29046631efbecd83 (diff)
downloaddotty-682cf32cbe5cebeccf9ea10caf43e74c9cecc7c0.tar.gz
dotty-682cf32cbe5cebeccf9ea10caf43e74c9cecc7c0.tar.bz2
dotty-682cf32cbe5cebeccf9ea10caf43e74c9cecc7c0.zip
Added utility methods for TermRefs.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 55390de5a..9c0a0ff49 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1256,8 +1256,14 @@ object Types {
abstract case class TermRef(override val prefix: Type, name: TermName) extends NamedType with SingletonType {
def isOverloaded(implicit ctx: Context) = denot.isOverloaded
- def alternatives(implicit ctx: Context) =
- denot.alternatives map (TermRef(prefix, name).withDenot(_))
+
+ private def rewrap(sd: SingleDenotation)(implicit ctx: Context) =
+ TermRef(prefix, name) withDenot sd
+
+ def alternatives(implicit ctx: Context): List[TermRef] =
+ denot.alternatives map rewrap
+ def altsWith(p: Symbol => Boolean)(implicit ctx: Context): List[TermRef] =
+ denot.altsWith(p) map rewrap
}
abstract case class TypeRef(override val prefix: Type, name: TypeName) extends NamedType