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

Method extract_struct

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

Source from the content-addressed store, hash-verified

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

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