(&mut self, node: Node<'t>)
| 849 | // --- extractors ---------------------------------------------------------- |
| 850 | |
| 851 | fn extract_function(&mut self, node: Node<'t>) { |
| 852 | // Receiver present (out-of-line `Cls::method` def) → method instead. |
| 853 | if self.variant == Variant::Cpp && self.receiver_type_of(node).is_some() { |
| 854 | self.extract_method(node); |
| 855 | return; |
| 856 | } |
| 857 | |
| 858 | let name = self.extract_name(node); |
| 859 | if name == "<anonymous>" { |
| 860 | if let Some(body) = node.child_by_field_name("body") { |
| 861 | self.visit_function_body(body); |
| 862 | } |
| 863 | return; |
| 864 | } |
| 865 | // Misparse artifacts: drop the node, still walk the body (#946/#1061). |
| 866 | if self.is_misparsed_function(&name, node) { |
| 867 | if let Some(body) = node.child_by_field_name("body") { |
| 868 | self.visit_function_body(body); |
| 869 | } |
| 870 | return; |
| 871 | } |
| 872 | |
| 873 | let extra = Extra { |
| 874 | docstring: preceding_docstring(node, self.src), |
| 875 | visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None }, |
| 876 | return_type: self.return_type_of(node), |
| 877 | ..Extra::default() |
| 878 | }; |
| 879 | let Some(row) = self.create_node("function", &name, node, extra) else { return }; |
| 880 | // (extractTypeAnnotations + extractDecoratorsFor are structural no-ops |
| 881 | // for c/cpp: not in TYPE_ANNOTATION_LANGUAGES, and the decorator node |
| 882 | // kinds never appear as direct children/preceding siblings in these |
| 883 | // grammars — `attribute` only occurs under attribute_declaration.) |
| 884 | self.stack.push(Scope { row, kind: "function", name }); |
| 885 | if let Some(body) = node.child_by_field_name("body") { |
| 886 | self.visit_function_body(body); |
| 887 | } |
| 888 | self.stack.pop(); |
| 889 | } |
| 890 | |
| 891 | fn extract_method(&mut self, node: Node<'t>) { |
| 892 | let receiver_type = if self.variant == Variant::Cpp { self.receiver_type_of(node) } else { None }; |
no test coverage detected