Extract a static initializer block.
(state: &mut ExtractionState, node: TsNode<'_>)
| 874 | |
| 875 | /// Extract a static initializer block. |
| 876 | fn visit_static_initializer(state: &mut ExtractionState, node: TsNode<'_>) { |
| 877 | let start_line = node.start_position().row as u32; |
| 878 | let end_line = node.end_position().row as u32; |
| 879 | let start_column = node.start_position().column as u32; |
| 880 | let end_column = node.end_position().column as u32; |
| 881 | let name = format!("<static_init>:{start_line}"); |
| 882 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 883 | let id = generate_node_id(&state.file_path, &NodeKind::InitBlock, &name, start_line); |
| 884 | |
| 885 | let graph_node = Node { |
| 886 | id: id.clone(), |
| 887 | kind: NodeKind::InitBlock, |
| 888 | name, |
| 889 | qualified_name, |
| 890 | file_path: state.file_path.clone(), |
| 891 | start_line, |
| 892 | attrs_start_line: start_line, |
| 893 | end_line, |
| 894 | start_column, |
| 895 | end_column, |
| 896 | signature: Some("static { ... }".to_string()), |
| 897 | docstring: None, |
| 898 | visibility: Visibility::Private, |
| 899 | is_async: false, |
| 900 | branches: 0, |
| 901 | loops: 0, |
| 902 | returns: 0, |
| 903 | max_nesting: 0, |
| 904 | unsafe_blocks: 0, |
| 905 | unchecked_calls: 0, |
| 906 | assertions: 0, |
| 907 | updated_at: state.timestamp, |
| 908 | parent_id: None, |
| 909 | }; |
| 910 | state.nodes.push(graph_node); |
| 911 | |
| 912 | // Contains edge from parent. |
| 913 | if let Some(parent_id) = state.parent_node_id() { |
| 914 | state.edges.push(Edge { |
| 915 | source: parent_id.to_string(), |
| 916 | target: id, |
| 917 | kind: EdgeKind::Contains, |
| 918 | line: Some(start_line), |
| 919 | }); |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | // ---------------------------- |
| 924 | // Helper extraction methods |
nothing calls this directly
no test coverage detected