MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / visit_enum

Method visit_enum

src/extraction/csharp_extractor.rs:513–568  ·  view source on GitHub ↗

Extract an enum declaration with its members.

(state: &mut ExtractionState, node: TsNode<'_>)

Source from the content-addressed store, hash-verified

511
512 /// Extract an enum declaration with its members.
513 fn visit_enum(state: &mut ExtractionState, node: TsNode<'_>) {
514 let name = Self::extract_name(state, node).unwrap_or_else(|| "<anonymous>".to_string());
515 let visibility = Self::extract_csharp_visibility(node, state);
516 let docstring = Self::extract_xml_docstring(state, node);
517 let signature = Some(Self::extract_declaration_signature(state, node));
518 let start_line = node.start_position().row as u32;
519 let end_line = node.end_position().row as u32;
520 let start_column = node.start_position().column as u32;
521 let end_column = node.end_position().column as u32;
522 let qualified_name = format!("{}::{}", state.qualified_prefix(), name);
523 let id = generate_node_id(&state.file_path, &NodeKind::Enum, &name, start_line);
524
525 let graph_node = Node {
526 id: id.clone(),
527 kind: NodeKind::Enum,
528 name: name.clone(),
529 qualified_name,
530 file_path: state.file_path.clone(),
531 start_line,
532 attrs_start_line: start_line,
533 end_line,
534 start_column,
535 end_column,
536 signature,
537 docstring,
538 visibility,
539 is_async: false,
540 branches: 0,
541 loops: 0,
542 returns: 0,
543 max_nesting: 0,
544 unsafe_blocks: 0,
545 unchecked_calls: 0,
546 assertions: 0,
547 updated_at: state.timestamp,
548 parent_id: None,
549 };
550 state.nodes.push(graph_node);
551
552 // Contains edge from parent.
553 if let Some(parent_id) = state.parent_node_id() {
554 state.edges.push(Edge {
555 source: parent_id.to_string(),
556 target: id.clone(),
557 kind: EdgeKind::Contains,
558 line: Some(start_line),
559 });
560 }
561
562 // Extract enum members from the body.
563 state.node_stack.push((name, id));
564 if let Some(body) = node.child_by_field_name("body") {
565 Self::extract_enum_members(state, body);
566 }
567 state.node_stack.pop();
568 }
569
570 /// Extract enum members from an `enum_member_declaration_list`.

Callers

nothing calls this directly

Calls 3

generate_node_idFunction · 0.85
pushMethod · 0.80
parent_node_idMethod · 0.45

Tested by

no test coverage detected