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
| 833 | // const", and a member lookup for "operator bool" (the implicit call in |
| 834 | // `if (obj)`) misses. |
| 835 | char *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 | |
| 849 | static const char *func_node_name(CBMArena *a, TSNode func_node, const char *source, |
| 850 | CBMLanguage lang) { |
no test coverage detected