Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ad0f5a

Browse files
committed
Python: ObjectAPI to ValueAPI: WrongNumberArgumentsInCall: ObjectAPI.qll: Adds getAFunctionCall and getAMethodCall predicates to FunctionValue
1 parent 2a7b77c commit 2ad0f5a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

python/ql/src/semmle/python/objects/ObjectAPI.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,17 @@ abstract class FunctionValue extends CallableValue {
594594
or
595595
result = TBuiltinClassObject(this.(BuiltinMethodObjectInternal).getReturnType())
596596
}
597+
598+
/** Gets a call-site from where this function is called as a function */
599+
CallNode getAFunctionCall() { result.getFunction().pointsTo() = this }
600+
601+
/** Gets a call-site from where this function is called as a method */
602+
CallNode getAMethodCall() {
603+
exists(BoundMethodObjectInternal bm |
604+
result.getFunction().pointsTo() = bm and
605+
bm.getFunction() = this
606+
)
607+
}
597608
}
598609

599610
/** Class representing Python functions */

0 commit comments

Comments
 (0)