extractName / extractNameRaw for the TS/JS configs.
(&self, node: Node)
| 1022 | |
| 1023 | /// extractName / extractNameRaw for the TS/JS configs. |
| 1024 | fn extract_name(&self, node: Node) -> String { |
| 1025 | // javascriptExtractor.resolveName: field_definition names its key the |
| 1026 | // `property` field. |
| 1027 | if !self.variant.is_ts() && node.kind() == "field_definition" { |
| 1028 | if let Some(prop) = node.child_by_field_name("property") { |
| 1029 | return self.text(prop).to_string(); |
| 1030 | } |
| 1031 | } |
| 1032 | if let Some(name_node) = node.child_by_field_name("name") { |
| 1033 | return self.text(name_node).to_string(); |
| 1034 | } |
| 1035 | if matches!(node.kind(), "arrow_function" | "function_expression" | "generator_function") { |
| 1036 | return "<anonymous>".to_string(); |
| 1037 | } |
| 1038 | for i in 0..node.named_child_count() { |
| 1039 | if let Some(c) = node.named_child(i) { |
| 1040 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 1041 | return self.text(c).to_string(); |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 | "<anonymous>".to_string() |
| 1046 | } |
| 1047 | |
| 1048 | /// typescriptExtractor.getSignature / javascriptExtractor.getSignature. |
| 1049 | fn signature_of(&self, node: Node) -> Option<String> { |
no test coverage detected