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

Method extract_enum

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

Source from the content-addressed store, hash-verified

771 // --- extractEnum (:1914) ----------------------------------------------
772
773 fn extract_enum(&mut self, node: Node<'t>) {
774 stack_guard!();
775 let body = match node.child_by_field_name("body") {
776 Some(b) => b,
777 None => return, // bodiless enum mints nothing
778 };
779 let name = self.extract_name(node);
780 let docstring = preceding_docstring(node, self.src);
781 let visibility = self.visibility_of(node);
782 let row = self.create_node(
783 "enum",
784 &name,
785 node,
786 Extra { docstring, visibility, ..Default::default() },
787 );
788 let Some(row) = row else { return };
789 self.extract_inheritance(node, row);
790 // No extractDecoratorsFor on the enum path (annotated enums emit no
791 // decorates — shared-pipeline behavior).
792 self.stack.push(Scope { row, kind: "enum", name });
793 // enumMemberTypes is EMPTY → every body child goes through visitNode
794 // (enum_case_definitions hits the hook; defs become methods).
795 let mut cursor = body.walk();
796 let children: Vec<Node<'t>> = body.named_children(&mut cursor).collect();
797 for child in children {
798 self.visit(child);
799 }
800 self.stack.pop();
801 }
802
803 // --- extractTypeAlias (:2890, plain path :2967-2991) ------------------
804

Callers 2

visitMethod · 0.45
visit_bodyMethod · 0.45

Calls 7

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