(&mut self, node: Node<'t>)
| 624 | } |
| 625 | |
| 626 | fn extract_method(&mut self, node: Node<'t>) { |
| 627 | stack_guard!(); |
| 628 | if !self.inside_class_like() { |
| 629 | // (object-literal parents don't exist in Java; a stray top-level |
| 630 | // method extracts as a function, mirroring extractMethod's tail) |
| 631 | self.extract_function(node); |
| 632 | return; |
| 633 | } |
| 634 | let name = self.extract_name(node); |
| 635 | let extra = Extra { |
| 636 | docstring: preceding_docstring(node, self.src), |
| 637 | signature: self.signature_of(node), |
| 638 | visibility: self.visibility_of(node), |
| 639 | is_static: Some(self.is_static(node)), |
| 640 | return_type: self.normalize_java_type(node.child_by_field_name("type")), |
| 641 | ..Extra::default() |
| 642 | }; |
| 643 | let Some(row) = self.create_node("method", &name, node, extra) else { return }; |
| 644 | self.extract_type_annotations(node, row); |
| 645 | self.extract_decorators_for(node, row); |
| 646 | self.stack.push(Scope { row, kind: "method", name }); |
| 647 | if let Some(body) = node.child_by_field_name("body") { |
| 648 | self.visit_function_body(body); |
| 649 | } |
| 650 | self.stack.pop(); |
| 651 | } |
| 652 | |
| 653 | /// extractFunction — only reachable for a method outside any class. |
| 654 | fn extract_function(&mut self, node: Node<'t>) { |
no test coverage detected