extractInheritance — delegation_specifier: user_type ?? its constructor_invocation's user_type ?? its explicit_delegation's user_type (`I by impl`) → 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; a function-type delegation names no class and emits nothing).
(&mut self, node: Node<'t>, class_row: u32)
| 1418 | /// out), at the first one (interfaces ride extends too; a function-type |
| 1419 | /// delegation names no class and emits nothing). |
| 1420 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 1421 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 1422 | for child in node.named_children(&mut node.walk()) { |
| 1423 | if child.kind() != "delegation_specifier" { |
| 1424 | continue; |
| 1425 | } |
| 1426 | let user_type = (0..child.named_child_count()) |
| 1427 | .filter_map(|j| child.named_child(j)) |
| 1428 | .find(|c| c.kind() == "user_type"); |
| 1429 | let ctor_inv = (0..child.named_child_count()) |
| 1430 | .filter_map(|j| child.named_child(j)) |
| 1431 | .find(|c| c.kind() == "constructor_invocation"); |
| 1432 | let delegated = (0..child.named_child_count()) |
| 1433 | .filter_map(|j| child.named_child(j)) |
| 1434 | .find(|c| c.kind() == "explicit_delegation") |
| 1435 | .and_then(|d| { |
| 1436 | (0..d.named_child_count()) |
| 1437 | .filter_map(|j| d.named_child(j)) |
| 1438 | .find(|c| c.kind() == "user_type") |
| 1439 | }); |
| 1440 | let target = user_type.or(ctor_inv).or(delegated); |
| 1441 | let Some(target) = target else { continue }; |
| 1442 | let type_node: Option<Node> = if target.kind() == "user_type" { |
| 1443 | Some(target) |
| 1444 | } else { |
| 1445 | (0..target.named_child_count()) |
| 1446 | .filter_map(|j| target.named_child(j)) |
| 1447 | .find(|c| c.kind() == "user_type") |
| 1448 | }; |
| 1449 | let ids: Vec<Node> = match type_node { |
| 1450 | Some(t) => (0..t.named_child_count()) |
| 1451 | .filter_map(|j| t.named_child(j)) |
| 1452 | .filter(|c| c.kind() == "type_identifier") |
| 1453 | .collect(), |
| 1454 | None => Vec::new(), |
| 1455 | }; |
| 1456 | let type_id: Node = ids.first().copied().or(type_node).unwrap_or(target); |
| 1457 | let name = if ids.is_empty() { |
| 1458 | self.text(type_id).to_string() |
| 1459 | } else { |
| 1460 | ids.iter().map(|c| self.text(*c)).collect::<Vec<_>>().join(".") |
| 1461 | }; |
| 1462 | self.push_ref_at(class_row, &name, extends_kind, type_id); |
| 1463 | } |
| 1464 | } |
| 1465 | |
| 1466 | /// extractKotlinObjectLiteral — `object : Api.Listener { … }`: an anonymous |
| 1467 | /// class. Headers (each delegation_specifier) walked first by the CURRENT |
no test coverage detected