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

Method cpp_specialized_function_name

codegraph-kernel/src/ccpp/mod.rs:810–826  ·  view source on GitHub ↗

cppSpecializedFunctionName (languages/c-cpp.ts): the name of a function an explicit specialization defines, without its template arguments (`Swap` for `template <> void Swap (Foo& a, Foo& b)`).

(&self, node: Node)

Source from the content-addressed store, hash-verified

808 /// function an explicit specialization defines, without its template
809 /// arguments (`Swap` for `template <> void Swap<Foo>(Foo& a, Foo& b)`).
810 fn cpp_specialized_function_name(&self, node: Node) -> Option<String> {
811 if node.kind() != "function_definition" {
812 return None;
813 }
814 let mut declarator = node.child_by_field_name("declarator")?;
815 while matches!(declarator.kind(), "pointer_declarator" | "reference_declarator") {
816 declarator = declarator.child_by_field_name("declarator").or_else(|| declarator.named_child(0))?;
817 }
818 if declarator.kind() != "function_declarator" {
819 return None;
820 }
821 let inner = declarator.child_by_field_name("declarator")?;
822 if inner.kind() != "template_function" {
823 return None;
824 }
825 Some(self.cpp_defined_name(inner))
826 }
827
828 /// recoverSingleArgMacroDefinedName: only a local macro definition proves
829 /// that its argument is the function name, in either parser shape (#1373).

Callers 1

extract_name_rawMethod · 0.80

Calls 1

cpp_defined_nameMethod · 0.80

Tested by

no test coverage detected