MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_interface

Method extract_interface

atomic-semantic/src/parser.rs:821–851  ·  view source on GitHub ↗

Extract an interface declaration

(
        &self,
        node: &Node,
        source: &str,
        file_path: &str,
        exported: bool,
    )

Source from the content-addressed store, hash-verified

819
820 /// Extract an interface declaration
821 fn extract_interface(
822 &self,
823 node: &Node,
824 source: &str,
825 file_path: &str,
826 exported: bool,
827 ) -> Option<Entity> {
828 let name_node = node.child_by_field_name("name")?;
829 let name = self.node_text(&name_node, source)?;
830
831 // Build signature with extends if present
832 let extends = self.get_interface_extends(node, source);
833 let signature = if extends.is_empty() {
834 format!("interface {}", name)
835 } else {
836 format!("interface {} extends {}", name, extends)
837 };
838
839 Some(
840 Entity::new(
841 name,
842 EntityKind::Interface,
843 file_path,
844 node.start_position().row as u32 + 1,
845 node.end_position().row as u32 + 1,
846 )
847 .with_column(node.start_position().column as u32)
848 .with_signature(signature)
849 .with_exported(exported),
850 )
851 }
852
853 /// Extract a type alias declaration
854 fn extract_type_alias(

Callers 1

walk_treeMethod · 0.45

Calls 6

get_interface_extendsMethod · 0.80
with_exportedMethod · 0.80
with_signatureMethod · 0.80
with_columnMethod · 0.80
node_textMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected