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

Method extract_enum

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

896
897 /// Extract an enum declaration
898 fn extract_enum(
899 &self,
900 node: &Node,
901 source: &str,
902 file_path: &str,
903 exported: bool,
904 ) -> Option<Entity> {
905 let name_node = node.child_by_field_name("name")?;
906 let name = self.node_text(&name_node, source)?;
907
908 let signature = format!("enum {}", name);
909
910 Some(
911 Entity::new(
912 name,
913 EntityKind::Enum,
914 file_path,
915 node.start_position().row as u32 + 1,
916 node.end_position().row as u32 + 1,
917 )
918 .with_column(node.start_position().column as u32)
919 .with_signature(signature)
920 .with_exported(exported),
921 )
922 }
923
924 /// Extract a module/namespace declaration
925 fn extract_module(

Callers 1

walk_treeMethod · 0.45

Calls 4

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

Tested by

no test coverage detected