(&mut self, node: Node<'t>)
| 958 | } |
| 959 | |
| 960 | fn extract_variable(&mut self, node: Node<'t>) { |
| 961 | // extractVariable's generic fallback: direct identifier / |
| 962 | // variable_declarator children only — C# nests declarators inside |
| 963 | // variable_declaration, so this NEVER fires (`var x = F();` at top |
| 964 | // level produces no node, no calls ref, no instantiates — preserve). |
| 965 | let kind: &'static str = if self.is_const(node) { "constant" } else { "variable" }; |
| 966 | let docstring = preceding_docstring(node, self.src); |
| 967 | for i in 0..node.named_child_count() { |
| 968 | let Some(child) = node.named_child(i) else { continue }; |
| 969 | let name = match child.kind() { |
| 970 | "identifier" => self.text(child).to_string(), |
| 971 | "variable_declarator" => self.extract_name(child), |
| 972 | _ => continue, |
| 973 | }; |
| 974 | if name.is_empty() || name == "<anonymous>" { |
| 975 | continue; |
| 976 | } |
| 977 | self.create_node( |
| 978 | kind, |
| 979 | &name, |
| 980 | child, |
| 981 | Extra { docstring: docstring.clone(), ..Extra::default() }, |
| 982 | ); |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | /// extractImport via csharpExtractor.extractImport: moduleName = first |
| 987 | /// qualified_name child's text, else first identifier's — with the alias |
no test coverage detected