MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_function_signature

Method build_function_signature

atomic-semantic/src/parsers/cpp.rs:669–683  ·  view source on GitHub ↗

Build a function signature from the return type and declarator.

(&self, node: &Node, source: &str)

Source from the content-addressed store, hash-verified

667
668 /// Build a function signature from the return type and declarator.
669 fn build_function_signature(&self, node: &Node, source: &str) -> Option<String> {
670 let full_text = self.node_text(node, source);
671 // Take everything up to the opening brace
672 if let Some(brace_pos) = full_text.find('{') {
673 let sig = full_text[..brace_pos].trim();
674 // Collapse whitespace for cleaner signatures
675 let collapsed: String = sig.split_whitespace().collect::<Vec<_>>().join(" ");
676 Some(collapsed)
677 } else {
678 // No body (prototype / forward declaration) — use full text
679 let trimmed = full_text.trim().trim_end_matches(';');
680 let collapsed: String = trimmed.split_whitespace().collect::<Vec<_>>().join(" ");
681 Some(collapsed)
682 }
683 }
684
685 // ── Helpers ─────────────────────────────────────────────────────
686

Callers 1

extract_functionMethod · 0.45

Calls 1

node_textMethod · 0.45

Tested by

no test coverage detected