MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / reset_occurrence_cursor

Function reset_occurrence_cursor

internal/cbm/extract_usages.c:315–322  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

313 * classifier, then walk its parents without restarting a sibling scan at
314 * every level. Legacy extraction callers retain the node-based fallback. */
315static 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
324static bool occurrence_parent(TSTreeCursor *cursor, TSNode current, TSNode *parent,
325 const char **field) {

Callers 5

is_binding_occurrenceFunction · 0.85
is_write_occurrenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected