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

Method extract_enum

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

Source from the content-addressed store, hash-verified

494 }
495
496 pub(super) fn extract_enum(&mut self, node: Node<'t>) {
497 let Some(body) = body_of(node) else { return };
498 let name = self.extract_name(node);
499 let extra = Extra {
500 docstring: crate::docstring::preceding_docstring(node, self.src),
501 visibility: self.visibility_of(node),
502 is_exported: Some(self.is_exported(node)),
503 ..Extra::default()
504 };
505 let Some(row) = self.create_node("enum", &name, node, extra) else {
506 return;
507 };
508 self.extract_inheritance(node, row);
509 self.stack.push(Scope { row, kind: "enum", name });
510 for i in 0..body.named_child_count() {
511 let Some(child) = body.named_child(i) else { continue };
512 if matches!(child.kind(), "property_identifier" | "enum_assignment") {
513 self.extract_enum_members(child);
514 } else {
515 self.visit_node(child);
516 }
517 }
518 self.stack.pop();
519 }
520
521 fn extract_enum_members(&mut self, node: Node<'t>) {
522 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