(state: &mut ExtractionState, node: TsNode<'_>)
| 301 | } |
| 302 | |
| 303 | fn visit_namespace(state: &mut ExtractionState, node: TsNode<'_>) { |
| 304 | let name = Self::find_child_text(state, node, "long_identifier") |
| 305 | .or_else(|| Self::find_child_text(state, node, "identifier")) |
| 306 | .unwrap_or_else(|| "?".to_string()); |
| 307 | |
| 308 | let start_line = node.start_position().row as u32; |
| 309 | let qualified_name = format!("{}::{}", state.file_path, name); |
| 310 | let id = generate_node_id(&state.file_path, &NodeKind::Module, &name, start_line); |
| 311 | |
| 312 | let graph_node = Node { |
| 313 | id: id.clone(), |
| 314 | kind: NodeKind::Module, |
| 315 | name: name.clone(), |
| 316 | qualified_name, |
| 317 | file_path: state.file_path.clone(), |
| 318 | start_line, |
| 319 | attrs_start_line: start_line, |
| 320 | end_line: node.end_position().row as u32, |
| 321 | start_column: 0, |
| 322 | end_column: 0, |
| 323 | signature: None, |
| 324 | docstring: None, |
| 325 | visibility: Visibility::Pub, |
| 326 | is_async: false, |
| 327 | branches: 0, |
| 328 | loops: 0, |
| 329 | returns: 0, |
| 330 | max_nesting: 0, |
| 331 | unsafe_blocks: 0, |
| 332 | unchecked_calls: 0, |
| 333 | assertions: 0, |
| 334 | updated_at: state.timestamp, |
| 335 | parent_id: None, |
| 336 | }; |
| 337 | state.nodes.push(graph_node); |
| 338 | |
| 339 | if let Some(parent_id) = state.parent_node_id() { |
| 340 | state.edges.push(Edge { |
| 341 | source: parent_id.to_string(), |
| 342 | target: id.clone(), |
| 343 | kind: EdgeKind::Contains, |
| 344 | line: Some(start_line), |
| 345 | }); |
| 346 | } |
| 347 | |
| 348 | state.node_stack.push((name, id)); |
| 349 | Self::visit_children(state, node); |
| 350 | state.node_stack.pop(); |
| 351 | } |
| 352 | |
| 353 | fn visit_open(state: &mut ExtractionState, node: TsNode<'_>) { |
| 354 | let text = state.node_text(node); |
nothing calls this directly
no test coverage detected