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

Function enclosing_function_qn

internal/cbm/extract_channels.c:186–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184/* ── Enclosing function detection ───────────────────────────────── */
185
186static const char *enclosing_function_qn(CBMExtractCtx *ctx, TSNode node) {
187 TSNode parent = ts_node_parent(node);
188 while (!ts_node_is_null(parent)) {
189 const char *pk = ts_node_type(parent);
190 if (strcmp(pk, "function_declaration") == 0 || strcmp(pk, "method_definition") == 0 ||
191 strcmp(pk, "arrow_function") == 0 || strcmp(pk, "function_expression") == 0 ||
192 strcmp(pk, "function") == 0 || strcmp(pk, "method_signature") == 0 ||
193 strcmp(pk, "function_definition") == 0 || strcmp(pk, "method_declaration") == 0 ||
194 strcmp(pk, "function_item") == 0 || strcmp(pk, "def") == 0) {
195 TSNode name_node = ts_node_child_by_field_name(parent, TS_FIELD("name"));
196 if (!ts_node_is_null(name_node)) {
197 char *name = cbm_node_text(ctx->arena, name_node, ctx->source);
198 if (name && name[0]) {
199 return name;
200 }
201 }
202 return NULL;
203 }
204 parent = ts_node_parent(parent);
205 }
206 return NULL;
207}
208
209/* ── Channel name extraction from arguments ──────────────────────── */
210

Callers 5

push_channelFunction · 0.85
go_process_callFunction · 0.85
java_process_callFunction · 0.85
java_process_annotationFunction · 0.85
rust_process_callFunction · 0.85

Calls 1

cbm_node_textFunction · 0.85

Tested by

no test coverage detected