From 1e49ddad97c4e8207913857511ae62467f8cd3ce Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 28 Mar 2017 13:07:11 +0200 Subject: 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. --- compiler/src/dotty/tools/dotc/core/Names.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/Names.scala') 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) -- cgit v1.2.3