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

Method visit_interface

src/extraction/java_extractor.rs:424–487  ·  view source on GitHub ↗

Extract an interface declaration.

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

Source from the content-addressed store, hash-verified

422
423 /// Extract an interface declaration.
424 fn visit_interface(state: &mut ExtractionState, node: TsNode<'_>) {
425 let name = Self::extract_name(state, node).unwrap_or_else(|| "<anonymous>".to_string());
426 let visibility = Self::extract_java_visibility(node, state);
427 let docstring = Self::extract_java_docstring(state, node);
428 let signature = Some(Self::extract_declaration_signature(state, node));
429 let start_line = node.start_position().row as u32;
430 let end_line = node.end_position().row as u32;
431 let start_column = node.start_position().column as u32;
432 let end_column = node.end_position().column as u32;
433 let qualified_name = format!("{}::{}", state.qualified_prefix(), name);
434 let id = generate_node_id(&state.file_path, &NodeKind::Interface, &name, start_line);
435
436 let graph_node = Node {
437 id: id.clone(),
438 kind: NodeKind::Interface,
439 name: name.clone(),
440 qualified_name,
441 file_path: state.file_path.clone(),
442 start_line,
443 attrs_start_line: start_line,
444 end_line,
445 start_column,
446 end_column,
447 signature,
448 docstring,
449 visibility,
450 is_async: false,
451 branches: 0,
452 loops: 0,
453 returns: 0,
454 max_nesting: 0,
455 unsafe_blocks: 0,
456 unchecked_calls: 0,
457 assertions: 0,
458 updated_at: state.timestamp,
459 parent_id: None,
460 };
461 state.nodes.push(graph_node);
462
463 // Contains edge from parent.
464 if let Some(parent_id) = state.parent_node_id() {
465 state.edges.push(Edge {
466 source: parent_id.to_string(),
467 target: id.clone(),
468 kind: EdgeKind::Contains,
469 line: Some(start_line),
470 });
471 }
472
473 // Extract type parameters.
474 Self::extract_type_parameters(state, node, &id);
475
476 // Visit interface body. Methods inside an interface with no block are AbstractMethod.
477 let prev_inside_interface = state.inside_interface;
478 state.inside_interface = true;
479 state.node_stack.push((name, id));
480 state.class_depth += 1;
481 if let Some(body) = node.child_by_field_name("body") {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected