extractInheritance — the Java clauses (type_list-aware).
(&mut self, node: Node<'t>, class_row: u32)
| 985 | |
| 986 | /// extractInheritance — the Java clauses (type_list-aware). |
| 987 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 988 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 989 | let implements_kind = edge_kind_index("implements").unwrap(); |
| 990 | for i in 0..node.named_child_count() { |
| 991 | let Some(child) = node.named_child(i) else { continue }; |
| 992 | match child.kind() { |
| 993 | "superclass" | "extends_interfaces" => { |
| 994 | let type_list = (0..child.named_child_count()) |
| 995 | .filter_map(|j| child.named_child(j)) |
| 996 | .find(|c| c.kind() == "type_list"); |
| 997 | let targets: Vec<Node> = match type_list { |
| 998 | Some(tl) => (0..tl.named_child_count()).filter_map(|j| tl.named_child(j)).collect(), |
| 999 | None => child.named_child(0).into_iter().collect(), |
| 1000 | }; |
| 1001 | for target in targets { |
| 1002 | let name = self.text(target).to_string(); |
| 1003 | self.push_ref_at(class_row, &name, extends_kind, target); |
| 1004 | } |
| 1005 | } |
| 1006 | "super_interfaces" => { |
| 1007 | let type_list = (0..child.named_child_count()) |
| 1008 | .filter_map(|j| child.named_child(j)) |
| 1009 | .find(|c| c.kind() == "type_list"); |
| 1010 | let targets: Vec<Node> = match type_list { |
| 1011 | Some(tl) => (0..tl.named_child_count()).filter_map(|j| tl.named_child(j)).collect(), |
| 1012 | None => (0..child.named_child_count()).filter_map(|j| child.named_child(j)).collect(), |
| 1013 | }; |
| 1014 | for iface in targets { |
| 1015 | let name = self.text(iface).to_string(); |
| 1016 | self.push_ref_at(class_row, &name, implements_kind, iface); |
| 1017 | } |
| 1018 | } |
| 1019 | _ => {} |
| 1020 | } |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | /// extractDecoratorsFor — Java annotations live inside `modifiers`. |
| 1025 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
no test coverage detected