(&mut self, node: Node<'t>, from_row: u32)
| 969 | } |
| 970 | |
| 971 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 972 | let clause = (0..node.named_child_count()) |
| 973 | .filter_map(|i| node.named_child(i)) |
| 974 | .find(|c| c.kind() == "import_clause"); |
| 975 | let Some(clause) = clause else { return }; // side-effect import |
| 976 | |
| 977 | let imports_kind = edge_kind_index("imports").unwrap(); |
| 978 | let push = |w: &mut Self, name_node: Option<Node>| { |
| 979 | let Some(n) = name_node else { return }; |
| 980 | let name = w.text(n).to_string(); |
| 981 | if name.is_empty() { |
| 982 | return; |
| 983 | } |
| 984 | w.push_ref(from_row, &name, imports_kind, n); |
| 985 | }; |
| 986 | |
| 987 | for i in 0..clause.named_child_count() { |
| 988 | let Some(child) = clause.named_child(i) else { continue }; |
| 989 | match child.kind() { |
| 990 | "identifier" => push(self, Some(child)), |
| 991 | "named_imports" => { |
| 992 | for j in 0..child.named_child_count() { |
| 993 | let Some(spec) = child.named_child(j) else { continue }; |
| 994 | if spec.kind() != "import_specifier" { |
| 995 | continue; |
| 996 | } |
| 997 | let n = spec |
| 998 | .child_by_field_name("alias") |
| 999 | .or_else(|| spec.child_by_field_name("name")) |
| 1000 | .or_else(|| spec.named_child(0)); |
| 1001 | push(self, n); |
| 1002 | } |
| 1003 | } |
| 1004 | "namespace_import" => { |
| 1005 | let n = (0..child.named_child_count()) |
| 1006 | .filter_map(|k| child.named_child(k)) |
| 1007 | .find(|c| c.kind() == "identifier") |
| 1008 | .or_else(|| child.named_child(0)); |
| 1009 | push(self, n); |
| 1010 | } |
| 1011 | _ => {} |
| 1012 | } |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | pub(super) fn emit_re_export_refs(&mut self, node: Node<'t>) { |
| 1017 | let from_row = self.top_row(); |
no test coverage detected