(&mut self, node: Node<'t>)
| 691 | // --- extractMethod → extractFunction routing (:1737 / :1517) ---------- |
| 692 | |
| 693 | fn extract_method_or_function(&mut self, node: Node<'t>) { |
| 694 | // No receiver hook, no methodsAreTopLevel: inside class-like → method, |
| 695 | // else → function (the object/object_expression parent check never |
| 696 | // matches scala node kinds). |
| 697 | let is_method = self.inside_class_like(); |
| 698 | let name = self.extract_name(node); |
| 699 | if name == "<anonymous>" { |
| 700 | // Unreachable for scala defs (name field required) — preserved: |
| 701 | // walk the body with nothing pushed. |
| 702 | if let Some(body) = node.child_by_field_name("body") { |
| 703 | self.visit_body(body); |
| 704 | } |
| 705 | return; |
| 706 | } |
| 707 | let docstring = preceding_docstring(node, self.src); |
| 708 | let signature = self.signature_of(node); |
| 709 | let visibility = self.visibility_of(node); |
| 710 | let is_static = self.is_static_of(node); |
| 711 | let return_type = self.return_type_of(node); |
| 712 | let row = self.create_node( |
| 713 | if is_method { "method" } else { "function" }, |
| 714 | &name, |
| 715 | node, |
| 716 | Extra { |
| 717 | docstring, |
| 718 | signature, |
| 719 | visibility, |
| 720 | is_async: Some(false), |
| 721 | is_static: Some(is_static), |
| 722 | return_type, |
| 723 | }, |
| 724 | ); |
| 725 | let Some(row) = row else { return }; |
| 726 | self.extract_type_annotations(node, row); |
| 727 | self.extract_decorators_for(node, row); |
| 728 | self.stack.push(Scope { row, kind: if is_method { "method" } else { "function" }, name }); |
| 729 | if let Some(body) = node.child_by_field_name("body") { |
| 730 | self.visit_body(body); |
| 731 | } |
| 732 | self.stack.pop(); |
| 733 | } |
| 734 | |
| 735 | // --- extractClass (:1679) — classes, objects, traits ------------------ |
| 736 |
no test coverage detected