Skip to content

Commit 78235f2

Browse files
Adress review suggestions - cleanups
1 parent 2c93e2c commit 78235f2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

python/ql/src/Classes/CallsToInitDel/MethodCallOrder.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ predicate multipleCallsToSuperclassMethod(
2121
}
2222

2323
/** Holds if l1 comes before l2, assuming they're in the same file. */
24-
pragma[inline]
2524
private predicate locationBefore(Location l1, Location l2) {
2625
l1.getStartLine() < l2.getStartLine()
2726
or
@@ -45,7 +44,6 @@ Function getDirectSuperCallTargetFromCall(
4544
Class mroBase, Function meth, DataFlow::MethodCallNode call, string name
4645
) {
4746
meth = call.getScope() and
48-
getADirectSuperclass*(mroBase) = meth.getScope() and
4947
meth.getName() = name and
5048
call.calls(_, name) and
5149
mroBase = getADirectSubclass*(meth.getScope()) and
@@ -56,7 +54,7 @@ Function getDirectSuperCallTargetFromCall(
5654
result = findFunctionAccordingToMroKnownStartingClass(targetCls, mroBase, name)
5755
or
5856
// targetCls is the mro base for this lookup.
59-
// note however that if the call we find uses super(), that still uses the mro of the instance `self` will sill be used
57+
// note however that if the call we find uses super(), that still uses the mro of the instance `self`
6058
// assuming it's 0-arg or is 2-arg with `self` as second arg.
6159
callsMethodOnClassWithSelf(meth, call, targetCls, _) and
6260
result = findFunctionAccordingToMroKnownStartingClass(targetCls, targetCls, name)
@@ -96,7 +94,7 @@ predicate superCall(DataFlow::MethodCallNode call, string name) {
9694
)
9795
}
9896

99-
/** Holds if `meth` calls `super().<name>` where `name` is the name of the method. */
97+
/** Holds if `meth` calls a `super()` method of the same name. */
10098
predicate callsSuper(Function meth) {
10199
exists(DataFlow::MethodCallNode call |
102100
call.getScope() = meth and
@@ -122,7 +120,7 @@ predicate callsMethodOnUnknownClassWithSelf(Function meth, string name) {
122120
call.calls(callTarget, name) and
123121
self.getParameter() = meth.getArg(0) and
124122
self.(DataFlow::LocalSourceNode).flowsTo(call.getArg(0)) and
125-
not exists(Class target | callTarget = classTracker(target))
123+
not callTarget = classTracker(any(Class target))
126124
)
127125
}
128126

0 commit comments

Comments
 (0)