aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
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
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')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala6
-rw-r--r--src/dotty/tools/dotc/core/StdNames.scala3
2 files changed, 6 insertions, 3 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._
diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala
index 99290f084..80b9a7c37 100644
--- a/src/dotty/tools/dotc/core/StdNames.scala
+++ b/src/dotty/tools/dotc/core/StdNames.scala
@@ -121,7 +121,8 @@ object StdNames {
val SUPER_PREFIX: N = "super$"
val TRAIT_SETTER_PREFIX: N = "_setter_$"
val WHILE_PREFIX: N = "while$"
- val DEFAULT_EXCEPTION_NAME: N = "ex$"
+ val DEFAULT_EXCEPTION_NAME: N = "ex$"
+ val INITIALIZER_PREFIX: N = "initial$"
// value types (and AnyRef) are all used as terms as well
// as (at least) arguments to the @specialize annotation.