Extract a module/namespace declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 906 | |
| 907 | /// Extract a module/namespace declaration |
| 908 | fn extract_module( |
| 909 | &self, |
| 910 | node: &Node, |
| 911 | source: &str, |
| 912 | file_path: &str, |
| 913 | exported: bool, |
| 914 | ) -> Option<Entity> { |
| 915 | let name_node = node.child_by_field_name("name")?; |
| 916 | let name = self.node_text(&name_node, source)?; |
| 917 | |
| 918 | let signature = format!("namespace {}", name); |
| 919 | |
| 920 | Some( |
| 921 | Entity::new( |
| 922 | name, |
| 923 | EntityKind::Module, |
| 924 | file_path, |
| 925 | node.start_position().row as u32 + 1, |
| 926 | node.end_position().row as u32 + 1, |
| 927 | ) |
| 928 | .with_column(node.start_position().column as u32) |
| 929 | .with_signature(signature) |
| 930 | .with_exported(exported), |
| 931 | ) |
| 932 | } |
| 933 | |
| 934 | // ========================================================================= |
| 935 | // Helper methods for building signatures |
no test coverage detected