extractInheritance — the rust-reachable cases: trait_bounds (supertraits; a scoped `fmt::Debug` bound matches NO case and is dropped), the Go embedding check on field_declaration (inert in rust — every field has a field_identifier), and the field_declaration_list recursion that reaches it.
(&mut self, node: Node<'t>, class_row: u32)
| 964 | /// every field has a field_identifier), and the field_declaration_list |
| 965 | /// recursion that reaches it. |
| 966 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 967 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 968 | for i in 0..node.named_child_count() { |
| 969 | let Some(child) = node.named_child(i) else { continue }; |
| 970 | match child.kind() { |
| 971 | "trait_bounds" => { |
| 972 | for j in 0..child.named_child_count() { |
| 973 | let Some(bound) = child.named_child(j) else { continue }; |
| 974 | let type_node: Option<Node> = match bound.kind() { |
| 975 | "type_identifier" => Some(bound), |
| 976 | "generic_type" => (0..bound.named_child_count()) |
| 977 | .filter_map(|k| bound.named_child(k)) |
| 978 | .find(|c| c.kind() == "type_identifier"), |
| 979 | "higher_ranked_trait_bound" => { |
| 980 | let generic = (0..bound.named_child_count()) |
| 981 | .filter_map(|k| bound.named_child(k)) |
| 982 | .find(|c| c.kind() == "generic_type"); |
| 983 | generic |
| 984 | .and_then(|g| { |
| 985 | (0..g.named_child_count()) |
| 986 | .filter_map(|k| g.named_child(k)) |
| 987 | .find(|c| c.kind() == "type_identifier") |
| 988 | }) |
| 989 | .or_else(|| { |
| 990 | (0..bound.named_child_count()) |
| 991 | .filter_map(|k| bound.named_child(k)) |
| 992 | .find(|c| c.kind() == "type_identifier") |
| 993 | }) |
| 994 | } |
| 995 | _ => None, // scoped_type_identifier: dropped (quirk) |
| 996 | }; |
| 997 | if let Some(tn) = type_node { |
| 998 | let name = self.text(tn).to_string(); |
| 999 | self.push_ref_at(class_row, &name, extends_kind, tn); |
| 1000 | } |
| 1001 | } |
| 1002 | } |
| 1003 | "field_declaration" => { |
| 1004 | let has_field_identifier = (0..child.named_child_count()) |
| 1005 | .filter_map(|j| child.named_child(j)) |
| 1006 | .any(|c| c.kind() == "field_identifier"); |
| 1007 | if !has_field_identifier { |
| 1008 | let type_id = (0..child.named_child_count()) |
| 1009 | .filter_map(|j| child.named_child(j)) |
| 1010 | .find(|c| c.kind() == "type_identifier"); |
| 1011 | if let Some(type_id) = type_id { |
| 1012 | let name = self.text(type_id).to_string(); |
| 1013 | self.push_ref_at(class_row, &name, extends_kind, type_id); |
| 1014 | } |
| 1015 | } |
| 1016 | } |
| 1017 | "field_declaration_list" | "class_heritage" => { |
| 1018 | self.extract_inheritance(child, class_row); |
| 1019 | } |
| 1020 | _ => {} |
| 1021 | } |
| 1022 | } |
| 1023 | } |
no test coverage detected