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)
| 998 | /// every field has a field_identifier), and the field_declaration_list |
| 999 | /// recursion that reaches it. |
| 1000 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 1001 | stack_guard!(); |
| 1002 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 1003 | for i in 0..node.named_child_count() { |
| 1004 | let Some(child) = node.named_child(i) else { continue }; |
| 1005 | match child.kind() { |
| 1006 | "trait_bounds" => { |
| 1007 | for j in 0..child.named_child_count() { |
| 1008 | let Some(bound) = child.named_child(j) else { continue }; |
| 1009 | let type_node: Option<Node> = match bound.kind() { |
| 1010 | "type_identifier" => Some(bound), |
| 1011 | "generic_type" => (0..bound.named_child_count()) |
| 1012 | .filter_map(|k| bound.named_child(k)) |
| 1013 | .find(|c| c.kind() == "type_identifier"), |
| 1014 | "higher_ranked_trait_bound" => { |
| 1015 | let generic = (0..bound.named_child_count()) |
| 1016 | .filter_map(|k| bound.named_child(k)) |
| 1017 | .find(|c| c.kind() == "generic_type"); |
| 1018 | generic |
| 1019 | .and_then(|g| { |
| 1020 | (0..g.named_child_count()) |
| 1021 | .filter_map(|k| g.named_child(k)) |
| 1022 | .find(|c| c.kind() == "type_identifier") |
| 1023 | }) |
| 1024 | .or_else(|| { |
| 1025 | (0..bound.named_child_count()) |
| 1026 | .filter_map(|k| bound.named_child(k)) |
| 1027 | .find(|c| c.kind() == "type_identifier") |
| 1028 | }) |
| 1029 | } |
| 1030 | _ => None, // scoped_type_identifier: dropped (quirk) |
| 1031 | }; |
| 1032 | if let Some(tn) = type_node { |
| 1033 | let name = self.text(tn).to_string(); |
| 1034 | self.push_ref_at(class_row, &name, extends_kind, tn); |
| 1035 | } |
| 1036 | } |
| 1037 | } |
| 1038 | "field_declaration" => { |
| 1039 | let has_field_identifier = (0..child.named_child_count()) |
| 1040 | .filter_map(|j| child.named_child(j)) |
| 1041 | .any(|c| c.kind() == "field_identifier"); |
| 1042 | if !has_field_identifier { |
| 1043 | let type_id = (0..child.named_child_count()) |
| 1044 | .filter_map(|j| child.named_child(j)) |
| 1045 | .find(|c| c.kind() == "type_identifier"); |
| 1046 | if let Some(type_id) = type_id { |
| 1047 | let name = self.text(type_id).to_string(); |
| 1048 | self.push_ref_at(class_row, &name, extends_kind, type_id); |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | "field_declaration_list" | "class_heritage" => { |
| 1053 | self.extract_inheritance(child, class_row); |
| 1054 | } |
| 1055 | _ => {} |
| 1056 | } |
| 1057 | } |
no test coverage detected