diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-08-27 16:30:01 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-27 16:30:01 +0200 |
commit | 33344651030213fe762bd81a66cf683d15a69b40 (patch) | |
tree | a71c994286fe451f9a17f07d90e55f1588e64c76 | |
parent | 9abf74be15672ce4ec1900a6b26fbf35cbce5866 (diff) | |
download | scala-33344651030213fe762bd81a66cf683d15a69b40.tar.gz scala-33344651030213fe762bd81a66cf683d15a69b40.tar.bz2 scala-33344651030213fe762bd81a66cf683d15a69b40.zip |
adds ClassSymbol.baseClasses
Sure this stuff is also declared in Type.baseClasses, but this is
one of the hot paths in reflection (e.g. like ClassSymbol.typeParams),
so I think it's justified to have it as a dedicated method.
Unfortunately we cannot remove Type.baseClasses, because it includes
ridiculously involved calculation of base classes for compound types.
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 6 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index 6aa37edc7f..132fa42670 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -386,6 +386,12 @@ trait Symbols extends base.Symbols { self: Universe => */ def knownDirectSubclasses: Set[Symbol] + /** The list of all base classes of this type (including its own typeSymbol) + * in reverse linearization order, starting with the class itself and ending + * in class Any. + */ + def baseClasses: List[Symbol] + /** If this symbol is a class or trait, its self type, otherwise the type * of the symbol itself. */ diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 8f99f42494..ecc7c001cc 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -75,6 +75,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => } def knownDirectSubclasses = children + def baseClasses = info.baseClasses def thisPrefix: Type = thisType def selfType: Type = typeOfThis def typeSignature: Type = info |