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:835–847  ·  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

833// const", and a member lookup for "operator bool" (the implicit call in
834// `if (obj)`) misses.
835char *cbm_func_name_node_text(CBMArena *a, TSNode name_node, const char *source) {
836 char *text = cbm_node_text(a, name_node, source);
837 if (text && strcmp(ts_node_type(name_node), "operator_cast") == 0) {
838 char *paren = strchr(text, '(');
839 if (paren) {
840 while (paren > text && (paren[-1] == ' ' || paren[-1] == '\t')) {
841 paren--;
842 }
843 *paren = '\0';
844 }
845 }
846 return text;
847}
848
849static const char *func_node_name(CBMArena *a, TSNode func_node, const char *source,
850 CBMLanguage lang) {

Callers 4

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

Calls 1

cbm_node_textFunction · 0.85

Tested by

no test coverage detected