Skip to content

Commit f5066c7

Browse files
Remove tostring
1 parent e8a65b8 commit f5066c7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ predicate multipleCallsToSuperclassMethod(
1313
exists(Class cls |
1414
meth.getName() = name and
1515
meth.getScope() = cls and
16-
call1.getLocation().toString() < call2.getLocation().toString() and
16+
locationBefore(call1.getLocation(), call2.getLocation()) and
1717
calledMulti = getASuperCallTargetFromCall(cls, meth, call1, name) and
1818
calledMulti = getASuperCallTargetFromCall(cls, meth, call2, name) and
1919
nonTrivial(calledMulti)
2020
)
2121
}
2222

23+
/** Holds if l1 comes before l2, assuming they're in the same file. */
24+
private predicate locationBefore(Location l1, Location l2) {
25+
l1.getStartLine() < l2.getStartLine()
26+
or
27+
l1.getStartLine() = l2.getStartLine() and
28+
l1.getStartColumn() < l2.getStartColumn()
29+
}
30+
2331
/** Gets a method transitively called by `meth` named `name` with `call` that it overrides, with `mroBase` as the type determining the MRO to search. */
2432
Function getASuperCallTargetFromCall(
2533
Class mroBase, Function meth, DataFlow::MethodCallNode call, string name

0 commit comments

Comments
 (0)