summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reflect/scala/reflect/internal/Scopes.scala15
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala5
2 files changed, 16 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Scopes.scala b/src/reflect/scala/reflect/internal/Scopes.scala
index ceacd2afb0..939cd556a6 100644
--- a/src/reflect/scala/reflect/internal/Scopes.scala
+++ b/src/reflect/scala/reflect/internal/Scopes.scala
@@ -42,6 +42,11 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
* SynchronizedScope as mixin.
*/
class Scope protected[Scopes] (initElems: ScopeEntry = null) extends Iterable[Symbol] {
+
+ /** A bitset containing the last 6 bits of the start value of every name
+ * stored in this scope.
+ */
+ var fingerPrints: Long = 0L
protected[Scopes] def this(base: Scope) = {
this(base.elems)
@@ -95,7 +100,7 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
*
* @param e ...
*/
- protected def enter(e: ScopeEntry) {
+ protected def enterEntry(e: ScopeEntry) {
elemsCache = null
if (hashtable ne null)
enterInHash(e)
@@ -113,7 +118,11 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
*
* @param sym ...
*/
- def enter[T <: Symbol](sym: T): T = { enter(newScopeEntry(sym, this)); sym }
+ def enter[T <: Symbol](sym: T): T = {
+ fingerPrints |= (1L << sym.name.start)
+ enterEntry(newScopeEntry(sym, this))
+ sym
+ }
/** enter a symbol, asserting that no symbol with same name exists in scope
*
@@ -344,7 +353,7 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
/** The empty scope (immutable).
*/
object EmptyScope extends Scope {
- override def enter(e: ScopeEntry) {
+ override def enterEntry(e: ScopeEntry) {
abort("EmptyScope.enter")
}
}
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 56cc265e48..191981efef 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -1045,6 +1045,7 @@ trait Types extends api.Types { self: SymbolTable =>
var continue = true
var self: Type = null
var membertpe: Type = null
+ val fingerPrint: Long = (1L << name.start)
while (continue) {
continue = false
val bcs0 = baseClasses
@@ -1052,7 +1053,9 @@ trait Types extends api.Types { self: SymbolTable =>
while (!bcs.isEmpty) {
val decls = bcs.head.info.decls
var entry =
- if (name == nme.ANYNAME) decls.elems else decls.lookupEntry(name)
+ if (name == nme.ANYNAME) decls.elems
+ else if ((fingerPrint & decls.fingerPrints) == 0) null
+ else decls.lookupEntry(name)
while (entry ne null) {
val sym = entry.sym
if (sym hasAllFlags requiredFlags) {