extractName / extractNameRaw for the TS/JS configs.
(&self, node: Node)
| 919 | |
| 920 | /// extractName / extractNameRaw for the TS/JS configs. |
| 921 | fn extract_name(&self, node: Node) -> String { |
| 922 | // javascriptExtractor.resolveName: field_definition names its key the |
| 923 | // `property` field. |
| 924 | if !self.variant.is_ts() && node.kind() == "field_definition" { |
| 925 | if let Some(prop) = node.child_by_field_name("property") { |
| 926 | return self.text(prop).to_string(); |
| 927 | } |
| 928 | } |
| 929 | if let Some(name_node) = node.child_by_field_name("name") { |
| 930 | return self.text(name_node).to_string(); |
| 931 | } |
| 932 | if matches!(node.kind(), "arrow_function" | "function_expression" | "generator_function") { |
| 933 | return "<anonymous>".to_string(); |
| 934 | } |
| 935 | for i in 0..node.named_child_count() { |
| 936 | if let Some(c) = node.named_child(i) { |
| 937 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 938 | return self.text(c).to_string(); |
| 939 | } |
| 940 | } |
| 941 | } |
| 942 | "<anonymous>".to_string() |
| 943 | } |
| 944 | |
| 945 | /// typescriptExtractor.getSignature / javascriptExtractor.getSignature. |
| 946 | fn signature_of(&self, node: Node) -> Option<String> { |
no test coverage detected