aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/SymUtils.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/transform/SymUtils.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/transform/SymUtils.scala')
-rw-r--r--src/dotty/tools/dotc/transform/SymUtils.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/transform/SymUtils.scala b/src/dotty/tools/dotc/transform/SymUtils.scala
index ba45d3f04..ffbc29785 100644
--- a/src/dotty/tools/dotc/transform/SymUtils.scala
+++ b/src/dotty/tools/dotc/transform/SymUtils.scala
@@ -69,4 +69,19 @@ class SymUtils(val self: Symbol) extends AnyVal {
/** `fullName` where `$' is the separator character */
def flatName(implicit ctx: Context): Name = self.fullNameSeparated('$')
+
+ /** The traits mixed into this class in linearization order.
+ * These are all inherited traits that are not also inherited by the superclass
+ */
+ def mixins(implicit ctx: Context): List[ClassSymbol] = {
+ val cls = self.asClass
+ val superCls = cls.classInfo.parents.head.symbol
+ cls.baseClasses.tail.takeWhile(_ ne superCls)
+ }
+
+ def initializer(implicit ctx: Context): TermSymbol =
+ self.owner.info.decl(InitializerName(self.asTerm.name)).symbol.asTerm
+
+ def isField(implicit ctx: Context): Boolean =
+ self.isTerm && !self.is(Method)
}