extractName incl. the resolveName hook: a multi-segment extension name (`extension KF.Builder`) takes the LAST type_identifier's text.
(&self, node: Node)
| 429 | /// extractName incl. the resolveName hook: a multi-segment extension name |
| 430 | /// (`extension KF.Builder`) takes the LAST type_identifier's text. |
| 431 | fn extract_name(&self, node: Node) -> String { |
| 432 | if node.kind() == "class_declaration" { |
| 433 | if let Some(name_node) = node.child_by_field_name("name") { |
| 434 | if name_node.kind() == "user_type" { |
| 435 | let ids: Vec<Node> = (0..name_node.named_child_count()) |
| 436 | .filter_map(|i| name_node.named_child(i)) |
| 437 | .filter(|c| c.kind() == "type_identifier") |
| 438 | .collect(); |
| 439 | if ids.len() > 1 { |
| 440 | return self.text(ids[ids.len() - 1]).to_string(); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | if let Some(name_node) = node.child_by_field_name("name") { |
| 446 | return self.text(name_node).to_string(); |
| 447 | } |
| 448 | for i in 0..node.named_child_count() { |
| 449 | if let Some(c) = node.named_child(i) { |
| 450 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 451 | return self.text(c).to_string(); |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | "<anonymous>".to_string() |
| 456 | } |
| 457 | |
| 458 | /// getVisibility: whole-text substring matching over `modifiers` children; |
| 459 | /// default INTERNAL. `open` → internal, `fileprivate` → private (via the |
no test coverage detected