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

Method extract_class

codegraph-kernel/src/scala.rs:742–769  ·  view source on GitHub ↗
(&mut self, node: Node<'t>, kind: &'static str)

Source from the content-addressed store, hash-verified

740 // --- extractClass (:1679) — classes, objects, traits ------------------
741
742 fn extract_class(&mut self, node: Node<'t>, kind: &'static str) {
743 stack_guard!();
744 let resolved_body = node.child_by_field_name("body"); // template_body
745 // No skipBodilessClass — bodiless mints (scala-complete).
746 let name = self.extract_name(node);
747 let docstring = preceding_docstring(node, self.src);
748 let visibility = self.visibility_of(node);
749 let row = self.create_node(
750 kind,
751 &name,
752 node,
753 Extra { docstring, visibility, ..Default::default() },
754 );
755 let Some(row) = row else { return };
756 self.extract_inheritance(node, row);
757 self.extract_decorators_for(node, row);
758 self.stack.push(Scope { row, kind, name });
759 // THE ASYMMETRY: bodiless classes walk the node ITSELF — header
760 // children (class_parameters defaults, extends args) reach the
761 // ladder; bodied classes walk only template_body children.
762 let body = resolved_body.unwrap_or(node);
763 let mut cursor = body.walk();
764 let children: Vec<Node<'t>> = body.named_children(&mut cursor).collect();
765 for child in children {
766 self.visit(child);
767 }
768 self.stack.pop();
769 }
770
771 // --- extractEnum (:1914) ----------------------------------------------
772

Callers 2

visitMethod · 0.45
visit_bodyMethod · 0.45

Calls 8

preceding_docstringFunction · 0.85
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
collectMethod · 0.45
visitMethod · 0.45

Tested by

no test coverage detected