(state: &mut ExtractionState, node: TsNode<'_>)
| 251 | } |
| 252 | |
| 253 | fn visit_module(state: &mut ExtractionState, node: TsNode<'_>) { |
| 254 | let name = Self::find_child_text(state, node, "long_identifier") |
| 255 | .or_else(|| Self::find_child_text(state, node, "identifier")); |
| 256 | let Some(name) = name else { return }; |
| 257 | |
| 258 | let start_line = node.start_position().row as u32; |
| 259 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 260 | let id = generate_node_id(&state.file_path, &NodeKind::Module, &name, start_line); |
| 261 | |
| 262 | let graph_node = Node { |
| 263 | id: id.clone(), |
| 264 | kind: NodeKind::Module, |
| 265 | name: name.clone(), |
| 266 | qualified_name, |
| 267 | file_path: state.file_path.clone(), |
| 268 | start_line, |
| 269 | attrs_start_line: start_line, |
| 270 | end_line: node.end_position().row as u32, |
| 271 | start_column: node.start_position().column as u32, |
| 272 | end_column: node.end_position().column as u32, |
| 273 | signature: None, |
| 274 | docstring: None, |
| 275 | visibility: Visibility::Pub, |
| 276 | is_async: false, |
| 277 | branches: 0, |
| 278 | loops: 0, |
| 279 | returns: 0, |
| 280 | max_nesting: 0, |
| 281 | unsafe_blocks: 0, |
| 282 | unchecked_calls: 0, |
| 283 | assertions: 0, |
| 284 | updated_at: state.timestamp, |
| 285 | parent_id: None, |
| 286 | }; |
| 287 | state.nodes.push(graph_node); |
| 288 | |
| 289 | if let Some(parent_id) = state.parent_node_id() { |
| 290 | state.edges.push(Edge { |
| 291 | source: parent_id.to_string(), |
| 292 | target: id.clone(), |
| 293 | kind: EdgeKind::Contains, |
| 294 | line: Some(start_line), |
| 295 | }); |
| 296 | } |
| 297 | |
| 298 | state.node_stack.push((name, id)); |
| 299 | Self::visit_children(state, node); |
| 300 | state.node_stack.pop(); |
| 301 | } |
| 302 | |
| 303 | fn visit_namespace(state: &mut ExtractionState, node: TsNode<'_>) { |
| 304 | let name = Self::find_child_text(state, node, "long_identifier") |
nothing calls this directly
no test coverage detected