aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-29 11:09:15 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-01 15:04:43 +0200
commit11848a8c620be514ea43ea4383ca2b91a1aa8627 (patch)
tree7580172685433e61897b4af228c5aff181516d56 /src/dotty/tools/dotc/core/NameOps.scala
parent069010b36cdad9cbaaf2d48e70b17e08ee5eb224 (diff)
downloaddotty-11848a8c620be514ea43ea4383ca2b91a1aa8627.tar.gz
dotty-11848a8c620be514ea43ea4383ca2b91a1aa8627.tar.bz2
dotty-11848a8c620be514ea43ea4383ca2b91a1aa8627.zip
New NameOps methods for Scala2 traits
Also: generalize expandedName so that it can cater for trait setters.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index bf5e219cf..dc94f6db1 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -155,13 +155,17 @@ object NameOps {
/** 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("$"))
+ def expandedName(base: Symbol, separator: Name)(implicit ctx: Context): N =
+ expandedName(if (base is Flags.ExpandedName) base.name else base.fullNameSeparated("$"), separator)
+
+ def expandedName(base: Symbol)(implicit ctx: Context): N = expandedName(base, nme.EXPAND_SEPARATOR)
/** The expanded name of `name` relative to `basename` with given `separator`
*/
- def expandedName(prefix: Name): N =
- name.fromName(prefix ++ nme.EXPAND_SEPARATOR ++ name).asInstanceOf[N]
+ def expandedName(prefix: Name, separator: Name = nme.EXPAND_SEPARATOR): N =
+ name.fromName(prefix ++ separator ++ name).asInstanceOf[N]
+
+ def expandedName(prefix: Name): N = expandedName(prefix, nme.EXPAND_SEPARATOR)
def unexpandedName: N = {
val idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR)
@@ -178,6 +182,8 @@ object NameOps {
def revertShadowed: N = likeTyped(name.drop(nme.SHADOWED.length))
+ def implClassName: N = likeTyped(name ++ tpnme.IMPL_CLASS_SUFFIX)
+
/** Translate a name into a list of simple TypeNames and TermNames.
* In all segments before the last, type/term is determined by whether
* the following separator char is '.' or '#'. The last segment