You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** The scope entries that have already been visited as overridden
83
82
* (maybe excluded because of hasCommonParentAsSubclass).
84
83
* These will not appear as overriding
85
84
*/
86
-
privatevalvisited=newHashSet[ScopeEntry](64)
85
+
privatevalvisited=newmutable.HashSet[Symbol]
87
86
88
87
/** The current entry candidate for overriding
89
88
*/
@@ -99,48 +98,48 @@ object OverridingPairs {
99
98
varoverridden:Symbol= _
100
99
101
100
//@M: note that next is called once during object initialization
102
-
defhasNext:Boolean=curEntry ne null
101
+
finaldefhasNext:Boolean=nextEntry ne null
103
102
104
-
@tailrec
105
-
finaldefnext():Unit= {
106
-
if (curEntry ne null) {
107
-
overriding = curEntry.sym
103
+
/** @post
104
+
* curEntry = the next candidate that may override something else
105
+
* nextEntry = curEntry
106
+
* overriding = curEntry.sym
107
+
*/
108
+
privatedefnextOverriding():Unit= {
109
+
@tailrec defloop():Unit=
110
+
if (curEntry ne null) {
111
+
overriding = curEntry.sym
112
+
if (visited.contains(overriding)) {
113
+
curEntry = curEntry.prev
114
+
loop()
115
+
}
116
+
}
117
+
loop()
118
+
nextEntry = curEntry
119
+
}
120
+
121
+
/** @post
122
+
* hasNext = there is another overriding pair
123
+
* overriding = overriding member of the pair, provided hasNext is true
124
+
* overridden = overridden member of the pair, provided hasNext is true
125
+
*/
126
+
@tailrec finaldefnext():Unit=
127
+
if (nextEntry ne null) {
128
+
nextEntry = decls.lookupNextEntry(nextEntry)
108
129
if (nextEntry ne null) {
109
-
valoverridingOwner= overriding.owner
110
-
do {
111
-
do {
112
-
nextEntry = decls.lookupNextEntry(nextEntry);
113
-
/* DEBUG
114
-
if ((nextEntry ne null) &&
115
-
!(nextEntry.sym hasFlag PRIVATE) &&
116
-
!(overriding.owner == nextEntry.sym.owner) &&
117
-
!matches(overriding, nextEntry.sym))
118
-
println("skipping "+overriding+":"+self.memberType(overriding)+overriding.locationString+" to "+nextEntry.sym+":"+self.memberType(nextEntry.sym)+nextEntry.sym.locationString)
119
-
*/
120
-
} while ((nextEntry ne null) &&
121
-
(//!!!!nextEntry.sym.canMatchInheritedSymbols ||
122
-
(overriding.owner == nextEntry.sym.owner) ||
123
-
(!matches(overriding, nextEntry.sym)) ||
124
-
(exclude(overriding))))
125
-
if (nextEntry ne null) visited.addEntry(nextEntry)
126
-
// skip nextEntry if a class in `parents` is a subclass of the owners of both
0 commit comments