Extract EXPOSE instruction ports as Field nodes.
(state: &mut ExtractionState, node: TsNode<'_>)
| 427 | |
| 428 | /// Extract EXPOSE instruction ports as Field nodes. |
| 429 | fn visit_expose(state: &mut ExtractionState, node: TsNode<'_>) { |
| 430 | let mut cursor = node.walk(); |
| 431 | if cursor.goto_first_child() { |
| 432 | loop { |
| 433 | let child = cursor.node(); |
| 434 | if child.kind() == "expose_port" { |
| 435 | let port_text = state.node_text(child); |
| 436 | let start_line = child.start_position().row as u32; |
| 437 | let end_line = child.end_position().row as u32; |
| 438 | let start_column = child.start_position().column as u32; |
| 439 | let end_column = child.end_position().column as u32; |
| 440 | let qualified_name = format!("{}::{}", state.qualified_prefix(), port_text); |
| 441 | let id = generate_node_id( |
| 442 | &state.file_path, |
| 443 | &NodeKind::Field, |
| 444 | &port_text, |
| 445 | start_line, |
| 446 | ); |
| 447 | |
| 448 | let graph_node = Node { |
| 449 | id: id.clone(), |
| 450 | kind: NodeKind::Field, |
| 451 | name: port_text, |
| 452 | qualified_name, |
| 453 | file_path: state.file_path.clone(), |
| 454 | start_line, |
| 455 | attrs_start_line: start_line, |
| 456 | end_line, |
| 457 | start_column, |
| 458 | end_column, |
| 459 | signature: Some(state.node_text(node).trim().to_string()), |
| 460 | docstring: None, |
| 461 | visibility: Visibility::Pub, |
| 462 | is_async: false, |
| 463 | branches: 0, |
| 464 | loops: 0, |
| 465 | returns: 0, |
| 466 | max_nesting: 0, |
| 467 | unsafe_blocks: 0, |
| 468 | unchecked_calls: 0, |
| 469 | assertions: 0, |
| 470 | updated_at: state.timestamp, |
| 471 | parent_id: None, |
| 472 | }; |
| 473 | state.nodes.push(graph_node); |
| 474 | |
| 475 | // Contains edge from parent. |
| 476 | if let Some(parent_id) = state.parent_node_id() { |
| 477 | state.edges.push(Edge { |
| 478 | source: parent_id.to_string(), |
| 479 | target: id, |
| 480 | kind: EdgeKind::Contains, |
| 481 | line: Some(start_line), |
| 482 | }); |
| 483 | } |
| 484 | } |
| 485 | if !cursor.goto_next_sibling() { |
| 486 | break; |
nothing calls this directly
no test coverage detected