@@ -32,7 +32,7 @@ object Scopes {
3232 * This value must be a power of two, so that the index of an element can
3333 * be computed as element.hashCode & (hashTable.length - 1)
3434 */
35- private final val MinHash = 8
35+ final val MinHashedScopeSize = 8
3636
3737 /** The maximal permissible number of recursions when creating
3838 * a hashtable
@@ -144,11 +144,6 @@ object Scopes {
144144 final def toText (printer : Printer ): Text = printer.toText(this )
145145
146146 def checkConsistent ()(implicit ctx : Context ) = ()
147-
148- /** Hook for transforming a name before it is used in a lookup or creation.
149- * Used to mangle names in package scopes.
150- */
151- protected def normalize (name : Name ): Name = name
152147 }
153148
154149 /** A subclass of Scope that defines methods for entering and
@@ -163,7 +158,7 @@ object Scopes {
163158 /** Scope shares elements with `base` */
164159 protected [Scopes ] def this (base : Scope )(implicit ctx : Context ) = {
165160 this (base.lastEntry, base.size, base.nestingLevel + 1 )
166- ensureCapacity(MinHash )(ctx) // WTH? it seems the implicit is not in scope for a secondary constructor call.
161+ ensureCapacity(MinHashedScopeSize )(ctx) // WTH? it seems the implicit is not in scope for a secondary constructor call.
167162 }
168163
169164 def this () = this (null , 0 , 0 )
@@ -205,8 +200,8 @@ object Scopes {
205200
206201 /** create and enter a scope entry with given name and symbol */
207202 protected def newScopeEntry (name : Name , sym : Symbol )(implicit ctx : Context ): ScopeEntry = {
208- ensureCapacity(if (hashTable ne null ) hashTable.length else MinHash )
209- val e = new ScopeEntry (normalize( name) , sym, this )
203+ ensureCapacity(if (hashTable ne null ) hashTable.length else MinHashedScopeSize )
204+ val e = new ScopeEntry (name, sym, this )
210205 e.prev = lastEntry
211206 lastEntry = e
212207 if (hashTable ne null ) enterInHash(e)
@@ -242,7 +237,7 @@ object Scopes {
242237 enter(sym)
243238 }
244239
245- protected def ensureCapacity (tableSize : Int )(implicit ctx : Context ): Unit =
240+ private def ensureCapacity (tableSize : Int )(implicit ctx : Context ): Unit =
246241 if (size >= tableSize * FillFactor ) createHash(tableSize * 2 )
247242
248243 private def createHash (tableSize : Int )(implicit ctx : Context ): Unit =
@@ -318,16 +313,15 @@ object Scopes {
318313 /** Lookup a symbol entry matching given name.
319314 */
320315 override def lookupEntry (name : Name )(implicit ctx : Context ): ScopeEntry = {
321- val normalized = normalize(name)
322316 var e : ScopeEntry = null
323317 if (hashTable ne null ) {
324- e = hashTable(normalized .hashCode & (hashTable.length - 1 ))
325- while ((e ne null ) && e.name != normalized ) {
318+ e = hashTable(name .hashCode & (hashTable.length - 1 ))
319+ while ((e ne null ) && e.name != name ) {
326320 e = e.tail
327321 }
328322 } else {
329323 e = lastEntry
330- while ((e ne null ) && e.name != normalized ) {
324+ while ((e ne null ) && e.name != name ) {
331325 e = e.prev
332326 }
333327 }
@@ -403,25 +397,6 @@ object Scopes {
403397 }
404398 }
405399
406- /** The scope of a package. This is different from a normal scope
407- * in that names of scope entries are kept in mangled form.
408- */
409- class PackageScope protected [Scopes ](initElems : ScopeEntry , initSize : Int , nestingLevel : Int )
410- extends MutableScope (initElems, initSize, nestingLevel) {
411-
412- /** Scope shares elements with `base` */
413- def this (base : Scope )(implicit ctx : Context ) = {
414- this (base.lastEntry, base.size, base.nestingLevel + 1 )
415- ensureCapacity(MinHash )(ctx) // WTH? it seems the implicit is not in scope for a secondary constructor call.
416- }
417-
418- def this () = this (null , 0 , 0 )
419-
420- override def newScopeLikeThis () = new PackageScope ()
421-
422- override protected def normalize (name : Name ) = name.mangled
423- }
424-
425400 /** Create a new scope */
426401 def newScope : MutableScope = new MutableScope ()
427402
@@ -435,9 +410,6 @@ object Scopes {
435410 scope
436411 }
437412
438- /** Create new scope for the members of package `pkg` */
439- def newPackageScope (pkgClass : Symbol ): MutableScope = new PackageScope ()
440-
441413 /** Transform scope of members of `owner` using operation `op`
442414 * This is overridden by the reflective compiler to avoid creating new scopes for packages
443415 */
0 commit comments