The unified walk already owns the exact cursor path to the current node. * Reset one reusable scratch cursor to that path before each occurrence * classifier, then walk its parents without restarting a sibling scan at * every level. Legacy extraction callers retain the node-based fallback. */
| 313 | * classifier, then walk its parents without restarting a sibling scan at |
| 314 | * every level. Legacy extraction callers retain the node-based fallback. */ |
| 315 | static TSTreeCursor *reset_occurrence_cursor(WalkState *state, TSNode node) { |
| 316 | if (!state || !state->current_cursor || !state->occurrence_cursor || |
| 317 | !ts_node_eq(ts_tree_cursor_current_node(state->current_cursor), node)) { |
| 318 | return NULL; |
| 319 | } |
| 320 | ts_tree_cursor_reset_to(state->occurrence_cursor, state->current_cursor); |
| 321 | return state->occurrence_cursor; |
| 322 | } |
| 323 | |
| 324 | static bool occurrence_parent(TSTreeCursor *cursor, TSNode current, TSNode *parent, |
| 325 | const char **field) { |
no outgoing calls
no test coverage detected