diff options
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index 81c718e65c..8175040a76 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -1317,8 +1317,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** The symbol accessed by this accessor function, but with given owner type. */ final def accessed(ownerTp: Type): Symbol = { - assert(hasAccessorFlag) - ownerTp.decl(nme.getterToLocal(if (isSetter) nme.setterToGetter(name) else name)) + assert(hasAccessorFlag, this) + ownerTp decl nme.getterToLocal(getterName) } /** The module corresponding to this module class (note that this @@ -1349,6 +1349,9 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** If this is a lazy value, the lazy accessor; otherwise this symbol. */ def lazyAccessorOrSelf: Symbol = if (isLazy) lazyAccessor else this + /** If this is an accessor, the accessed symbol. Otherwise, this symbol. */ + def accessedOrSelf: Symbol = if (hasAccessorFlag) accessed else this + /** For an outer accessor: The class from which the outer originates. * For all other symbols: NoSymbol */ @@ -1646,10 +1649,9 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** The getter of this value or setter definition in class `base`, or NoSymbol if * none exists. */ - final def getter(base: Symbol): Symbol = { - val getterName = if (isSetter) nme.setterToGetter(name) else nme.getterName(name) - base.info.decl(getterName) filter (_.hasAccessorFlag) - } + final def getter(base: Symbol): Symbol = base.info.decl(getterName) filter (_.hasAccessorFlag) + + def getterName = if (isSetter) nme.setterToGetter(name) else nme.getterName(name) /** The setter of this value or getter definition, or NoSymbol if none exists */ final def setter(base: Symbol): Symbol = setter(base, false) |