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

Function reset_occurrence_cursor

internal/cbm/extract_usages.c:285–292  ·  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

283 * classifier, then walk its parents without restarting a sibling scan at
284 * every level. Legacy extraction callers retain the node-based fallback. */
285static 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
294static bool occurrence_parent(TSTreeCursor *cursor, TSNode current, TSNode *parent,
295 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