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

Function strip_generic_and_qualifier

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

1770/// keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`,
1771/// trim. (The vbnet paren strip in the TS path is vbnet-gated — inert here.)
1772fn strip_generic_and_qualifier(raw: &str) -> String {
1773 let mut name = raw.to_string();
1774 if let Some(lt) = name.find('<') {
1775 if lt > 0 {
1776 name.truncate(lt);
1777 }
1778 }
1779 let last_dot = name
1780 .rfind('.')
1781 .map(|i| i as isize)
1782 .unwrap_or(-1)
1783 .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1));
1784 if last_dot >= 0 {
1785 name = name[(last_dot as usize + 1)..].to_string();
1786 if name.starts_with(':') || name.starts_with('.') {
1787 name.remove(0);
1788 }
1789 }
1790 name.trim().to_string()
1791}
1792
1793fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef {
1794 match s {

Callers 2

extract_instantiationMethod · 0.70

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected