Extract a record declaration.
(state: &mut ExtractionState, node: TsNode<'_>)
| 949 | |
| 950 | /// Extract a record declaration. |
| 951 | fn visit_record(state: &mut ExtractionState, node: TsNode<'_>) { |
| 952 | let name = Self::extract_name(state, node).unwrap_or_else(|| "<anonymous>".to_string()); |
| 953 | let visibility = Self::extract_csharp_visibility(node, state); |
| 954 | let docstring = Self::extract_xml_docstring(state, node); |
| 955 | let signature = Some(Self::extract_declaration_signature(state, node)); |
| 956 | let start_line = node.start_position().row as u32; |
| 957 | let end_line = node.end_position().row as u32; |
| 958 | let start_column = node.start_position().column as u32; |
| 959 | let end_column = node.end_position().column as u32; |
| 960 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 961 | let id = generate_node_id(&state.file_path, &NodeKind::Record, &name, start_line); |
| 962 | |
| 963 | let graph_node = Node { |
| 964 | id: id.clone(), |
| 965 | kind: NodeKind::Record, |
| 966 | name: name.clone(), |
| 967 | qualified_name, |
| 968 | file_path: state.file_path.clone(), |
| 969 | start_line, |
| 970 | attrs_start_line: start_line, |
| 971 | end_line, |
| 972 | start_column, |
| 973 | end_column, |
| 974 | signature, |
| 975 | docstring, |
| 976 | visibility, |
| 977 | is_async: false, |
| 978 | branches: 0, |
| 979 | loops: 0, |
| 980 | returns: 0, |
| 981 | max_nesting: 0, |
| 982 | unsafe_blocks: 0, |
| 983 | unchecked_calls: 0, |
| 984 | assertions: 0, |
| 985 | updated_at: state.timestamp, |
| 986 | parent_id: None, |
| 987 | }; |
| 988 | state.nodes.push(graph_node); |
| 989 | |
| 990 | // Contains edge from parent. |
| 991 | if let Some(parent_id) = state.parent_node_id() { |
| 992 | state.edges.push(Edge { |
| 993 | source: parent_id.to_string(), |
| 994 | target: id.clone(), |
| 995 | kind: EdgeKind::Contains, |
| 996 | line: Some(start_line), |
| 997 | }); |
| 998 | } |
| 999 | |
| 1000 | // Visit record body if present. |
| 1001 | state.node_stack.push((name, id)); |
| 1002 | state.class_depth += 1; |
| 1003 | if let Some(body) = node.child_by_field_name("body") { |
| 1004 | Self::visit_children(state, body); |
| 1005 | } |
| 1006 | state.class_depth -= 1; |
| 1007 | state.node_stack.pop(); |
| 1008 | } |
nothing calls this directly
no test coverage detected