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

Method visit_interface

src/extraction/kotlin_extractor.rs:586–646  ·  view source on GitHub ↗

Extract an interface (treated as Trait kind).

(state: &mut ExtractionState, node: TsNode<'_>)

Source from the content-addressed store, hash-verified

584
585 /// Extract an interface (treated as Trait kind).
586 fn visit_interface(state: &mut ExtractionState, node: TsNode<'_>) {
587 let name = Self::extract_class_name(state, node);
588 let visibility = Self::extract_visibility(node, state);
589 let docstring = Self::extract_kdoc(state, node);
590 let signature = Some(Self::extract_declaration_signature(state, node));
591 let start_line = node.start_position().row as u32;
592 let end_line = node.end_position().row as u32;
593 let start_column = node.start_position().column as u32;
594 let end_column = node.end_position().column as u32;
595 let qualified_name = format!("{}::{}", state.qualified_prefix(), name);
596 let id = generate_node_id(&state.file_path, &NodeKind::Trait, &name, start_line);
597
598 let graph_node = Node {
599 id: id.clone(),
600 kind: NodeKind::Trait,
601 name: name.clone(),
602 qualified_name,
603 file_path: state.file_path.clone(),
604 start_line,
605 attrs_start_line: start_line,
606 end_line,
607 start_column,
608 end_column,
609 signature,
610 docstring,
611 visibility,
612 is_async: false,
613 branches: 0,
614 loops: 0,
615 returns: 0,
616 max_nesting: 0,
617 unsafe_blocks: 0,
618 unchecked_calls: 0,
619 assertions: 0,
620 updated_at: state.timestamp,
621 parent_id: None,
622 };
623 state.nodes.push(graph_node);
624
625 if let Some(parent_id) = state.parent_node_id() {
626 state.edges.push(Edge {
627 source: parent_id.to_string(),
628 target: id.clone(),
629 kind: EdgeKind::Contains,
630 line: Some(start_line),
631 });
632 }
633
634 Self::extract_annotations_from_modifiers(state, node, &id);
635
636 let prev_inside_trait = state.inside_trait;
637 state.inside_trait = true;
638 state.node_stack.push((name, id));
639 state.class_depth += 1;
640 if let Some(body) = find_direct_child_by_kind(node, "class_body") {
641 Self::visit_children(state, body);
642 }
643 state.class_depth -= 1;

Callers

nothing calls this directly

Calls 5

generate_node_idFunction · 0.85
visit_childrenFunction · 0.85
pushMethod · 0.80
parent_node_idMethod · 0.45

Tested by

no test coverage detected