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

Function try_emit_usage

internal/cbm/extract_usages.c:90–107  ·  view source on GitHub ↗

Try to emit a usage for a reference node. Returns early if the node should be skipped.

Source from the content-addressed store, hash-verified

88
89// Try to emit a usage for a reference node. Returns early if the node should be skipped.
90static void try_emit_usage(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec *spec) {
91 if (!is_reference_node(node, ctx->language)) {
92 return;
93 }
94 if (is_inside_call(node, spec) || is_inside_import(node, spec)) {
95 return;
96 }
97 if (is_definition_name(node)) {
98 return;
99 }
100 char *name = cbm_node_text(ctx->arena, node, ctx->source);
101 if (name && name[0] && !cbm_is_keyword(name, ctx->language)) {
102 CBMUsage usage;
103 usage.ref_name = name;
104 usage.enclosing_func_qn = cbm_enclosing_func_qn_cached(ctx, node);
105 cbm_usages_push(&ctx->result->usages, ctx->arena, usage);
106 }
107}
108
109// Iterative usage walker — explicit stack
110static void walk_usages(CBMExtractCtx *ctx, TSNode root, const CBMLangSpec *spec) {

Callers 1

walk_usagesFunction · 0.85

Calls 8

is_reference_nodeFunction · 0.85
is_inside_callFunction · 0.85
is_inside_importFunction · 0.85
is_definition_nameFunction · 0.85
cbm_node_textFunction · 0.85
cbm_is_keywordFunction · 0.85
cbm_usages_pushFunction · 0.85

Tested by

no test coverage detected