Skip to content

Commit b959705

Browse files
committed
revert changes in MRO.qll
1 parent b74852f commit b959705

File tree

1 file changed

+3
-15
lines changed
  • python/ql/lib/semmle/python/pointsto

1 file changed

+3
-15
lines changed

python/ql/lib/semmle/python/pointsto/MRO.qll

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,10 @@ class ClassList extends TClassList {
163163
int firstIndex(ClassObjectInternal cls) { result = this.firstIndex(cls, 0) }
164164

165165
/* Helper for firstIndex(cls), getting the first index of `cls` where result >= n */
166-
pragma[noopt]
167166
private int firstIndex(ClassObjectInternal cls, int n) {
168167
this.getItem(n) = cls and result = n
169168
or
170-
exists(int next |
171-
result = this.firstIndex(cls, next) and
172-
next = n + 1
173-
) and
174-
exists(ClassObjectInternal item | item = this.getItem(n) | item != cls)
169+
this.getItem(n) != cls and result = this.firstIndex(cls, n + 1)
175170
}
176171

177172
/** Holds if the class at `n` is a duplicate of an earlier position. */
@@ -183,15 +178,10 @@ class ClassList extends TClassList {
183178
* Gets a class list which is the de-duplicated form of the list containing elements of
184179
* this list from `n` onwards.
185180
*/
186-
pragma[noopt]
187181
ClassList deduplicate(int n) {
188182
n = this.length() and result = Empty()
189183
or
190-
exists(int next |
191-
this.duplicate(n) and
192-
result = this.deduplicate(next) and
193-
next = n + 1
194-
)
184+
this.duplicate(n) and result = this.deduplicate(n + 1)
195185
or
196186
exists(ClassObjectInternal cls, ClassList tail |
197187
this.deduplicateCons(n, cls, tail) and
@@ -489,12 +479,10 @@ private predicate needs_reversing(ClassList lst) {
489479
lst = Empty()
490480
}
491481

492-
pragma[noopt]
493482
private predicate reverse_step(ClassList lst, ClassList remainder, ClassList reversed) {
494483
needs_reversing(lst) and remainder = lst and reversed = Empty()
495484
or
496-
exists(ClassObjectInternal head, ClassList tail, TClassList cons |
497-
reverse_step(lst, cons, tail) and
485+
exists(ClassObjectInternal head, ClassList tail |
498486
reversed = Cons(head, tail) and
499487
reverse_stepCons(lst, remainder, head, tail)
500488
)

0 commit comments

Comments
 (0)