Append a base name (generic args stripped) to out[] if non-empty.
| 2078 | |
| 2079 | // Append a base name (generic args stripped) to out[] if non-empty. |
| 2080 | static void push_base_text(CBMArena *a, TSNode n, const char *source, const char **out, int out_cap, |
| 2081 | int *count) { |
| 2082 | if (*count >= out_cap) { |
| 2083 | return; |
| 2084 | } |
| 2085 | char *t = cbm_node_text(a, n, source); |
| 2086 | if (!t) { |
| 2087 | return; |
| 2088 | } |
| 2089 | char *angle = strchr(t, '<'); |
| 2090 | if (angle) { |
| 2091 | *angle = '\0'; |
| 2092 | } |
| 2093 | /* PHP qualified base may be backslash-prefixed (e.g. `\RuntimeException`); |
| 2094 | * keep the bare class name so it matches the unqualified declaration. */ |
| 2095 | char *last_bs = strrchr(t, '\\'); |
| 2096 | if (last_bs) { |
| 2097 | t = last_bs + 1; |
| 2098 | } |
| 2099 | if (t[0]) { |
| 2100 | out[(*count)++] = t; |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | /* TypeScript/TSX: bases live in a `class_heritage` (class) or directly in an |
| 2105 | * `extends_type_clause` (interface). The extractor previously captured the |
no test coverage detected