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

Function strip_generic_and_qualifier

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

1582/// keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`,
1583/// trim. (The vbnet paren strip in the TS path is vbnet-gated — inert here.)
1584fn strip_generic_and_qualifier(raw: &str) -> String {
1585 let mut name = raw.to_string();
1586 if let Some(lt) = name.find('<') {
1587 if lt > 0 {
1588 name.truncate(lt);
1589 }
1590 }
1591 let last_dot = name
1592 .rfind('.')
1593 .map(|i| i as isize)
1594 .unwrap_or(-1)
1595 .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1));
1596 if last_dot >= 0 {
1597 name = name[(last_dot as usize + 1)..].to_string();
1598 if name.starts_with(':') || name.starts_with('.') {
1599 name.remove(0);
1600 }
1601 }
1602 name.trim().to_string()
1603}
1604
1605fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef {
1606 match s {

Callers 2

extract_instantiationMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected