extractName (tree-sitter.ts:90-192) — resolveName (ctor names) → name field → the method_signature inner unwrap → identifier-ish child → ` ` (operators land here).
(&self, node: Node<'t>)
| 685 | /// name field → the method_signature inner unwrap → identifier-ish |
| 686 | /// child → `<anonymous>` (operators land here). |
| 687 | fn extract_name(&self, node: Node<'t>) -> String { |
| 688 | // resolveName hook (dart.ts): a typedef has no `name` field, and a |
| 689 | // legacy one writes its return type before its name (`typedef Report |
| 690 | // LegacyMaker(int n);`). |
| 691 | if node.kind() == "type_alias" { |
| 692 | if let Some(name) = type_alias_name(node) { |
| 693 | return self.text(name).to_string(); |
| 694 | } |
| 695 | } |
| 696 | // resolveName hook (dart.ts:244-260): named ctor/factory → ctor name. |
| 697 | if let Some((class_name, ctor_name)) = self.ctor_info(node) { |
| 698 | if ctor_name != class_name { |
| 699 | return ctor_name; |
| 700 | } |
| 701 | } |
| 702 | // `class A = B with C;` — the mixin application's own identifier. |
| 703 | if node.kind() == "class_definition" { |
| 704 | let mut cursor = node.walk(); |
| 705 | let application = node.named_children(&mut cursor).find(|c| c.kind() == "mixin_application_class"); |
| 706 | if let Some(application) = application { |
| 707 | let mut ac = application.walk(); |
| 708 | let id = application.named_children(&mut ac).find(|c| c.kind() == "identifier"); |
| 709 | if let Some(id) = id { |
| 710 | return self.text(id).to_string(); |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | if let Some(name_node) = node.child_by_field_name("name") { |
| 715 | return self.text(name_node).to_string(); |
| 716 | } |
| 717 | if node.kind() == "method_signature" { |
| 718 | let mut cursor = node.walk(); |
| 719 | let inner = node.named_children(&mut cursor).find(|c| { |
| 720 | matches!( |
| 721 | c.kind(), |
| 722 | "function_signature" | "getter_signature" | "setter_signature" |
| 723 | | "constructor_signature" | "factory_constructor_signature" |
| 724 | ) |
| 725 | }); |
| 726 | if let Some(inner) = inner { |
| 727 | let mut ic = inner.walk(); |
| 728 | let id = inner.named_children(&mut ic).find(|c| c.kind() == "identifier"); |
| 729 | if let Some(id) = id { |
| 730 | return self.text(id).to_string(); |
| 731 | } |
| 732 | } |
| 733 | } |
| 734 | let mut cursor = node.walk(); |
| 735 | for c in node.named_children(&mut cursor) { |
| 736 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 737 | return self.text(c).to_string(); |
| 738 | } |
| 739 | } |
| 740 | "<anonymous>".to_string() |
| 741 | } |
| 742 | |
| 743 | // --- the main walk (visitNode, tree-sitter.ts:936-1303) --------------- |
| 744 |
no test coverage detected