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

Method extract_enum

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

Source from the content-addressed store, hash-verified

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