Extract a const item.
(&self, node: &Node, source: &str, file_path: &str)
| 300 | |
| 301 | /// Extract a const item. |
| 302 | fn extract_const(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
| 303 | let name_node = node.child_by_field_name("name")?; |
| 304 | let name = self.node_text(&name_node, source); |
| 305 | |
| 306 | let line = node.start_position().row as u32 + 1; |
| 307 | let end_line = node.end_position().row as u32 + 1; |
| 308 | let exported = self.is_pub(node); |
| 309 | |
| 310 | let sig = self.first_line(node, source); |
| 311 | |
| 312 | let mut entity = Entity::new(name, EntityKind::Const, file_path, line, end_line); |
| 313 | if let Some(s) = sig { |
| 314 | entity = entity.with_signature(s); |
| 315 | } |
| 316 | if exported { |
| 317 | entity.exported = true; |
| 318 | } |
| 319 | |
| 320 | Some(entity) |
| 321 | } |
| 322 | |
| 323 | /// Extract a static item. |
| 324 | fn extract_static(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
no test coverage detected