Strip a trailing generic argument list ("<...>" / "[...]") from a type name, returning the bare type identifier. Mutates an arena-owned copy in place.
| 197 | // Strip a trailing generic argument list ("<...>" / "[...]") from a type name, |
| 198 | // returning the bare type identifier. Mutates an arena-owned copy in place. |
| 199 | static char *strip_generic_args(char *t) { |
| 200 | if (!t) { |
| 201 | return NULL; |
| 202 | } |
| 203 | char *angle = strchr(t, '<'); |
| 204 | if (angle) { |
| 205 | *angle = '\0'; |
| 206 | } |
| 207 | char *brack = strchr(t, '['); |
| 208 | if (brack) { |
| 209 | *brack = '\0'; |
| 210 | } |
| 211 | return t; |
| 212 | } |
| 213 | |
| 214 | // Pull the constructed type name out of a constructor/instantiation node: |
| 215 | // new_expression (TS/JS) -> `constructor`/`type` field or first type child |
no outgoing calls
no test coverage detected