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

Function cbm_func_name_node_text

internal/cbm/helpers.c:848–870  ·  view source on GitHub ↗

Convert a resolved function/method name node to its name string. Most nodes map directly to their text, but a C++ conversion-operator's `operator_cast` node spans the full "operator bool() const" — this grammar folds the parameter list and cv-qualifiers into the node. The method's name is only the "operator " prefix, so truncate at the first '(' and trim trailing space. Without this the conv

Source from the content-addressed store, hash-verified

846// const", and a member lookup for "operator bool" (the implicit call in
847// `if (obj)`) misses.
848char *cbm_func_name_node_text(CBMArena *a, TSNode name_node, const char *source, CBMLanguage lang) {
849 char *text = cbm_node_text(a, name_node, source);
850 if (text && strcmp(ts_node_type(name_node), "operator_cast") == 0) {
851 char *paren = strchr(text, '(');
852 if (paren) {
853 while (paren > text && (paren[-1] == ' ' || paren[-1] == '\t')) {
854 paren--;
855 }
856 *paren = '\0';
857 }
858 }
859 /* Nix quoted attrpath segment: `"kebab-case" = a: a;` and `services."my.svc" = …`
860 * are ordinary names that merely need quoting in source. The node text carries
861 * the delimiters, so without this the def is named `"kebab-case"` — quotes and
862 * all — and every consumer keying on the name (search, CALLS resolution, the
863 * LSP join) would have to know to re-quote. Stripped here rather than in the
864 * resolver so the def name and the call-scope QN, which both route through this
865 * function, cannot disagree. */
866 if (text && lang == CBM_LANG_NIX) {
867 cbm_nix_strip_attr_quotes(text);
868 }
869 return text;
870}
871
872/* ── Nix attrpath helpers ───────────────────────────────────
873 * A Nix binding's name is a PATH (`a.b.c = …`), whose segments may be quoted or

Callers 4

extract_func_defFunction · 0.85
push_method_defFunction · 0.85
func_node_nameFunction · 0.85
compute_func_qnFunction · 0.85

Calls 2

cbm_node_textFunction · 0.85

Tested by

no test coverage detected