From 7df237291c91a83c47a51592edec3c82e9b1b42d Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Wed, 3 Apr 2024 13:13:31 -0700 Subject: [PATCH] Resolve a call argument that is a call to its identifier (#412) 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 --- precli/core/argument.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/precli/core/argument.py b/precli/core/argument.py index 8a168cae..905bc84c 100644 --- a/precli/core/argument.py +++ b/precli/core/argument.py @@ -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]: