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

Function find_es_source_node

internal/cbm/extract_imports.c:322–335  ·  view source on GitHub ↗

Find the source string node in an ES import_statement.

Source from the content-addressed store, hash-verified

320
321// Find the source string node in an ES import_statement.
322static TSNode find_es_source_node(TSNode node) {
323 TSNode source_node = ts_node_child_by_field_name(node, TS_FIELD("source"));
324 if (ts_node_is_null(source_node)) {
325 uint32_t nc = ts_node_child_count(node);
326 for (int j = (int)nc - SKIP_ONE; j >= 0; j--) {
327 TSNode c = ts_node_child(node, (uint32_t)j);
328 const char *ck = ts_node_type(c);
329 if (strcmp(ck, "string") == 0 || strcmp(ck, "string_literal") == 0) {
330 return c;
331 }
332 }
333 }
334 return source_node;
335}
336
337// Process named_imports: import {A, B as C} from "path".
338static bool process_named_imports(CBMExtractCtx *ctx, TSNode sub, const char *path) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected