diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-08 12:42:01 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:15:48 +0100 |
commit | 53a123064ffe437edc3d9e2f17530d3ce4e2b064 (patch) | |
tree | fe6ff2651a30a413a991998f6ae1cdd06d4c9c34 /src/dotty/tools/dotc/core/NameOps.scala | |
parent | d572ec04a29d4bb70dccd5b01e205233d496d24d (diff) | |
download | dotty-53a123064ffe437edc3d9e2f17530d3ce4e2b064.tar.gz dotty-53a123064ffe437edc3d9e2f17530d3ce4e2b064.tar.bz2 dotty-53a123064ffe437edc3d9e2f17530d3ce4e2b064.zip |
Drop choice of separator in expanded name.
It's not used and is too low-level anyway. Expanded names should
be a semantic concept, the choice of separator is irrelevant.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index a003b4329..60e429bb3 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -149,14 +149,17 @@ object NameOps { /** The expanded name of `name` relative to this class `base` with given `separator` */ - def expandedName(base: Symbol, separator: Name = nme.EXPAND_SEPARATOR)(implicit ctx: Context): N = { - val prefix = if (base is Flags.ExpandedName) base.name else base.fullNameSeparated('$') - name.fromName(prefix ++ separator ++ name).asInstanceOf[N] - } + def expandedName(base: Symbol)(implicit ctx: Context): N = + expandedName(if (base is Flags.ExpandedName) base.name else base.fullNameSeparated('$')) + + /** The expanded name of `name` relative to `basename` with given `separator` + */ + def expandedName(prefix: Name)(implicit ctx: Context): N = + name.fromName(prefix ++ nme.EXPAND_SEPARATOR ++ name).asInstanceOf[N] - def unexpandedName(separator: Name = nme.EXPAND_SEPARATOR): N = { - val idx = name.lastIndexOfSlice(separator) - if (idx < 0) name else (name drop (idx + separator.length)).asInstanceOf[N] + def unexpandedName: N = { + val idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR) + if (idx < 0) name else (name drop (idx + nme.EXPAND_SEPARATOR.length)).asInstanceOf[N] } def shadowedName: N = likeTyped(nme.SHADOWED ++ name) @@ -289,11 +292,11 @@ object NameOps { /** The name of an accessor for protected symbols. */ def protectedAccessorName: TermName = - PROTECTED_PREFIX ++ name.unexpandedName() + PROTECTED_PREFIX ++ name.unexpandedName /** The name of a setter for protected symbols. Used for inherited Java fields. */ def protectedSetterName: TermName = - PROTECTED_SET_PREFIX ++ name.unexpandedName() + PROTECTED_SET_PREFIX ++ name.unexpandedName def moduleVarName: TermName = name ++ MODULE_VAR_SUFFIX |