Extract a single enum constant as an `EnumVariant` node.
(state: &mut ExtractionState, node: TsNode<'_>)
| 562 | |
| 563 | /// Extract a single enum constant as an `EnumVariant` node. |
| 564 | fn extract_single_enum_constant(state: &mut ExtractionState, node: TsNode<'_>) { |
| 565 | let name = Self::extract_name(state, node).unwrap_or_else(|| "<anonymous>".to_string()); |
| 566 | let start_line = node.start_position().row as u32; |
| 567 | let end_line = node.end_position().row as u32; |
| 568 | let start_column = node.start_position().column as u32; |
| 569 | let end_column = node.end_position().column as u32; |
| 570 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 571 | let id = generate_node_id(&state.file_path, &NodeKind::EnumVariant, &name, start_line); |
| 572 | |
| 573 | let graph_node = Node { |
| 574 | id: id.clone(), |
| 575 | kind: NodeKind::EnumVariant, |
| 576 | name, |
| 577 | qualified_name, |
| 578 | file_path: state.file_path.clone(), |
| 579 | start_line, |
| 580 | attrs_start_line: start_line, |
| 581 | end_line, |
| 582 | start_column, |
| 583 | end_column, |
| 584 | signature: Some(state.node_text(node).trim().to_string()), |
| 585 | docstring: None, |
| 586 | visibility: Visibility::Pub, |
| 587 | is_async: false, |
| 588 | branches: 0, |
| 589 | loops: 0, |
| 590 | returns: 0, |
| 591 | max_nesting: 0, |
| 592 | unsafe_blocks: 0, |
| 593 | unchecked_calls: 0, |
| 594 | assertions: 0, |
| 595 | updated_at: state.timestamp, |
| 596 | parent_id: None, |
| 597 | }; |
| 598 | state.nodes.push(graph_node); |
| 599 | |
| 600 | // Contains edge from parent (the enum). |
| 601 | if let Some(parent_id) = state.parent_node_id() { |
| 602 | state.edges.push(Edge { |
| 603 | source: parent_id.to_string(), |
| 604 | target: id, |
| 605 | kind: EdgeKind::Contains, |
| 606 | line: Some(start_line), |
| 607 | }); |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | /// Extract an annotation type declaration (@interface). |
| 612 | fn visit_annotation_type(state: &mut ExtractionState, node: TsNode<'_>) { |
nothing calls this directly
no test coverage detected