CodeQL library for Python
codeql/python-all 3.0.1-dev (changelog, source)
Search

Member predicate CallableValue::getNamedArgumentForCall

Gets the argument in call corresponding to the named keyword parameter of this callable.

This method also gives results when the argument is passed as a positional argument in call, as long as this is not a builtin function or a builtin method.

Examples:

  • if this represents the PythonFunctionValue for def func(a, b):, and call represents func(10, 20), then getNamedArgumentForCall(call, "a") will give the ControlFlowNode for 10.

  • with call representing func(b=20, a=10), getNamedArgumentForCall(call, "a") will give the ControlFlowNode for 10.

  • if this represents the PythonFunctionValue for def func(self, a, b):, and call represents foo.func(10, 20), then getNamedArgumentForCall(call, "a") will give the ControlFlowNode for 10.

ControlFlowNode getNamedArgumentForCall(CallNode call, string name)