MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / strip_generic_and_qualifier

Function strip_generic_and_qualifier

codegraph-kernel/src/csharp.rs:1732–1751  ·  view source on GitHub ↗

The `new ns.Foo ()` name normalization shared by instantiation / anonymous-class extraction: strip `<...` from the first `<` (index > 0), keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`, trim. (The vbnet paren strip in the TS path is vbnet-gated — inert here.)

(raw: &str)

Source from the content-addressed store, hash-verified

1730/// keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`,
1731/// trim. (The vbnet paren strip in the TS path is vbnet-gated — inert here.)
1732fn strip_generic_and_qualifier(raw: &str) -> String {
1733 let mut name = raw.to_string();
1734 if let Some(lt) = name.find('<') {
1735 if lt > 0 {
1736 name.truncate(lt);
1737 }
1738 }
1739 let last_dot = name
1740 .rfind('.')
1741 .map(|i| i as isize)
1742 .unwrap_or(-1)
1743 .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1));
1744 if last_dot >= 0 {
1745 name = name[(last_dot as usize + 1)..].to_string();
1746 if name.starts_with(':') || name.starts_with('.') {
1747 name.remove(0);
1748 }
1749 }
1750 name.trim().to_string()
1751}
1752
1753fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef {
1754 match s {

Callers 2

extract_instantiationMethod · 0.70

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected