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

Function defining_declaration

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

definingDeclaration (languages/c-cpp.ts): the `declaration` a class-like definition is the type of (`struct Foo { … } foo;`). Its comment documents the type, and an unnamed type takes the name of its first variable.

(node: Node)

Source from the content-addressed store, hash-verified

2680/// definition is the type of (`struct Foo { … } foo;`). Its comment documents
2681/// the type, and an unnamed type takes the name of its first variable.
2682fn defining_declaration(node: Node) -> Option<Node> {
2683 if !is_class_like_definition(node) {
2684 return None;
2685 }
2686 let parent = node.parent()?;
2687 let is_type = parent.child_by_field_name("type").map(|t| t.id()) == Some(node.id());
2688 (parent.kind() == "declaration" && is_type).then_some(parent)
2689}
2690
2691/// isMacroMisparsedTypeDecl (languages/c-cpp.ts:261): `class MACRO Name {…}`
2692/// misparse residue — bodyless class/struct specifier in `type` + a

Callers 2

class_like_docstringMethod · 0.85

Calls 3

is_class_like_definitionFunction · 0.85
mapMethod · 0.80
idMethod · 0.80

Tested by

no test coverage detected