aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Names.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-28 13:07:11 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:11 +0200
commit1e49ddad97c4e8207913857511ae62467f8cd3ce (patch)
tree9b5f38d746faec377c6778e902a627354808b05e /compiler/src/dotty/tools/dotc/core/Names.scala
parent0021ffb0f1a0a857b7cdc8cdf769ae727dcb4b2c (diff)
downloaddotty-1e49ddad97c4e8207913857511ae62467f8cd3ce.tar.gz
dotty-1e49ddad97c4e8207913857511ae62467f8cd3ce.tar.bz2
dotty-1e49ddad97c4e8207913857511ae62467f8cd3ce.zip
Redefine definesNewName
Make it a method of info instead of a convention over tags, because it's less fragile that way. Also, add UniqueName extractor.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Names.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Names.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala
index d1788b6f9..81429a8d9 100644
--- a/compiler/src/dotty/tools/dotc/core/Names.scala
+++ b/compiler/src/dotty/tools/dotc/core/Names.scala
@@ -175,7 +175,7 @@ object Names {
*/
def derived(info: NameInfo): TermName = {
val ownTag = this.info.tag
- if (ownTag < info.tag || definesNewName(info.tag)) add(info)
+ if (ownTag < info.tag || info.definesNewName) add(info)
else if (ownTag > info.tag) rewrap(underlying.derived(info))
else {
assert(info == this.info)
@@ -185,7 +185,7 @@ object Names {
def exclude(kind: NameExtractor): TermName = {
val ownTag = this.info.tag
- if (ownTag < kind.tag || definesNewName(ownTag)) this
+ if (ownTag < kind.tag || info.definesNewName) this
else if (ownTag > kind.tag) rewrap(underlying.exclude(kind))
else underlying
}
@@ -193,7 +193,7 @@ object Names {
def is(kind: NameExtractor): Boolean = {
val ownTag = this.info.tag
ownTag == kind.tag ||
- !definesNewName(ownTag) && ownTag > kind.tag && underlying.is(kind)
+ !info.definesNewName && ownTag > kind.tag && underlying.is(kind)
}
override def hashCode = System.identityHashCode(this)