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

Method extract_struct

codegraph-kernel/src/csharp.rs:723–749  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

721 }
722
723 fn extract_struct(&mut self, node: Node<'t>) {
724 stack_guard!();
725 // Body gate — EXCEPT C# positional records (`record struct M(…);`,
726 // node type record_declaration), complete definitions with no body.
727 // A bodiless `struct Fwd;` mints NO node. (#831)
728 let body = node.child_by_field_name("body");
729 if body.is_none() && node.kind() != "record_declaration" {
730 return;
731 }
732 let name = self.extract_name(node);
733 let extra = Extra {
734 docstring: preceding_docstring(node, self.src),
735 visibility: Some(self.visibility_of(node)),
736 ..Extra::default()
737 };
738 let Some(row) = self.create_node("struct", &name, node, extra) else { return };
739 self.extract_inheritance(node, row);
740 self.extract_primary_ctor_param_refs(node, row);
741 // NOTE: extractStruct does NOT call extractDecoratorsFor (TS parity).
742 if let Some(body) = body {
743 self.stack.push(Scope { row, kind: "struct", name });
744 for c in body.named_children(&mut body.walk()) {
745 self.visit_node(c);
746 }
747 self.stack.pop();
748 }
749 }
750
751 fn extract_interface(&mut self, node: Node<'t>) {
752 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 9

preceding_docstringFunction · 0.85
pushMethod · 0.80
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
walkMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected