extractInheritance — the Java clauses (type_list-aware).
(&mut self, node: Node<'t>, class_row: u32)
| 1048 | |
| 1049 | /// extractInheritance — the Java clauses (type_list-aware). |
| 1050 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 1051 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 1052 | let implements_kind = edge_kind_index("implements").unwrap(); |
| 1053 | for i in 0..node.named_child_count() { |
| 1054 | let Some(child) = node.named_child(i) else { continue }; |
| 1055 | match child.kind() { |
| 1056 | "superclass" | "extends_interfaces" => { |
| 1057 | let type_list = (0..child.named_child_count()) |
| 1058 | .filter_map(|j| child.named_child(j)) |
| 1059 | .find(|c| c.kind() == "type_list"); |
| 1060 | let targets: Vec<Node> = match type_list { |
| 1061 | Some(tl) => (0..tl.named_child_count()).filter_map(|j| tl.named_child(j)).collect(), |
| 1062 | None => child.named_child(0).into_iter().collect(), |
| 1063 | }; |
| 1064 | for target in targets { |
| 1065 | let name = self.supertype_name(target); |
| 1066 | self.push_ref_at(class_row, &name, extends_kind, target); |
| 1067 | } |
| 1068 | } |
| 1069 | "super_interfaces" => { |
| 1070 | let type_list = (0..child.named_child_count()) |
| 1071 | .filter_map(|j| child.named_child(j)) |
| 1072 | .find(|c| c.kind() == "type_list"); |
| 1073 | let targets: Vec<Node> = match type_list { |
| 1074 | Some(tl) => (0..tl.named_child_count()).filter_map(|j| tl.named_child(j)).collect(), |
| 1075 | None => (0..child.named_child_count()).filter_map(|j| child.named_child(j)).collect(), |
| 1076 | }; |
| 1077 | for iface in targets { |
| 1078 | let name = self.supertype_name(iface); |
| 1079 | self.push_ref_at(class_row, &name, implements_kind, iface); |
| 1080 | } |
| 1081 | } |
| 1082 | _ => {} |
| 1083 | } |
| 1084 | } |
| 1085 | } |
| 1086 | |
| 1087 | /// supertypeName — a parameterized supertype (`generic_type`) by the name |
| 1088 | /// before its type arguments: `Store` for `implements Store<String>`. |
no test coverage detected