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

Method extract_enum

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

Extract an enum declaration

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

Source from the content-addressed store, hash-verified

879
880 /// Extract an enum declaration
881 fn extract_enum(
882 &self,
883 node: &Node,
884 source: &str,
885 file_path: &str,
886 exported: bool,
887 ) -> Option<Entity> {
888 let name_node = node.child_by_field_name("name")?;
889 let name = self.node_text(&name_node, source)?;
890
891 let signature = format!("enum {}", name);
892
893 Some(
894 Entity::new(
895 name,
896 EntityKind::Enum,
897 file_path,
898 node.start_position().row as u32 + 1,
899 node.end_position().row as u32 + 1,
900 )
901 .with_column(node.start_position().column as u32)
902 .with_signature(signature)
903 .with_exported(exported),
904 )
905 }
906
907 /// Extract a module/namespace declaration
908 fn extract_module(

Callers 1

walk_treeMethod · 0.45

Calls 4

with_exportedMethod · 0.80
with_signatureMethod · 0.80
with_columnMethod · 0.80
node_textMethod · 0.45

Tested by

no test coverage detected