Remove tostring

This commit is contained in:
Joe Farebrother
2025-07-07 11:02:48 +01:00
parent 72df584e9b
commit cc486ddb08

View File

@@ -13,13 +13,21 @@ predicate multipleCallsToSuperclassMethod(
exists(Class cls |
meth.getName() = name and
meth.getScope() = cls and
call1.getLocation().toString() < call2.getLocation().toString() and
locationBefore(call1.getLocation(), call2.getLocation()) and
calledMulti = getASuperCallTargetFromCall(cls, meth, call1, name) and
calledMulti = getASuperCallTargetFromCall(cls, meth, call2, name) and
nonTrivial(calledMulti)
)
}
/** Holds if l1 comes before l2, assuming they're in the same file. */
private predicate locationBefore(Location l1, Location l2) {
l1.getStartLine() < l2.getStartLine()
or
l1.getStartLine() = l2.getStartLine() and
l1.getStartColumn() < l2.getStartColumn()
}
/** Gets a method transitively called by `meth` named `name` with `call` that it overrides, with `mroBase` as the type determining the MRO to search. */
Function getASuperCallTargetFromCall(
Class mroBase, Function meth, DataFlow::MethodCallNode call, string name