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

Method extract_mod

atomic-semantic/src/parsers/rust.rs:346–360  ·  view source on GitHub ↗

Extract a mod declaration.

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

Source from the content-addressed store, hash-verified

344
345 /// Extract a mod declaration.
346 fn extract_mod(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> {
347 let name_node = node.child_by_field_name("name")?;
348 let name = self.node_text(&name_node, source);
349
350 let line = node.start_position().row as u32 + 1;
351 let end_line = node.end_position().row as u32 + 1;
352 let exported = self.is_pub(node);
353
354 let mut entity = Entity::new(name, EntityKind::Module, file_path, line, end_line);
355 if exported {
356 entity.exported = true;
357 }
358
359 Some(entity)
360 }
361
362 /// Extract a use declaration.
363 fn extract_use(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> {

Callers 1

walk_treeMethod · 0.80

Calls 2

is_pubMethod · 0.80
node_textMethod · 0.45

Tested by

no test coverage detected