extractVariable's generic fallback (top-level locals — rare in Java).
(&mut self, node: Node<'t>)
| 831 | |
| 832 | /// extractVariable's generic fallback (top-level locals — rare in Java). |
| 833 | fn extract_variable(&mut self, node: Node<'t>) { |
| 834 | let kind: &'static str = if self.is_const(node) { "constant" } else { "variable" }; |
| 835 | let docstring = preceding_docstring(node, self.src); |
| 836 | for i in 0..node.named_child_count() { |
| 837 | let Some(child) = node.named_child(i) else { continue }; |
| 838 | let name = match child.kind() { |
| 839 | "identifier" => self.text(child).to_string(), |
| 840 | "variable_declarator" => self.extract_name(child), |
| 841 | _ => continue, |
| 842 | }; |
| 843 | if name.is_empty() || name == "<anonymous>" { |
| 844 | continue; |
| 845 | } |
| 846 | self.create_node( |
| 847 | kind, |
| 848 | &name, |
| 849 | child, |
| 850 | Extra { docstring: docstring.clone(), ..Extra::default() }, |
| 851 | ); |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | fn extract_import(&mut self, node: Node<'t>) { |
| 856 | let import_text = self.text(node).trim().to_string(); |
no test coverage detected