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

Method extract_interface

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

864
865 /// Extract an interface declaration
866 fn extract_interface(
867 &self,
868 node: &Node,
869 source: &str,
870 file_path: &str,
871 exported: bool,
872 ) -> Option<Entity> {
873 let name_node = node.child_by_field_name("name")?;
874 let name = self.node_text(&name_node, source)?;
875
876 // Build signature with extends if present
877 let extends = self.get_interface_extends(node, source);
878 let signature = if extends.is_empty() {
879 format!("interface {}", name)
880 } else {
881 format!("interface {} extends {}", name, extends)
882 };
883
884 Some(
885 Entity::new(
886 name,
887 EntityKind::Interface,
888 file_path,
889 node.start_position().row as u32 + 1,
890 node.end_position().row as u32 + 1,
891 )
892 .with_column(node.start_position().column as u32)
893 .with_signature(signature)
894 .with_exported(exported),
895 )
896 }
897
898 /// Extract a type alias declaration
899 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