aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Names.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-01 18:51:11 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:12 +0200
commit2bfb2ca70c4588de00c12feba79ef7c0d68361a5 (patch)
tree541a5cfc4fb13e6811fe2d85a84d2a3bea501a88 /compiler/src/dotty/tools/dotc/core/Names.scala
parente4780e574f9613346e6908f7947f40a58327e376 (diff)
downloaddotty-2bfb2ca70c4588de00c12feba79ef7c0d68361a5.tar.gz
dotty-2bfb2ca70c4588de00c12feba79ef7c0d68361a5.tar.bz2
dotty-2bfb2ca70c4588de00c12feba79ef7c0d68361a5.zip
Introduce mangled method
Mangled is like toSimpleName, except that it keeps the term/type distinction.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Names.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Names.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala
index 352fa6b6b..6caba33ec 100644
--- a/compiler/src/dotty/tools/dotc/core/Names.scala
+++ b/compiler/src/dotty/tools/dotc/core/Names.scala
@@ -66,6 +66,8 @@ object Names {
def isSimple: Boolean
def asSimpleName: SimpleTermName
def toSimpleName: SimpleTermName
+ def mangled: Name
+
def rewrite(f: PartialFunction[Name, Name]): ThisName
def collect[T](f: PartialFunction[Name, T]): Option[T]
def mapLast(f: SimpleTermName => SimpleTermName): ThisName
@@ -263,6 +265,8 @@ object Names {
def isSimple = true
def asSimpleName = this
def toSimpleName = this
+ def mangled = this
+
def rewrite(f: PartialFunction[Name, Name]): ThisName =
if (f.isDefinedAt(this)) likeSpaced(f(this)) else this
def collect[T](f: PartialFunction[Name, T]): Option[T] = f.lift(this)
@@ -306,6 +310,8 @@ object Names {
def isSimple = toTermName.isSimple
def asSimpleName = toTermName.asSimpleName
def toSimpleName = toTermName.toSimpleName
+ def mangled = toTermName.toSimpleName.toTypeName
+
def rewrite(f: PartialFunction[Name, Name]): ThisName = toTermName.rewrite(f).toTypeName
def collect[T](f: PartialFunction[Name, T]): Option[T] = toTermName.collect(f)
def mapLast(f: SimpleTermName => SimpleTermName) = toTermName.mapLast(f).toTypeName
@@ -345,6 +351,7 @@ object Names {
if (simpleName == null) simpleName = termName(toString)
simpleName
}
+ def mangled = toSimpleName
def rewrite(f: PartialFunction[Name, Name]): ThisName =
if (f.isDefinedAt(this)) likeSpaced(f(this))