diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Mirrors.scala | 2 | ||||
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 12 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index 27176a2a2d..fe4348d568 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -34,7 +34,7 @@ trait Mirrors { self: Universe => * that can be used to get and, if appropriate, set the value of the field. * * To get a field symbol by the name of the field you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the field>)).asTermSymbol`. + * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the field>)).asTermSymbol.accessed`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index 7a5db4a3f5..7ca1d9c7c6 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -185,6 +185,18 @@ trait Symbols extends base.Symbols { self: Universe => /** The overloaded alternatives of this symbol */ def alternatives: List[Symbol] + + /** Backing field for an accessor method, NoSymbol for all other term symbols. + */ + def accessed: Symbol + + /** Getter method for a backing field of a val or a val, NoSymbol for all other term symbols. + */ + def getter: Symbol + + /** Setter method for a backing field of a val or a val, NoSymbol for all other term symbols. + */ + def setter: Symbol } /** The API of type symbols */ diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 05ead8d1ac..8cf20ba062 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -84,6 +84,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => def getAnnotations: List[AnnotationInfo] = { initialize; annotations } def setAnnotations(annots: AnnotationInfo*): this.type = { setAnnotations(annots.toList); this } + def getter: Symbol = getter(owner) + def setter: Symbol = setter(owner) } /** The class for all symbols */ |