Merge pull request #10384 from RasmusWL/callnode-getargbyname

Python: Allow `CallNode.getArgByName` for keyword args after `**kwargs`
This commit is contained in:
Rasmus Wriedt Larsen
2022-09-19 15:05:59 +02:00
committed by GitHub
3 changed files with 6 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Changed `CallNode.getArgByName` such that it has results for keyword arguments given after a dictionary unpacking argument, as the `bar=2` argument in `func(foo=1, **kwargs, bar=2)`.

View File

@@ -376,7 +376,7 @@ class CallNode extends ControlFlowNode {
ControlFlowNode getArgByName(string name) {
exists(Call c, Keyword k |
this.getNode() = c and
k = c.getAKeyword() and
k = c.getANamedArg() and
k.getValue() = result.getNode() and
k.getArg() = name and
result.getBasicBlock().dominates(this.getBasicBlock())