diff options
author | Martin Odersky <odersky@gmail.com> | 2011-11-15 18:33:07 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-11-15 18:33:07 +0000 |
commit | 8a64ed85b9a63fd08c13f6730f038ba233d27fb6 (patch) | |
tree | 02770db6dbae39192acd196205b9c45bb0df017a /src/compiler/scala/reflect/internal/Symbols.scala | |
parent | 7abc466d64681ea7f2610068702019fee66b0579 (diff) | |
download | scala-8a64ed85b9a63fd08c13f6730f038ba233d27fb6.tar.gz scala-8a64ed85b9a63fd08c13f6730f038ba233d27fb6.tar.bz2 scala-8a64ed85b9a63fd08c13f6730f038ba233d27fb6.zip |
Towards better reflection APIs.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index a49a5ebd1e..89183b99c7 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -41,9 +41,24 @@ trait Symbols extends api.Symbols { self: SymbolTable => */ val originalOwner = perRunCaches.newMap[Symbol, Symbol]() + abstract class AbsSymbolImpl extends AbsSymbol { this: Symbol => + def newNestedSymbol(pos: Position, name: Name) = name match { + case n: TermName => newValue(pos, n) + case n: TypeName => newAliasType(pos, n) + } + def typeSig: Type = info + def typeSigIn(site: Type): Type = site.memberInfo(this) + def asType: Type = tpe + def asTypeIn(site: Type): Type = site.memberType(this) + def asTypeConstructor: Type = typeConstructor + def setInternalFlags(flag: Long): this.type = { setFlag(flag); this } + def setTypeSig(tpe: Type): this.type = { setInfo(tpe); this } + def setAnnotations(annots: AnnotationInfo*): this.type = { setAnnotations(annots.toList); this } + } + /** The class for all symbols */ abstract class Symbol(initOwner: Symbol, initPos: Position, initName: Name) - extends AbsSymbol + extends AbsSymbolImpl with HasFlags with Annotatable[Symbol] { |