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

Function fold_node

internal/cbm/extract_url_fold.c:275–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275static const char *fold_node(CBMExtractCtx *ctx, TSNode node, int depth, bool url) {
276 if (depth > FOLD_MAX_DEPTH || ts_node_is_null(node)) {
277 return NULL;
278 }
279 const char *k = ts_node_type(node);
280 if (strcmp(k, "string") == 0 || strcmp(k, "template_string") == 0) {
281 return fold_string_like(ctx, node, depth, url);
282 }
283 if (strcmp(k, "identifier") == 0 || strcmp(k, "member_expression") == 0) {
284 return fold_reference(ctx, node, url);
285 }
286 if (strcmp(k, "binary_expression") == 0 || strcmp(k, "binary_operator") == 0) {
287 return fold_concat(ctx, node, depth, url);
288 }
289 if (strcmp(k, "concatenated_string") == 0) {
290 return fold_implicit_concat(ctx, node, depth, url);
291 }
292 if (is_transparent_wrapper(k) && ts_node_named_child_count(node) > 0) {
293 return fold_node(ctx, ts_node_named_child(node, 0), depth + SKIP_ONE, url);
294 }
295 return NULL;
296}
297
298/* --- constants ------------------------------------------------------- */
299

Callers 5

fold_partFunction · 0.85
record_valueFunction · 0.85
cbm_url_fold_call_urlFunction · 0.85
cbm_url_fold_exactFunction · 0.85
cbm_url_fold_call_rawFunction · 0.85

Calls 5

fold_string_likeFunction · 0.85
fold_referenceFunction · 0.85
fold_concatFunction · 0.85
fold_implicit_concatFunction · 0.85
is_transparent_wrapperFunction · 0.85

Tested by

no test coverage detected