extractVariable's generic fallback (top-level locals — rare in Java).
(&mut self, node: Node<'t>)
| 773 | |
| 774 | /// extractVariable's generic fallback (top-level locals — rare in Java). |
| 775 | fn extract_variable(&mut self, node: Node<'t>) { |
| 776 | let kind: &'static str = if self.is_const(node) { "constant" } else { "variable" }; |
| 777 | let docstring = preceding_docstring(node, self.src); |
| 778 | for i in 0..node.named_child_count() { |
| 779 | let Some(child) = node.named_child(i) else { continue }; |
| 780 | let name = match child.kind() { |
| 781 | "identifier" => self.text(child).to_string(), |
| 782 | "variable_declarator" => self.extract_name(child), |
| 783 | _ => continue, |
| 784 | }; |
| 785 | if name.is_empty() || name == "<anonymous>" { |
| 786 | continue; |
| 787 | } |
| 788 | self.create_node( |
| 789 | kind, |
| 790 | &name, |
| 791 | child, |
| 792 | Extra { docstring: docstring.clone(), ..Extra::default() }, |
| 793 | ); |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | fn extract_import(&mut self, node: Node<'t>) { |
| 798 | let import_text = self.text(node).trim().to_string(); |
no test coverage detected