Extract an interface declaration.
(state: &mut ExtractionState, node: TsNode<'_>)
| 448 | |
| 449 | /// Extract an interface declaration. |
| 450 | fn visit_interface(state: &mut ExtractionState, node: TsNode<'_>) { |
| 451 | let name = Self::extract_name(state, node).unwrap_or_else(|| "<anonymous>".to_string()); |
| 452 | let visibility = Self::extract_csharp_visibility(node, state); |
| 453 | let docstring = Self::extract_xml_docstring(state, node); |
| 454 | let signature = Some(Self::extract_declaration_signature(state, node)); |
| 455 | let start_line = node.start_position().row as u32; |
| 456 | let end_line = node.end_position().row as u32; |
| 457 | let start_column = node.start_position().column as u32; |
| 458 | let end_column = node.end_position().column as u32; |
| 459 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 460 | let id = generate_node_id(&state.file_path, &NodeKind::Interface, &name, start_line); |
| 461 | |
| 462 | let graph_node = Node { |
| 463 | id: id.clone(), |
| 464 | kind: NodeKind::Interface, |
| 465 | name: name.clone(), |
| 466 | qualified_name, |
| 467 | file_path: state.file_path.clone(), |
| 468 | start_line, |
| 469 | attrs_start_line: start_line, |
| 470 | end_line, |
| 471 | start_column, |
| 472 | end_column, |
| 473 | signature, |
| 474 | docstring, |
| 475 | visibility, |
| 476 | is_async: false, |
| 477 | branches: 0, |
| 478 | loops: 0, |
| 479 | returns: 0, |
| 480 | max_nesting: 0, |
| 481 | unsafe_blocks: 0, |
| 482 | unchecked_calls: 0, |
| 483 | assertions: 0, |
| 484 | updated_at: state.timestamp, |
| 485 | parent_id: None, |
| 486 | }; |
| 487 | state.nodes.push(graph_node); |
| 488 | |
| 489 | // Contains edge from parent. |
| 490 | if let Some(parent_id) = state.parent_node_id() { |
| 491 | state.edges.push(Edge { |
| 492 | source: parent_id.to_string(), |
| 493 | target: id.clone(), |
| 494 | kind: EdgeKind::Contains, |
| 495 | line: Some(start_line), |
| 496 | }); |
| 497 | } |
| 498 | |
| 499 | // Extract base list (interfaces can extend other interfaces). |
| 500 | Self::extract_base_list(state, node, &id, false); |
| 501 | |
| 502 | // Visit interface body. |
| 503 | state.node_stack.push((name, id)); |
| 504 | state.class_depth += 1; |
| 505 | if let Some(body) = node.child_by_field_name("body") { |
| 506 | Self::visit_children(state, body); |
| 507 | } |
nothing calls this directly
no test coverage detected