Extract an enum declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 879 | |
| 880 | /// Extract an enum declaration |
| 881 | fn extract_enum( |
| 882 | &self, |
| 883 | node: &Node, |
| 884 | source: &str, |
| 885 | file_path: &str, |
| 886 | exported: bool, |
| 887 | ) -> Option<Entity> { |
| 888 | let name_node = node.child_by_field_name("name")?; |
| 889 | let name = self.node_text(&name_node, source)?; |
| 890 | |
| 891 | let signature = format!("enum {}", name); |
| 892 | |
| 893 | Some( |
| 894 | Entity::new( |
| 895 | name, |
| 896 | EntityKind::Enum, |
| 897 | file_path, |
| 898 | node.start_position().row as u32 + 1, |
| 899 | node.end_position().row as u32 + 1, |
| 900 | ) |
| 901 | .with_column(node.start_position().column as u32) |
| 902 | .with_signature(signature) |
| 903 | .with_exported(exported), |
| 904 | ) |
| 905 | } |
| 906 | |
| 907 | /// Extract a module/namespace declaration |
| 908 | fn extract_module( |
no test coverage detected