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

Method extract_struct

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

Source from the content-addressed store, hash-verified

734 }
735
736 fn extract_struct(&mut self, node: Node<'t>) {
737 stack_guard!();
738 // Body gate — EXCEPT C# positional records (`record struct M(…);`,
739 // node type record_declaration), complete definitions with no body.
740 // A bodiless `struct Fwd;` mints NO node. (#831)
741 let body = node.child_by_field_name("body");
742 if body.is_none() && node.kind() != "record_declaration" {
743 return;
744 }
745 let name = self.extract_name(node);
746 let extra = Extra {
747 docstring: preceding_docstring(node, self.src),
748 visibility: Some(self.visibility_of(node)),
749 ..Extra::default()
750 };
751 let Some(row) = self.create_node("struct", &name, node, extra) else { return };
752 self.extract_inheritance(node, row);
753 self.extract_primary_ctor_param_refs(node, row);
754 // NOTE: extractStruct does NOT call extractDecoratorsFor (TS parity).
755 if let Some(body) = body {
756 self.stack.push(Scope { row, kind: "struct", name });
757 for i in 0..body.named_child_count() {
758 if let Some(c) = body.named_child(i) {
759 self.visit_node(c);
760 }
761 }
762 self.stack.pop();
763 }
764 }
765
766 fn extract_interface(&mut self, node: Node<'t>) {
767 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 8

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

Tested by

no test coverage detected