The shared decorator-name normalization.
(raw: &str)
| 1550 | |
| 1551 | /// The shared decorator-name normalization. |
| 1552 | fn strip_generic_and_qualifier(raw: &str) -> String { |
| 1553 | let mut name = raw.to_string(); |
| 1554 | if let Some(lt) = name.find('<') { |
| 1555 | if lt > 0 { |
| 1556 | name.truncate(lt); |
| 1557 | } |
| 1558 | } |
| 1559 | let last_dot = name |
| 1560 | .rfind('.') |
| 1561 | .map(|i| i as isize) |
| 1562 | .unwrap_or(-1) |
| 1563 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1564 | if last_dot >= 0 { |
| 1565 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1566 | if name.starts_with(':') || name.starts_with('.') { |
| 1567 | name.remove(0); |
| 1568 | } |
| 1569 | } |
| 1570 | name.trim().to_string() |
| 1571 | } |
| 1572 | |
| 1573 | fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef { |
| 1574 | match s { |