(&mut self, node: Node<'t>)
| 838 | // --- extractImport (:3170-3236) --------------------------------------- |
| 839 | |
| 840 | fn extract_import(&mut self, node: Node<'t>) { |
| 841 | stack_guard!(); |
| 842 | let import_text = self.text(node).trim(); |
| 843 | // extractImport hook (scala.ts:200-211): `path` field is FIRST-MATCH- |
| 844 | // WINS → the FIRST dotted segment names the import. |
| 845 | let module = if let Some(path) = node.child_by_field_name("path") { |
| 846 | Some(self.text(path)) |
| 847 | } else { |
| 848 | let mut cursor = node.walk(); |
| 849 | let mut found = None; |
| 850 | for c in node.named_children(&mut cursor) { |
| 851 | if c.kind() == "identifier" || c.kind() == "stable_identifier" { |
| 852 | found = Some(self.text(c)); |
| 853 | break; |
| 854 | } |
| 855 | } |
| 856 | found |
| 857 | }; |
| 858 | let Some(module) = module else { return }; |
| 859 | let module = module.to_string(); |
| 860 | let signature = import_text.to_string(); |
| 861 | let created = self.create_node( |
| 862 | "import", |
| 863 | &module, |
| 864 | node, |
| 865 | Extra { signature: Some(signature), ..Default::default() }, |
| 866 | ); |
| 867 | // Generic imports ref (:3183-3194) — hook sets no handledRefs. |
| 868 | if created.is_some() && !module.is_empty() && !self.stack.is_empty() { |
| 869 | let parent_row = self.top_row(); |
| 870 | self.push_ref_at(parent_row, &module, "imports", node); |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | // --- extractCall (:3684) ---------------------------------------------- |
| 875 |
no test coverage detected