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

Method extract_enum

codegraph-kernel/src/tsjs/extractors.rs:592–615  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

590 }
591
592 pub(super) fn extract_enum(&mut self, node: Node<'t>) {
593 let Some(body) = body_of(node) else { return };
594 let name = self.extract_name(node);
595 let extra = Extra {
596 docstring: crate::docstring::preceding_docstring(node, self.src),
597 visibility: self.visibility_of(node),
598 is_exported: Some(self.is_exported(node)),
599 ..Extra::default()
600 };
601 let Some(row) = self.create_node("enum", &name, node, extra) else {
602 return;
603 };
604 self.extract_inheritance(node, row);
605 self.stack.push(Scope { row, kind: "enum", name });
606 for i in 0..body.named_child_count() {
607 let Some(child) = body.named_child(i) else { continue };
608 if matches!(child.kind(), "property_identifier" | "enum_assignment") {
609 self.extract_enum_members(child);
610 } else {
611 self.visit_node(child);
612 }
613 }
614 self.stack.pop();
615 }
616
617 fn extract_enum_members(&mut self, node: Node<'t>) {
618 if let Some(name_node) = node.child_by_field_name("name") {

Callers 2

visit_nodeMethod · 0.45

Calls 10

body_ofFunction · 0.85
preceding_docstringFunction · 0.85
pushMethod · 0.80
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
is_exportedMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
extract_enum_membersMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected