Python: ObjectAPI to ValueAPI: WrongNumberArgumentsInCall: ObjectAPI.qll: Adds getAFunctionCall and getAMethodCall predicates to FunctionValue

This commit is contained in:
Rebecca Valentine
2020-04-03 20:04:32 -07:00
parent 2a7b77c0e1
commit 2ad0f5af2d

View File

@@ -594,6 +594,17 @@ abstract class FunctionValue extends CallableValue {
or
result = TBuiltinClassObject(this.(BuiltinMethodObjectInternal).getReturnType())
}
/** Gets a call-site from where this function is called as a function */
CallNode getAFunctionCall() { result.getFunction().pointsTo() = this }
/** Gets a call-site from where this function is called as a method */
CallNode getAMethodCall() {
exists(BoundMethodObjectInternal bm |
result.getFunction().pointsTo() = bm and
bm.getFunction() = this
)
}
}
/** Class representing Python functions */