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

Function extract_param_names

internal/cbm/extract_defs.c:2732–2767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2730}
2731
2732static const char **extract_param_names(CBMArena *a, TSNode params, const char *source,
2733 CBMLanguage lang) {
2734 (void)lang;
2735 if (ts_node_is_null(params)) {
2736 return NULL;
2737 }
2738
2739 const char *names[MAX_PARAMS];
2740 int count = 0;
2741
2742 uint32_t nc = ts_node_child_count(params);
2743 for (uint32_t i = 0; i < nc && count < MAX_PARAMS_MINUS_1; i++) {
2744 TSNode param = ts_node_child(params, i);
2745 if (ts_node_is_null(param) || !ts_node_is_named(param)) {
2746 continue;
2747 }
2748
2749 char *name_text = resolve_param_name(a, param, source);
2750
2751 if (name_text && name_text[0]) {
2752 names[count++] = name_text;
2753 }
2754 }
2755
2756 if (count == 0) {
2757 return NULL;
2758 }
2759
2760 const char **result =
2761 (const char **)cbm_arena_alloc(a, (count + NULL_TERM) * sizeof(const char *));
2762 for (int i = 0; i < count; i++) {
2763 result[i] = names[i];
2764 }
2765 result[count] = NULL;
2766 return result;
2767}
2768
2769// Extract return_types from a return type node.
2770// Parses Go-style multi-return (T1, T2) and single return types.

Callers 1

extract_func_defFunction · 0.70

Calls 2

resolve_param_nameFunction · 0.85
cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected