Extract an interface declaration.
(&self, node: &Node, source: &str, file_path: &str)
| 176 | |
| 177 | /// Extract an interface declaration. |
| 178 | fn extract_interface(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
| 179 | let name_node = node.child_by_field_name("name")?; |
| 180 | let name = self.node_text(&name_node, source); |
| 181 | |
| 182 | let line = node.start_position().row as u32 + 1; |
| 183 | let end_line = node.end_position().row as u32 + 1; |
| 184 | |
| 185 | let exported = self.has_modifier(node, source, "public"); |
| 186 | |
| 187 | let signature = self.build_interface_signature(node, source); |
| 188 | |
| 189 | let mut entity = Entity::new(name, EntityKind::Interface, file_path, line, end_line); |
| 190 | if let Some(sig) = signature { |
| 191 | entity = entity.with_signature(sig); |
| 192 | } |
| 193 | if exported { |
| 194 | entity.exported = true; |
| 195 | } |
| 196 | |
| 197 | Some(entity) |
| 198 | } |
| 199 | |
| 200 | /// Extract an enum declaration. |
| 201 | fn extract_enum(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
no test coverage detected