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

Method extract_class

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

Source from the content-addressed store, hash-verified

759 // --- extractClass (:1679) — classes, objects, traits ------------------
760
761 fn extract_class(&mut self, node: Node<'t>, kind: &'static str) {
762 stack_guard!();
763 let resolved_body = node.child_by_field_name("body"); // template_body
764 // No skipBodilessClass — bodiless mints (scala-complete).
765 let name = self.extract_name(node);
766 let docstring = preceding_docstring(node, self.src);
767 let visibility = self.visibility_of(node);
768 let row = self.create_node(
769 kind,
770 &name,
771 node,
772 Extra { docstring, visibility, ..Default::default() },
773 );
774 let Some(row) = row else { return };
775 self.extract_inheritance(node, row);
776 self.extract_decorators_for(node, row);
777 self.stack.push(Scope { row, kind, name });
778 // THE ASYMMETRY: bodiless classes walk the node ITSELF — header
779 // children (class_parameters defaults, extends args) reach the
780 // ladder; bodied classes walk only template_body children.
781 let body = resolved_body.unwrap_or(node);
782 let mut cursor = body.walk();
783 let children: Vec<Node<'t>> = body.named_children(&mut cursor).collect();
784 for child in children {
785 self.visit(child);
786 }
787 self.stack.pop();
788 }
789
790 // --- extractEnum (:1914) ----------------------------------------------
791

Callers 2

visitMethod · 0.45
visit_bodyMethod · 0.45

Calls 10

preceding_docstringFunction · 0.85
pushMethod · 0.80
walkMethod · 0.80
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