extractName / extractNameRaw for the TS/JS configs.
(&self, node: Node)
| 734 | |
| 735 | /// extractName / extractNameRaw for the TS/JS configs. |
| 736 | fn extract_name(&self, node: Node) -> String { |
| 737 | // javascriptExtractor.resolveName: field_definition names its key the |
| 738 | // `property` field. |
| 739 | if !self.variant.is_ts() && node.kind() == "field_definition" { |
| 740 | if let Some(prop) = node.child_by_field_name("property") { |
| 741 | return self.text(prop).to_string(); |
| 742 | } |
| 743 | } |
| 744 | if let Some(name_node) = node.child_by_field_name("name") { |
| 745 | return self.text(name_node).to_string(); |
| 746 | } |
| 747 | if matches!(node.kind(), "arrow_function" | "function_expression") { |
| 748 | return "<anonymous>".to_string(); |
| 749 | } |
| 750 | for i in 0..node.named_child_count() { |
| 751 | if let Some(c) = node.named_child(i) { |
| 752 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 753 | return self.text(c).to_string(); |
| 754 | } |
| 755 | } |
| 756 | } |
| 757 | "<anonymous>".to_string() |
| 758 | } |
| 759 | |
| 760 | /// typescriptExtractor.getSignature / javascriptExtractor.getSignature. |
| 761 | fn signature_of(&self, node: Node) -> Option<String> { |
no test coverage detected