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:2119–2142  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2117
2118// Extract JSX component refs (uppercase tags) as CALLS edges.
2119static void extract_jsx_component_ref(CBMExtractCtx *ctx, TSNode node, const char *kind,
2120 const char *enclosing_func_qn) {
2121 if (strcmp(kind, "jsx_self_closing_element") != 0 && strcmp(kind, "jsx_opening_element") != 0) {
2122 return;
2123 }
2124 TSNode name_node = ts_node_child_by_field_name(node, TS_FIELD("name"));
2125 if (ts_node_is_null(name_node)) {
2126 return;
2127 }
2128 char *name = cbm_node_text(ctx->arena, name_node, ctx->source);
2129 if (name && name[0] >= 'A' && name[0] <= 'Z') {
2130 CBMCall call = {0};
2131 call.callee_name = name;
2132 call.enclosing_func_qn = enclosing_func_qn;
2133 call.site_start_byte = ts_node_start_byte(node);
2134 call.site_end_byte = ts_node_end_byte(node);
2135 /* An uppercase tag is only a component invocation when the TS resolver
2136 * proves which lexical value owns it. In particular, a parameter or
2137 * local named like a module component must not fall through to the
2138 * textual call resolver. */
2139 call.requires_lsp_resolution = true;
2140 cbm_calls_push(&ctx->result->calls, ctx->arena, call);
2141 }
2142}
2143
2144static bool kotlin_direct_unnamed_token(TSNode node, const char *token) {
2145 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