(&mut self, node: Node<'t>, from_row: u32)
| 1683 | } |
| 1684 | |
| 1685 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 1686 | let clause = (0..node.named_child_count()) |
| 1687 | .filter_map(|i| node.named_child(i)) |
| 1688 | .find(|c| c.kind() == "import_clause"); |
| 1689 | let Some(clause) = clause else { return }; // side-effect import |
| 1690 | |
| 1691 | let imports_kind = edge_kind_index("imports").unwrap(); |
| 1692 | let push = |w: &mut Self, name_node: Option<Node>| { |
| 1693 | let Some(n) = name_node else { return }; |
| 1694 | let name = w.text(n).to_string(); |
| 1695 | if name.is_empty() { |
| 1696 | return; |
| 1697 | } |
| 1698 | w.push_ref(from_row, &name, imports_kind, n); |
| 1699 | }; |
| 1700 | |
| 1701 | for i in 0..clause.named_child_count() { |
| 1702 | let Some(child) = clause.named_child(i) else { continue }; |
| 1703 | match child.kind() { |
| 1704 | "identifier" => push(self, Some(child)), |
| 1705 | "named_imports" => { |
| 1706 | for j in 0..child.named_child_count() { |
| 1707 | let Some(spec) = child.named_child(j) else { continue }; |
| 1708 | if spec.kind() != "import_specifier" { |
| 1709 | continue; |
| 1710 | } |
| 1711 | let n = spec |
| 1712 | .child_by_field_name("alias") |
| 1713 | .or_else(|| spec.child_by_field_name("name")) |
| 1714 | .or_else(|| spec.named_child(0)); |
| 1715 | push(self, n); |
| 1716 | } |
| 1717 | } |
| 1718 | "namespace_import" => { |
| 1719 | let n = (0..child.named_child_count()) |
| 1720 | .filter_map(|k| child.named_child(k)) |
| 1721 | .find(|c| c.kind() == "identifier") |
| 1722 | .or_else(|| child.named_child(0)); |
| 1723 | push(self, n); |
| 1724 | } |
| 1725 | _ => {} |
| 1726 | } |
| 1727 | } |
| 1728 | } |
| 1729 | |
| 1730 | pub(super) fn emit_re_export_refs(&mut self, node: Node<'t>) { |
| 1731 | let from_row = self.top_row(); |
no test coverage detected