(&mut self, node: Node<'t>)
| 712 | // --- extractMethod → extractFunction routing (:1737 / :1517) ---------- |
| 713 | |
| 714 | fn extract_method_or_function(&mut self, node: Node<'t>) { |
| 715 | stack_guard!(); |
| 716 | // No receiver hook, no methodsAreTopLevel: inside class-like → method, |
| 717 | // else → function (the object/object_expression parent check never |
| 718 | // matches scala node kinds). |
| 719 | let is_method = self.inside_class_like(); |
| 720 | let name = self.extract_name(node); |
| 721 | if name == "<anonymous>" { |
| 722 | // Unreachable for scala defs (name field required) — preserved: |
| 723 | // walk the body with nothing pushed. |
| 724 | if let Some(body) = node.child_by_field_name("body") { |
| 725 | self.visit_body(body); |
| 726 | } |
| 727 | return; |
| 728 | } |
| 729 | let docstring = preceding_docstring(node, self.src); |
| 730 | let signature = self.signature_of(node); |
| 731 | let visibility = self.visibility_of(node); |
| 732 | let is_static = self.is_static_of(node); |
| 733 | let return_type = self.return_type_of(node); |
| 734 | let row = self.create_node( |
| 735 | if is_method { "method" } else { "function" }, |
| 736 | &name, |
| 737 | node, |
| 738 | Extra { |
| 739 | docstring, |
| 740 | signature, |
| 741 | visibility, |
| 742 | is_async: Some(false), |
| 743 | is_static: Some(is_static), |
| 744 | return_type, |
| 745 | }, |
| 746 | ); |
| 747 | let Some(row) = row else { return }; |
| 748 | self.extract_type_annotations(node, row); |
| 749 | self.extract_decorators_for(node, row); |
| 750 | self.stack.push(Scope { row, kind: if is_method { "method" } else { "function" }, name }); |
| 751 | if let Some(body) = node.child_by_field_name("body") { |
| 752 | self.visit_body(body); |
| 753 | } |
| 754 | self.stack.pop(); |
| 755 | } |
| 756 | |
| 757 | // --- extractClass (:1679) — classes, objects, traits ------------------ |
| 758 |
no test coverage detected