(&mut self, node: Node<'t>)
| 609 | } |
| 610 | |
| 611 | fn extract_method(&mut self, node: Node<'t>) { |
| 612 | stack_guard!(); |
| 613 | if !self.inside_class_like() { |
| 614 | // (object-literal parents don't exist in Java; a stray top-level |
| 615 | // method extracts as a function, mirroring extractMethod's tail) |
| 616 | self.extract_function(node); |
| 617 | return; |
| 618 | } |
| 619 | let name = self.extract_name(node); |
| 620 | let extra = Extra { |
| 621 | docstring: preceding_docstring(node, self.src), |
| 622 | signature: self.signature_of(node), |
| 623 | visibility: self.visibility_of(node), |
| 624 | is_static: Some(self.is_static(node)), |
| 625 | return_type: self.normalize_java_type(node.child_by_field_name("type")), |
| 626 | ..Extra::default() |
| 627 | }; |
| 628 | let Some(row) = self.create_node("method", &name, node, extra) else { return }; |
| 629 | self.extract_type_annotations(node, row); |
| 630 | self.extract_decorators_for(node, row); |
| 631 | self.stack.push(Scope { row, kind: "method", name }); |
| 632 | if let Some(body) = node.child_by_field_name("body") { |
| 633 | self.visit_function_body(body); |
| 634 | } |
| 635 | self.stack.pop(); |
| 636 | } |
| 637 | |
| 638 | /// extractFunction — only reachable for a method outside any class. |
| 639 | fn extract_function(&mut self, node: Node<'t>) { |
no test coverage detected