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

Method cpp_specialized_function_name

codegraph-kernel/src/ccpp/mod.rs:808–824  ·  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

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