| 322 | } |
| 323 | |
| 324 | static bool occurrence_parent(TSTreeCursor *cursor, TSNode current, TSNode *parent, |
| 325 | const char **field) { |
| 326 | if (cursor) { |
| 327 | *field = ts_tree_cursor_current_field_name(cursor); |
| 328 | usage_field_lookup_test_note_work(); |
| 329 | if (!ts_tree_cursor_goto_parent(cursor)) { |
| 330 | *parent = (TSNode){0}; |
| 331 | return false; |
| 332 | } |
| 333 | *parent = ts_tree_cursor_current_node(cursor); |
| 334 | return true; |
| 335 | } |
| 336 | |
| 337 | *parent = ts_node_parent(current); |
| 338 | if (ts_node_is_null(*parent)) { |
| 339 | *field = NULL; |
| 340 | return false; |
| 341 | } |
| 342 | *field = field_name_for_node(*parent, current); |
| 343 | return true; |
| 344 | } |
| 345 | |
| 346 | static const char *field_name_for_walk_node(WalkState *state, TSNode parent, TSNode node) { |
| 347 | if (state && state->current_cursor && |
no test coverage detected