diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-02 10:08:08 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-02 10:08:08 -0700 |
commit | e556abb524c9ca64f9b241fa07f40aa902594c66 (patch) | |
tree | 9f745c6662903683bf645da0e68ad3bbfea4287f /src/reflect/scala/reflect/api/Symbols.scala | |
parent | 2b707ee99bbb44447315874d360c498aac4c3089 (diff) | |
parent | 23cf705ba64641a3ba45e84984702cf97cdd0ccf (diff) | |
download | scala-e556abb524c9ca64f9b241fa07f40aa902594c66.tar.gz scala-e556abb524c9ca64f9b241fa07f40aa902594c66.tar.bz2 scala-e556abb524c9ca64f9b241fa07f40aa902594c66.zip |
Merge pull request #1202 from scalamacros/topic/reflection
further polishing of reflection
Diffstat (limited to 'src/reflect/scala/reflect/api/Symbols.scala')
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index b17377795b..d167099979 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -15,9 +15,10 @@ trait Symbols extends base.Symbols { self: Universe => /** The API of symbols */ trait SymbolApi extends SymbolBase { this: Symbol => - /** The position of this symbol + /** Source file if this symbol is created during this compilation run, + * or a class file if this symbol is loaded from a *.class or *.jar. */ - def pos: Position + def associatedFile: scala.tools.nsc.io.AbstractFile /** A list of annotations attached to this Symbol. */ @@ -182,6 +183,10 @@ trait Symbols extends base.Symbols { self: Universe => */ def isSpecialized: Boolean + /** Is this symbol defined by Java? + */ + def isJava: Boolean + /******************* helpers *******************/ /** ... @@ -204,16 +209,16 @@ trait Symbols extends base.Symbols { self: Universe => /** The API of term symbols */ trait TermSymbolApi extends SymbolApi with TermSymbolBase { this: TermSymbol => - /** Does this symbol represent a value, i.e. not a module and not a method? + /** Is this symbol introduced as `val`? */ - def isValue: Boolean + def isVal: Boolean /** Does this symbol denote a stable value? */ def isStable: Boolean - /** Does this symbol represent a mutable value? + /** Is this symbol introduced as `var`? */ - def isVariable: Boolean + def isVar: Boolean /** Does this symbol represent a getter or a setter? */ @@ -320,6 +325,9 @@ trait Symbols extends base.Symbols { self: Universe => */ def isConstructor: Boolean + /** Does this symbol denote the primary constructor of its enclosing class? */ + def isPrimaryConstructor: Boolean + /** For a polymorphic method, its type parameters, the empty list for all other methods */ def typeParams: List[Symbol] @@ -378,6 +386,22 @@ trait Symbols extends base.Symbols { self: Universe => */ def isSealed: Boolean + /** If this is a sealed class, its known direct subclasses. + * Otherwise, the empty set. + */ + 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] + + /** The module corresponding to this module class, + * or NoSymbol if this symbol is not a module class. + */ + def module: Symbol + /** If this symbol is a class or trait, its self type, otherwise the type * of the symbol itself. */ |