diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-28 22:25:09 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:11 +0200 |
commit | ca5652cc5a74f00277ce942a001fa6e931ee3728 (patch) | |
tree | 9ef6e2b341bc10678bbe1f06d4c15fb28093da07 /compiler/src/dotty/tools/dotc/core/Names.scala | |
parent | 1e49ddad97c4e8207913857511ae62467f8cd3ce (diff) | |
download | dotty-ca5652cc5a74f00277ce942a001fa6e931ee3728.tar.gz dotty-ca5652cc5a74f00277ce942a001fa6e931ee3728.tar.bz2 dotty-ca5652cc5a74f00277ce942a001fa6e931ee3728.zip |
Make freshName semantic
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Names.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Names.scala | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala index 81429a8d9..e4ebe61c2 100644 --- a/compiler/src/dotty/tools/dotc/core/Names.scala +++ b/compiler/src/dotty/tools/dotc/core/Names.scala @@ -130,7 +130,7 @@ object Names { def likeKinded(name: Name): TermName = name.toTermName - def info: NameInfo = simpleTermNameInfo + def info: NameInfo = SimpleTermNameExtractor.info def underlying: TermName = unsupported("underlying") @sharable private var derivedNames: AnyRef /* SimpleMap | j.u.HashMap */ = @@ -174,9 +174,10 @@ object Names { * name as underlying name. */ def derived(info: NameInfo): TermName = { - val ownTag = this.info.tag - if (ownTag < info.tag || info.definesNewName) add(info) - else if (ownTag > info.tag) rewrap(underlying.derived(info)) + val thisKind = this.info.extractor + val thatKind = info.extractor + if (thisKind.tag < thatKind.tag || thatKind.definesNewName) add(info) + else if (thisKind.tag > thatKind.tag) rewrap(underlying.derived(info)) else { assert(info == this.info) this @@ -184,16 +185,16 @@ object Names { } def exclude(kind: NameExtractor): TermName = { - val ownTag = this.info.tag - if (ownTag < kind.tag || info.definesNewName) this - else if (ownTag > kind.tag) rewrap(underlying.exclude(kind)) + val thisKind = this.info.extractor + if (thisKind.tag < kind.tag || thisKind.definesNewName) this + else if (thisKind.tag > kind.tag) rewrap(underlying.exclude(kind)) else underlying } def is(kind: NameExtractor): Boolean = { - val ownTag = this.info.tag - ownTag == kind.tag || - !info.definesNewName && ownTag > kind.tag && underlying.is(kind) + val thisKind = this.info.extractor + thisKind == kind || + !thisKind.definesNewName && thisKind.tag > kind.tag && underlying.is(kind) } override def hashCode = System.identityHashCode(this) @@ -511,7 +512,7 @@ object Names { implicit val NameOrdering: Ordering[Name] = new Ordering[Name] { private def compareInfos(x: NameInfo, y: NameInfo): Int = - if (x.tag != y.tag) x.tag - y.tag + if (x.extractor.tag != y.extractor.tag) x.extractor.tag - y.extractor.tag else x match { case x: QualifiedInfo => y match { |