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