Extract ARG instruction as a Const node. `arg_instruction` has a `name` field (the variable name) and an optional `default` field (the default value).
(state: &mut ExtractionState, node: TsNode<'_>)
| 374 | /// `arg_instruction` has a `name` field (the variable name) and an optional |
| 375 | /// `default` field (the default value). |
| 376 | fn visit_arg(state: &mut ExtractionState, node: TsNode<'_>) { |
| 377 | let name = match node.child_by_field_name("name") { |
| 378 | Some(n) => state.node_text(n), |
| 379 | None => return, |
| 380 | }; |
| 381 | |
| 382 | let start_line = node.start_position().row as u32; |
| 383 | let end_line = node.end_position().row as u32; |
| 384 | let start_column = node.start_position().column as u32; |
| 385 | let end_column = node.end_position().column as u32; |
| 386 | let text = state.node_text(node); |
| 387 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 388 | let id = generate_node_id(&state.file_path, &NodeKind::Const, &name, start_line); |
| 389 | |
| 390 | let graph_node = Node { |
| 391 | id: id.clone(), |
| 392 | kind: NodeKind::Const, |
| 393 | name, |
| 394 | qualified_name, |
| 395 | file_path: state.file_path.clone(), |
| 396 | start_line, |
| 397 | attrs_start_line: start_line, |
| 398 | end_line, |
| 399 | start_column, |
| 400 | end_column, |
| 401 | signature: Some(text.trim().to_string()), |
| 402 | docstring: None, |
| 403 | visibility: Visibility::Pub, |
| 404 | is_async: false, |
| 405 | branches: 0, |
| 406 | loops: 0, |
| 407 | returns: 0, |
| 408 | max_nesting: 0, |
| 409 | unsafe_blocks: 0, |
| 410 | unchecked_calls: 0, |
| 411 | assertions: 0, |
| 412 | updated_at: state.timestamp, |
| 413 | parent_id: None, |
| 414 | }; |
| 415 | state.nodes.push(graph_node); |
| 416 | |
| 417 | // Contains edge from parent. |
| 418 | if let Some(parent_id) = state.parent_node_id() { |
| 419 | state.edges.push(Edge { |
| 420 | source: parent_id.to_string(), |
| 421 | target: id, |
| 422 | kind: EdgeKind::Contains, |
| 423 | line: Some(start_line), |
| 424 | }); |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | /// Extract EXPOSE instruction ports as Field nodes. |
| 429 | fn visit_expose(state: &mut ExtractionState, node: TsNode<'_>) { |
nothing calls this directly
no test coverage detected