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. */
| 283 | * classifier, then walk its parents without restarting a sibling scan at |
| 284 | * every level. Legacy extraction callers retain the node-based fallback. */ |
| 285 | static TSTreeCursor *reset_occurrence_cursor(WalkState *state, TSNode node) { |
| 286 | if (!state || !state->current_cursor || !state->occurrence_cursor || |
| 287 | !ts_node_eq(ts_tree_cursor_current_node(state->current_cursor), node)) { |
| 288 | return NULL; |
| 289 | } |
| 290 | ts_tree_cursor_reset_to(state->occurrence_cursor, state->current_cursor); |
| 291 | return state->occurrence_cursor; |
| 292 | } |
| 293 | |
| 294 | static bool occurrence_parent(TSTreeCursor *cursor, TSNode current, TSNode *parent, |
| 295 | const char **field) { |
no outgoing calls
no test coverage detected