aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-10-31 17:20:50 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-09 19:08:58 +0100
commit31d299451204fe7feddb392f54d2fc2d6463fe2e (patch)
tree95ec82cc8f78a6e7698bccab39faba977c3fa270 /src/dotty/tools/dotc/core/NameOps.scala
parent3da54484efe76e578da17c447086f894869b9140 (diff)
downloaddotty-31d299451204fe7feddb392f54d2fc2d6463fe2e.tar.gz
dotty-31d299451204fe7feddb392f54d2fc2d6463fe2e.tar.bz2
dotty-31d299451204fe7feddb392f54d2fc2d6463fe2e.zip
First version of mixin transform.
Needs adaptations in getters/setters before it can be tested.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index beb3142d3..752d9bcea 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -47,13 +47,15 @@ object NameOps {
}
}
- object SuperAccessorName {
- val pre = nme.SUPER_PREFIX
+ class PrefixNameExtractor(pre: TermName) {
def apply(name: TermName): TermName = pre ++ name
def unapply(name: TermName): Option[TermName] =
if (name startsWith pre) Some(name.drop(pre.length).asTermName) else None
}
+ object SuperAccessorName extends PrefixNameExtractor(nme.SUPER_PREFIX)
+ object InitializerName extends PrefixNameExtractor(nme.INITIALIZER_PREFIX)
+
implicit class NameDecorator[N <: Name](val name: N) extends AnyVal {
import nme._