@@ -52,12 +52,20 @@ object Uniques {
52
52
e
53
53
}
54
54
55
- def enterIfNew (prefix : Type , designator : Designator )(implicit ctx : Context ): NamedType = {
55
+ def enterIfNew (prefix : Type , designator : Designator , isTerm : Boolean )(implicit ctx : Context ): NamedType = {
56
56
val h = doHash(designator, prefix)
57
57
if (monitored) recordCaching(h, classOf [NamedType ])
58
58
def newType = {
59
- if (designator.isType) new CachedTypeRef (prefix, designator.asType, h)
60
- else new CachedTermRef (prefix, designator.asTerm, h)
59
+ if (isTerm)
60
+ designator match {
61
+ case designator : TermSymbol => new TermRefWithFixedSym (prefix, designator, h)
62
+ case _ => new CachedTermRef (prefix, designator.asTerm, h)
63
+ }
64
+ else
65
+ designator match {
66
+ case designator : TypeSymbol => new TypeRefWithFixedSym (prefix, designator, h)
67
+ case _ => new CachedTypeRef (prefix, designator.asType, h)
68
+ }
61
69
}.init()
62
70
if (h == NotCached ) newType
63
71
else {
@@ -67,33 +75,6 @@ object Uniques {
67
75
}
68
76
}
69
77
70
- final class WithFixedSymUniques extends HashSet [WithFixedSym ](Config .initialUniquesCapacity) with Hashable {
71
- override def hash (x : WithFixedSym ): Int = x.hash
72
-
73
- private def findPrevious (h : Int , prefix : Type , sym : Symbol ): NamedType = {
74
- var e = findEntryByHash(h)
75
- while (e != null ) {
76
- if ((e.prefix eq prefix) && (e.fixedSym eq sym)) return e
77
- e = nextEntryByHash(h)
78
- }
79
- e
80
- }
81
-
82
- def enterIfNew (prefix : Type , name : Name , sym : Symbol )(implicit ctx : Context ): NamedType = {
83
- val h = doHash(sym, prefix)
84
- if (monitored) recordCaching(h, classOf [WithFixedSym ])
85
- def newType = {
86
- if (name.isTypeName) new TypeRefWithFixedSym (prefix, sym.asInstanceOf [TypeSymbol ], h)
87
- else new TermRefWithFixedSym (prefix, sym.asInstanceOf [TermSymbol ], h)
88
- }.init()
89
- if (h == NotCached ) newType
90
- else {
91
- val r = findPrevious(h, prefix, sym)
92
- if (r ne null ) r else addEntryAfterScan(newType)
93
- }
94
- }
95
- }
96
-
97
78
final class AppliedUniques extends HashSet [AppliedType ](Config .initialUniquesCapacity) with Hashable {
98
79
override def hash (x : AppliedType ): Int = x.hash
99
80
0 commit comments