extractInheritance — delegation_specifier: user_type ?? its constructor_invocation's user_type → ONE `extends` ref named by the user_type's type_identifiers joined with `.` (`Outer.Inner`, type arguments left out), at the first one (interfaces ride extends too; `by`-delegation emits NOTHING).
(&mut self, node: Node<'t>, class_row: u32)
| 1376 | /// arguments left out), at the first one (interfaces ride extends too; |
| 1377 | /// `by`-delegation emits NOTHING). |
| 1378 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 1379 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 1380 | for i in 0..node.named_child_count() { |
| 1381 | let Some(child) = node.named_child(i) else { continue }; |
| 1382 | if child.kind() != "delegation_specifier" { |
| 1383 | continue; |
| 1384 | } |
| 1385 | let user_type = (0..child.named_child_count()) |
| 1386 | .filter_map(|j| child.named_child(j)) |
| 1387 | .find(|c| c.kind() == "user_type"); |
| 1388 | let ctor_inv = (0..child.named_child_count()) |
| 1389 | .filter_map(|j| child.named_child(j)) |
| 1390 | .find(|c| c.kind() == "constructor_invocation"); |
| 1391 | let target = user_type.or(ctor_inv); |
| 1392 | let Some(target) = target else { continue }; |
| 1393 | let type_node: Option<Node> = if target.kind() == "user_type" { |
| 1394 | Some(target) |
| 1395 | } else { |
| 1396 | (0..target.named_child_count()) |
| 1397 | .filter_map(|j| target.named_child(j)) |
| 1398 | .find(|c| c.kind() == "user_type") |
| 1399 | }; |
| 1400 | let ids: Vec<Node> = match type_node { |
| 1401 | Some(t) => (0..t.named_child_count()) |
| 1402 | .filter_map(|j| t.named_child(j)) |
| 1403 | .filter(|c| c.kind() == "type_identifier") |
| 1404 | .collect(), |
| 1405 | None => Vec::new(), |
| 1406 | }; |
| 1407 | let type_id: Node = ids.first().copied().or(type_node).unwrap_or(target); |
| 1408 | let name = if ids.is_empty() { |
| 1409 | self.text(type_id).to_string() |
| 1410 | } else { |
| 1411 | ids.iter().map(|c| self.text(*c)).collect::<Vec<_>>().join(".") |
| 1412 | }; |
| 1413 | self.push_ref_at(class_row, &name, extends_kind, type_id); |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | /// extractKotlinObjectLiteral — `object : Api.Listener { … }`: an anonymous |
| 1418 | /// class. Headers (each delegation_specifier) walked first by the CURRENT |
no test coverage detected