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

Function strip_generic_and_qualifier

codegraph-kernel/src/csharp.rs:1597–1616  ·  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

1595/// keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`,
1596/// trim. (The vbnet paren strip in the TS path is vbnet-gated — inert here.)
1597fn strip_generic_and_qualifier(raw: &str) -> String {
1598 let mut name = raw.to_string();
1599 if let Some(lt) = name.find('<') {
1600 if lt > 0 {
1601 name.truncate(lt);
1602 }
1603 }
1604 let last_dot = name
1605 .rfind('.')
1606 .map(|i| i as isize)
1607 .unwrap_or(-1)
1608 .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1));
1609 if last_dot >= 0 {
1610 name = name[(last_dot as usize + 1)..].to_string();
1611 if name.starts_with(':') || name.starts_with('.') {
1612 name.remove(0);
1613 }
1614 }
1615 name.trim().to_string()
1616}
1617
1618fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef {
1619 match s {

Callers 2

extract_instantiationMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected