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

Method extract_static

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

Extract a static item.

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

Source from the content-addressed store, hash-verified

322
323 /// Extract a static item.
324 fn extract_static(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> {
325 let name_node = node.child_by_field_name("name")?;
326 let name = self.node_text(&name_node, source);
327
328 let line = node.start_position().row as u32 + 1;
329 let end_line = node.end_position().row as u32 + 1;
330 let exported = self.is_pub(node);
331
332 let sig = self.first_line(node, source);
333
334 let mut entity = Entity::new(name, EntityKind::Variable, file_path, line, end_line);
335 if let Some(s) = sig {
336 entity = entity.with_signature(s);
337 }
338 if exported {
339 entity.exported = true;
340 }
341
342 Some(entity)
343 }
344
345 /// Extract a mod declaration.
346 fn extract_mod(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> {

Callers 1

walk_treeMethod · 0.80

Calls 4

is_pubMethod · 0.80
first_lineMethod · 0.80
with_signatureMethod · 0.80
node_textMethod · 0.45

Tested by

no test coverage detected