stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every balanced `<…>` group; `<` and `>` never reach the output.
(name: &str)
| 194 | /// stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every |
| 195 | /// balanced `<…>` group; `<` and `>` never reach the output. |
| 196 | fn strip_cpp_template_args(name: &str) -> String { |
| 197 | if !name.contains('<') { |
| 198 | return name.to_string(); |
| 199 | } |
| 200 | let mut out = String::with_capacity(name.len()); |
| 201 | let mut depth = 0u32; |
| 202 | for ch in name.chars() { |
| 203 | if ch == '<' { |
| 204 | depth += 1; |
| 205 | } else if ch == '>' { |
| 206 | depth = depth.saturating_sub(1); |
| 207 | } else if depth == 0 { |
| 208 | out.push(ch); |
| 209 | } |
| 210 | } |
| 211 | out.trim().to_string() |
| 212 | } |
| 213 | |
| 214 | /// recoverMangledCppName (languages/c-cpp.ts) — universal post-hoc salvage for |
| 215 | /// a name still mangled by an unblanked macro ("Ret name" → "name"). |
no test coverage detected