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

Method extract_enum

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

Source from the content-addressed store, hash-verified

583 }
584
585 pub(super) fn extract_enum(&mut self, node: Node<'t>) {
586 let Some(body) = body_of(node) else { return };
587 let name = self.extract_name(node);
588 let extra = Extra {
589 docstring: crate::docstring::preceding_docstring(node, self.src),
590 visibility: self.visibility_of(node),
591 is_exported: Some(self.is_exported(node)),
592 ..Extra::default()
593 };
594 let Some(row) = self.create_node("enum", &name, node, extra) else {
595 return;
596 };
597 self.extract_inheritance(node, row);
598 self.stack.push(Scope { row, kind: "enum", name });
599 for child in body.named_children(&mut body.walk()) {
600 if matches!(child.kind(), "property_identifier" | "enum_assignment") {
601 self.extract_enum_members(child);
602 } else {
603 self.visit_node(child);
604 }
605 }
606 self.stack.pop();
607 }
608
609 fn extract_enum_members(&mut self, node: Node<'t>) {
610 if let Some(name_node) = node.child_by_field_name("name") {

Callers 2

visit_nodeMethod · 0.45

Calls 11

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
walkMethod · 0.45
extract_enum_membersMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected