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

Method extract_interface

atomic-semantic/src/parser.rs:838–868  ·  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

836
837 /// Extract an interface declaration
838 fn extract_interface(
839 &self,
840 node: &Node,
841 source: &str,
842 file_path: &str,
843 exported: bool,
844 ) -> Option<Entity> {
845 let name_node = node.child_by_field_name("name")?;
846 let name = self.node_text(&name_node, source)?;
847
848 // Build signature with extends if present
849 let extends = self.get_interface_extends(node, source);
850 let signature = if extends.is_empty() {
851 format!("interface {}", name)
852 } else {
853 format!("interface {} extends {}", name, extends)
854 };
855
856 Some(
857 Entity::new(
858 name,
859 EntityKind::Interface,
860 file_path,
861 node.start_position().row as u32 + 1,
862 node.end_position().row as u32 + 1,
863 )
864 .with_column(node.start_position().column as u32)
865 .with_signature(signature)
866 .with_exported(exported),
867 )
868 }
869
870 /// Extract a type alias declaration
871 fn extract_type_alias(

Callers 1

walk_treeMethod · 0.45

Calls 6

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

Tested by

no test coverage detected