stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every balanced `<…>` group; `<` and `>` never reach the output.
(name: &str)
| 225 | /// stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every |
| 226 | /// balanced `<…>` group; `<` and `>` never reach the output. |
| 227 | fn strip_cpp_template_args(name: &str) -> String { |
| 228 | if !name.contains('<') { |
| 229 | return name.to_string(); |
| 230 | } |
| 231 | let mut out = String::with_capacity(name.len()); |
| 232 | let mut depth = 0u32; |
| 233 | for ch in name.chars() { |
| 234 | if ch == '<' { |
| 235 | depth += 1; |
| 236 | } else if ch == '>' { |
| 237 | depth = depth.saturating_sub(1); |
| 238 | } else if depth == 0 { |
| 239 | out.push(ch); |
| 240 | } |
| 241 | } |
| 242 | out.trim().to_string() |
| 243 | } |
| 244 | |
| 245 | /// recoverMangledCppName (languages/c-cpp.ts) — universal post-hoc salvage for |
| 246 | /// a name still mangled by an unblanked macro ("Ret name" → "name"). |
no test coverage detected