MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / visit_open

Method visit_open

src/extraction/ocaml_extractor.rs:423–468  ·  view source on GitHub ↗
(state: &mut ExtractionState, node: TsNode<'_>)

Source from the content-addressed store, hash-verified

421 }
422
423 fn visit_open(state: &mut ExtractionState, node: TsNode<'_>) {
424 let text = state.node_text(node);
425 let name = text
426 .split_whitespace()
427 .nth(1)
428 .unwrap_or("?")
429 .trim_end_matches(';')
430 .to_string();
431 let start_line = node.start_position().row as u32;
432 let id = generate_node_id(&state.file_path, &NodeKind::Use, &name, start_line);
433
434 let graph_node = Node {
435 id: id.clone(),
436 kind: NodeKind::Use,
437 name,
438 qualified_name: format!("{}::open", state.file_path),
439 file_path: state.file_path.clone(),
440 start_line,
441 attrs_start_line: start_line,
442 end_line: node.end_position().row as u32,
443 start_column: node.start_position().column as u32,
444 end_column: node.end_position().column as u32,
445 signature: Some(text.trim().to_string()),
446 docstring: None,
447 visibility: Visibility::Private,
448 is_async: false,
449 branches: 0,
450 loops: 0,
451 returns: 0,
452 max_nesting: 0,
453 unsafe_blocks: 0,
454 unchecked_calls: 0,
455 assertions: 0,
456 updated_at: state.timestamp,
457 parent_id: None,
458 };
459 state.nodes.push(graph_node);
460 if let Some(parent_id) = state.parent_node_id() {
461 state.edges.push(Edge {
462 source: parent_id.to_string(),
463 target: id,
464 kind: EdgeKind::Contains,
465 line: Some(start_line),
466 });
467 }
468 }
469
470 /// Extracts an OCaml value name from a pattern node.
471 fn extract_value_name(state: &ExtractionState, pattern: TsNode<'_>) -> Option<String> {

Callers

nothing calls this directly

Calls 4

generate_node_idFunction · 0.85
pushMethod · 0.80
node_textMethod · 0.45
parent_node_idMethod · 0.45

Tested by

no test coverage detected