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

Method extract_enum

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

924
925 /// Extract an enum declaration
926 fn extract_enum(
927 &self,
928 node: &Node,
929 source: &str,
930 file_path: &str,
931 exported: bool,
932 ) -> Option<Entity> {
933 let name_node = node.child_by_field_name("name")?;
934 let name = self.node_text(&name_node, source)?;
935
936 let signature = format!("enum {}", name);
937
938 Some(
939 Entity::new(
940 name,
941 EntityKind::Enum,
942 file_path,
943 node.start_position().row as u32 + 1,
944 node.end_position().row as u32 + 1,
945 )
946 .with_column(node.start_position().column as u32)
947 .with_signature(signature)
948 .with_exported(exported),
949 )
950 }
951
952 /// Extract a module/namespace declaration
953 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