Extract an interface declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 864 | |
| 865 | /// Extract an interface declaration |
| 866 | fn extract_interface( |
| 867 | &self, |
| 868 | node: &Node, |
| 869 | source: &str, |
| 870 | file_path: &str, |
| 871 | exported: bool, |
| 872 | ) -> Option<Entity> { |
| 873 | let name_node = node.child_by_field_name("name")?; |
| 874 | let name = self.node_text(&name_node, source)?; |
| 875 | |
| 876 | // Build signature with extends if present |
| 877 | let extends = self.get_interface_extends(node, source); |
| 878 | let signature = if extends.is_empty() { |
| 879 | format!("interface {}", name) |
| 880 | } else { |
| 881 | format!("interface {} extends {}", name, extends) |
| 882 | }; |
| 883 | |
| 884 | Some( |
| 885 | Entity::new( |
| 886 | name, |
| 887 | EntityKind::Interface, |
| 888 | file_path, |
| 889 | node.start_position().row as u32 + 1, |
| 890 | node.end_position().row as u32 + 1, |
| 891 | ) |
| 892 | .with_column(node.start_position().column as u32) |
| 893 | .with_signature(signature) |
| 894 | .with_exported(exported), |
| 895 | ) |
| 896 | } |
| 897 | |
| 898 | /// Extract a type alias declaration |
| 899 | fn extract_type_alias( |
no test coverage detected