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

Method extract_struct

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

Source from the content-addressed store, hash-verified

660 }
661
662 fn extract_struct(&mut self, node: Node<'t>) {
663 stack_guard!();
664 // Body gate — EXCEPT C# positional records (`record struct M(…);`,
665 // node type record_declaration), complete definitions with no body.
666 // A bodiless `struct Fwd;` mints NO node. (#831)
667 let body = node.child_by_field_name("body");
668 if body.is_none() && node.kind() != "record_declaration" {
669 return;
670 }
671 let name = self.extract_name(node);
672 let extra = Extra {
673 docstring: preceding_docstring(node, self.src),
674 visibility: Some(self.visibility_of(node)),
675 ..Extra::default()
676 };
677 let Some(row) = self.create_node("struct", &name, node, extra) else { return };
678 self.extract_inheritance(node, row);
679 self.extract_primary_ctor_param_refs(node, row);
680 // NOTE: extractStruct does NOT call extractDecoratorsFor (TS parity).
681 if let Some(body) = body {
682 self.stack.push(Scope { row, kind: "struct", name });
683 for i in 0..body.named_child_count() {
684 if let Some(c) = body.named_child(i) {
685 self.visit_node(c);
686 }
687 }
688 self.stack.pop();
689 }
690 }
691
692 fn extract_interface(&mut self, node: Node<'t>) {
693 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 7

preceding_docstringFunction · 0.85
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