(node: Node<'_>, source: &str)
| 182 | } |
| 183 | |
| 184 | pub(super) fn node_name(node: Node<'_>, source: &str) -> Option<String> { |
| 185 | if let Some(name) = node.child_by_field_name("name") { |
| 186 | return Some(text(name, source).into()); |
| 187 | } |
| 188 | if let Some(function) = declarator(node) { |
| 189 | if let Some(name) = function.child_by_field_name("declarator") { |
| 190 | return Some(text(name, source).into()); |
| 191 | } |
| 192 | } |
| 193 | if let Some(parent) = node.parent() { |
| 194 | if matches!( |
| 195 | parent.kind(), |
| 196 | "variable_declarator" | "public_field_definition" | "assignment" | "let_declaration" |
| 197 | ) { |
| 198 | return parent |
| 199 | .child_by_field_name("name") |
| 200 | .or_else(|| parent.child_by_field_name("left")) |
| 201 | .or_else(|| parent.child_by_field_name("pattern")) |
| 202 | .map(|name| text(name, source).into()); |
| 203 | } |
| 204 | } |
| 205 | None |
| 206 | } |
| 207 | |
| 208 | pub(crate) fn qualified(node: Node<'_>, source: &str, language: Language) -> (String, bool) { |
| 209 | let mut reliable = true; |
no test coverage detected