aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-04 19:53:31 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-07 23:53:58 +0200
commit6d2a2b1dede589c2d3b183d5ac109cab9100d618 (patch)
treef31770e3241d0cd9dd8559e75fd4daa14544ca52 /src/dotty/tools/dotc/core/NameOps.scala
parentaf90fc5dd6606992763206929596bbcb6d5cba3c (diff)
downloaddotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.tar.gz
dotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.tar.bz2
dotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.zip
Produce expanded names.
In the absence of semantic names, this is kludgey. But we need to do it because otherwise the ExpandedName flag is not correctly set.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index 60e429bb3..13ff92a8a 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -147,20 +147,26 @@ object NameOps {
/** The superaccessor for method with given name */
def superName: TermName = (nme.SUPER_PREFIX ++ name).toTermName
- /** The expanded name of `name` relative to this class `base` with given `separator`
+ /** The expanded name of `name` relative to given class `base`.
*/
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 =
+ def expandedName(prefix: Name): N =
name.fromName(prefix ++ nme.EXPAND_SEPARATOR ++ name).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 expandedPrefix: N = {
+ val idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR)
+ assert(idx >= 0)
+ name.take(idx).asInstanceOf[N]
+ }
def shadowedName: N = likeTyped(nme.SHADOWED ++ name)