aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-08 12:42:01 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:15:48 +0100
commit53a123064ffe437edc3d9e2f17530d3ce4e2b064 (patch)
treefe6ff2651a30a413a991998f6ae1cdd06d4c9c34 /src/dotty/tools/dotc/core/NameOps.scala
parentd572ec04a29d4bb70dccd5b01e205233d496d24d (diff)
downloaddotty-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.scala21
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