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

Method extract_class

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

Source from the content-addressed store, hash-verified

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

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