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

Function extract_jsx_component_ref

internal/cbm/extract_calls.c:2143–2166  ·  view source on GitHub ↗

Extract JSX component refs (uppercase tags) as CALLS edges.

Source from the content-addressed store, hash-verified

2141
2142// Extract JSX component refs (uppercase tags) as CALLS edges.
2143static void extract_jsx_component_ref(CBMExtractCtx *ctx, TSNode node, const char *kind,
2144 const char *enclosing_func_qn) {
2145 if (strcmp(kind, "jsx_self_closing_element") != 0 && strcmp(kind, "jsx_opening_element") != 0) {
2146 return;
2147 }
2148 TSNode name_node = ts_node_child_by_field_name(node, TS_FIELD("name"));
2149 if (ts_node_is_null(name_node)) {
2150 return;
2151 }
2152 char *name = cbm_node_text(ctx->arena, name_node, ctx->source);
2153 if (name && name[0] >= 'A' && name[0] <= 'Z') {
2154 CBMCall call = {0};
2155 call.callee_name = name;
2156 call.enclosing_func_qn = enclosing_func_qn;
2157 call.site_start_byte = ts_node_start_byte(node);
2158 call.site_end_byte = ts_node_end_byte(node);
2159 /* An uppercase tag is only a component invocation when the TS resolver
2160 * proves which lexical value owns it. In particular, a parameter or
2161 * local named like a module component must not fall through to the
2162 * textual call resolver. */
2163 call.requires_lsp_resolution = true;
2164 cbm_calls_push(&ctx->result->calls, ctx->arena, call);
2165 }
2166}
2167
2168static bool kotlin_direct_unnamed_token(TSNode node, const char *token) {
2169 uint32_t count = ts_node_child_count(node);

Callers 1

handle_callsFunction · 0.85

Calls 2

cbm_node_textFunction · 0.85
cbm_calls_pushFunction · 0.85

Tested by

no test coverage detected