Skip to content

Commit

Permalink
Resolve a call argument that is a call to its identifier (#412)
Browse files Browse the repository at this point in the history
This fixes the case when a call is analyzed that has a call as one of
its arguments.

foobar("foo", bar())

Now the call in the argument list will resolve to an identifier node.

Signed-off-by: Eric Brown <[email protected]>
  • Loading branch information
ericwb authored Apr 3, 2024
1 parent 1b6c3bc commit 7df2372
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions precli/core/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def _get_func_ident(node: Node) -> Node:
if node is None:
return None
# TODO(ericwb): does this function fail with nested calls?
if node.type == tokens.CALL:
return Argument._get_func_ident(node.named_children[0])
if node.type in [tokens.ATTRIBUTE, tokens.SELECTOR_EXPRESSION]:
return Argument._get_func_ident(node.named_children[1])
if node.type in [tokens.IDENTIFIER, tokens.FIELD_IDENTIFIER]:
Expand Down

0 comments on commit 7df2372

Please sign in to comment.