Yield (name_str, value_node) pairs from an R call's arguments.
(call_node)
| 6713 | |
| 6714 | @staticmethod |
| 6715 | def _r_iter_args(call_node): |
| 6716 | """Yield (name_str, value_node) pairs from an R call's arguments.""" |
| 6717 | for child in call_node.children: |
| 6718 | if child.type != "arguments": |
| 6719 | continue |
| 6720 | for arg in child.children: |
| 6721 | if arg.type != "argument": |
| 6722 | continue |
| 6723 | has_eq = any(sub.type == "=" for sub in arg.children) |
| 6724 | if has_eq: |
| 6725 | name = None |
| 6726 | value = None |
| 6727 | for sub in arg.children: |
| 6728 | if sub.type == "identifier" and name is None: |
| 6729 | name = sub.text.decode("utf-8", errors="replace") |
| 6730 | elif sub.type not in ("=", ","): |
| 6731 | value = sub |
| 6732 | yield (name, value) |
| 6733 | else: |
| 6734 | for sub in arg.children: |
| 6735 | if sub.type not in (",",): |
| 6736 | yield (None, sub) |
| 6737 | break |
| 6738 | break |
| 6739 | |
| 6740 | @classmethod |
| 6741 | def _r_find_named_arg(cls, call_node, arg_name: str): |
no outgoing calls
no test coverage detected