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