aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-27 10:08:59 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:10 +0200
commit0698383d595fec40c70905eb0e06b430f93ba0b8 (patch)
tree03a44262dd7529370da08e7503d99ccd96b3a871 /compiler/src/dotty/tools/dotc/core/Denotations.scala
parent606294c5729a7b106964415af6304d60cc102810 (diff)
downloaddotty-0698383d595fec40c70905eb0e06b430f93ba0b8.tar.gz
dotty-0698383d595fec40c70905eb0e06b430f93ba0b8.tar.bz2
dotty-0698383d595fec40c70905eb0e06b430f93ba0b8.zip
Add NameExtractors
Use a new scheme for creating and accessing semantic names which is based on semantic name extractors with nested info classes.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Denotations.scala19
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala
index aa0ea39a2..60a506291 100644
--- a/compiler/src/dotty/tools/dotc/core/Denotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala
@@ -6,6 +6,7 @@ import SymDenotations.{ SymDenotation, ClassDenotation, NoDenotation }
import Contexts.{Context, ContextBase}
import Names._
import NameOps._
+import NameExtractors._
import StdNames._
import Symbols.NoSymbol
import Symbols._
@@ -1185,19 +1186,19 @@ object Denotations {
}
else owner
}
- def recur(path: Name, wrap: Name => Name = identity): Denotation = path match {
+ def recur(path: Name, wrap: TermName => Name = identity): Denotation = path match {
case path: TypeName =>
- recur(path.toTermName, n => wrap(n.toTypeName))
- case DerivedTermName(prefix, NameInfo.ModuleClass) =>
- recur(prefix, n => wrap(n.derived(NameInfo.ModuleClass)))
- case DerivedTermName(prefix, NameInfo.Select(selector)) =>
+ recur(path.toTermName, n => n.toTypeName)
+ case ModuleClassName(underlying) =>
+ recur(underlying, n => wrap(ModuleClassName(n)))
+ case QualifiedName(prefix, selector) =>
select(recur(prefix), wrap(selector))
- case DerivedTermName(prefix, qual: NameInfo.Qualified) =>
- recur(prefix, n => wrap(n ++ qual.separator ++ qual.name))
+ case AnyQualifiedName(prefix, info) =>
+ recur(prefix, n => wrap(info.mkString(n).toTermName))
case path: SimpleTermName =>
- def recurSimple(len: Int, wrap: Name => Name): Denotation = {
+ def recurSimple(len: Int, wrap: TermName => Name): Denotation = {
val point = path.lastIndexOf('.', len - 1)
- val selector = wrap(path.slice(point + 1, len))
+ val selector = wrap(path.slice(point + 1, len).asTermName)
val prefix =
if (point > 0) recurSimple(point, identity)
else if (selector.isTermName) defn.RootClass.denot