(state: &mut ExtractionState, node: TsNode<'_>)
| 294 | } |
| 295 | |
| 296 | fn visit_module_definition(state: &mut ExtractionState, node: TsNode<'_>) { |
| 297 | // module_definition contains module_binding nodes. |
| 298 | let mut cursor = node.walk(); |
| 299 | if cursor.goto_first_child() { |
| 300 | loop { |
| 301 | let child = cursor.node(); |
| 302 | if child.kind() == "module_binding" { |
| 303 | if let Some(name_node) = child.child_by_field_name("name") { |
| 304 | let name = state.node_text(name_node); |
| 305 | let start_line = child.start_position().row as u32; |
| 306 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 307 | let id = generate_node_id( |
| 308 | &state.file_path, |
| 309 | &NodeKind::Module, |
| 310 | &name, |
| 311 | start_line, |
| 312 | ); |
| 313 | |
| 314 | let graph_node = Node { |
| 315 | id: id.clone(), |
| 316 | kind: NodeKind::Module, |
| 317 | name: name.clone(), |
| 318 | qualified_name, |
| 319 | file_path: state.file_path.clone(), |
| 320 | start_line, |
| 321 | attrs_start_line: start_line, |
| 322 | end_line: child.end_position().row as u32, |
| 323 | start_column: child.start_position().column as u32, |
| 324 | end_column: child.end_position().column as u32, |
| 325 | signature: None, |
| 326 | docstring: None, |
| 327 | visibility: Visibility::Pub, |
| 328 | is_async: false, |
| 329 | branches: 0, |
| 330 | loops: 0, |
| 331 | returns: 0, |
| 332 | max_nesting: 0, |
| 333 | unsafe_blocks: 0, |
| 334 | unchecked_calls: 0, |
| 335 | assertions: 0, |
| 336 | updated_at: state.timestamp, |
| 337 | parent_id: None, |
| 338 | }; |
| 339 | state.nodes.push(graph_node); |
| 340 | |
| 341 | if let Some(parent_id) = state.parent_node_id() { |
| 342 | state.edges.push(Edge { |
| 343 | source: parent_id.to_string(), |
| 344 | target: id.clone(), |
| 345 | kind: EdgeKind::Contains, |
| 346 | line: Some(start_line), |
| 347 | }); |
| 348 | } |
| 349 | |
| 350 | // Recurse into module body. |
| 351 | state.node_stack.push((name, id)); |
| 352 | if let Some(body) = child.child_by_field_name("body") { |
| 353 | Self::visit_children(state, body); |
nothing calls this directly
no test coverage detected