| 1295 | } |
| 1296 | |
| 1297 | static bool is_direct_argument_value(TSNode node) { |
| 1298 | usage_slow_parent_fallback_test_note(); |
| 1299 | TSNode parent = ts_node_parent(node); |
| 1300 | if (ts_node_is_null(parent)) { |
| 1301 | return false; |
| 1302 | } |
| 1303 | if (is_labeled_argument_kind(ts_node_type(parent))) { |
| 1304 | TSNode value = ts_node_child_by_field_name(parent, TS_FIELD("value")); |
| 1305 | return !ts_node_is_null(value) && ts_node_eq(value, node) && |
| 1306 | is_direct_argument_value(parent); |
| 1307 | } |
| 1308 | TSNode direct_arguments = ts_node_child_by_field_name(parent, TS_FIELD("arguments")); |
| 1309 | if (!ts_node_is_null(direct_arguments) && ts_node_eq(direct_arguments, node)) { |
| 1310 | return true; |
| 1311 | } |
| 1312 | if (is_argument_container_kind(ts_node_type(parent))) { |
| 1313 | return true; |
| 1314 | } |
| 1315 | const char *parent_kind = ts_node_type(parent); |
| 1316 | if (strcmp(parent_kind, "list_expression") == 0) { |
| 1317 | TSNode call = ts_node_parent(parent); |
| 1318 | if (!ts_node_is_null(call)) { |
| 1319 | TSNode arguments = ts_node_child_by_field_name(call, TS_FIELD("arguments")); |
| 1320 | return !ts_node_is_null(arguments) && ts_node_eq(arguments, parent); |
| 1321 | } |
| 1322 | return false; |
| 1323 | } |
| 1324 | if (strcmp(parent_kind, "argument") != 0 && strcmp(parent_kind, "value_argument") != 0) { |
| 1325 | return false; |
| 1326 | } |
| 1327 | TSNode grandparent = ts_node_parent(parent); |
| 1328 | return !ts_node_is_null(grandparent) && is_argument_container_kind(ts_node_type(grandparent)); |
| 1329 | } |
| 1330 | |
| 1331 | /* Cursor-backed counterpart for the unified walker. `cursor` must currently |
| 1332 | * point at `node`; it is consumed while walking toward the argument owner. */ |
no test coverage detected