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

Method constructor_signature

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

cppExtractor.getSignature (languages/c-cpp.ts): a C++ constructor definition or class-body prototype carries its parameter list as the signature so a local `T obj(args)` can pick the overload by arity (#1839); a trailing semicolon marks a prototype. Macro-shaped definitions whose real name was recovered from an argument are excluded.

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1859 /// by arity (#1839); a trailing semicolon marks a prototype. Macro-shaped definitions whose real name was
1860 /// recovered from an argument are excluded.
1861 fn constructor_signature(&self, node: Node<'t>) -> Option<String> {
1862 if self.variant != Variant::Cpp || (node.kind() != "function_definition" && !self.is_cpp_constructor_declaration(node)) {
1863 return None;
1864 }
1865 if node.child_by_field_name("type").is_some() || self.recover_cpp_macro_defined_name(node).is_some() {
1866 return None;
1867 }
1868 let params = node.child_by_field_name("declarator")?.child_by_field_name("parameters")?;
1869 Some(format!("{}{}", self.text(params), if node.kind() == "declaration" { ";" } else { "" }))
1870 }
1871
1872 /// cppStackConstructions (tree-sitter.ts, #1035 / #1839): whether the
1873 /// declaration constructs with arguments (→ `instantiates`), and one

Callers 2

extract_functionMethod · 0.45
extract_methodMethod · 0.45

Tested by

no test coverage detected