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 | |
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')
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 21 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/ClassfileParser.scala | 2 |
3 files changed, 14 insertions, 11 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 diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 4ededf796..44629c036 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -271,7 +271,7 @@ object SymDenotations { /** The name with which the denoting symbol was created */ final def originalName(implicit ctx: Context) = { val d = initial.asSymDenotation - if (d is ExpandedName) d.name.unexpandedName() else d.name // !!!DEBUG, was: effectiveName + if (d is ExpandedName) d.name.unexpandedName else d.name // !!!DEBUG, was: effectiveName } /** The encoded full path name of this denotation, where outer names and inner names diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala index ed3eb7251..3b8daab39 100644 --- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala +++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala @@ -139,7 +139,7 @@ class ClassfileParser( var sym = classRoot.owner while (sym.isClass && !(sym is Flags.ModuleClass)) { for (tparam <- sym.typeParams) { - classTParams = classTParams.updated(tparam.name.unexpandedName(), tparam) + classTParams = classTParams.updated(tparam.name.unexpandedName, tparam) } sym = sym.owner } |