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

Method extract_struct

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

Source from the content-addressed store, hash-verified

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