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

Method extract_interface

codegraph-kernel/src/rustlang.rs:563–580  ·  view source on GitHub ↗

extractInterface — kind `trait` (interfaceKind), inheritance from trait_bounds, body children visited with the trait pushed.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

561 /// extractInterface — kind `trait` (interfaceKind), inheritance from
562 /// trait_bounds, body children visited with the trait pushed.
563 fn extract_interface(&mut self, node: Node<'t>) {
564 let name = self.extract_name(node);
565 let extra = Extra {
566 docstring: preceding_docstring(node, self.src),
567 ..Extra::default() // no visibility/isExported on the interface path
568 };
569 let Some(row) = self.create_node("trait", &name, node, extra) else { return };
570 self.extract_inheritance(node, row);
571
572 self.stack.push(Scope { row, kind: "trait", name });
573 let body = node.child_by_field_name("body").unwrap_or(node);
574 for i in 0..body.named_child_count() {
575 if let Some(c) = body.named_child(i) {
576 self.visit_node(c);
577 }
578 }
579 self.stack.pop();
580 }
581
582 /// extractStruct — body field REQUIRED (unit structs mint no node; tuple
583 /// structs' ordered_field_declaration_list is a body).

Callers 2

visit_nodeMethod · 0.45

Calls 5

preceding_docstringFunction · 0.85
extract_nameMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected