(&mut self, node: Node<'t>)
| 810 | // --- the dispatcher (visitNode) -------------------------------------------- |
| 811 | |
| 812 | fn visit_node(&mut self, node: Node<'t>) { |
| 813 | stack_guard!(); |
| 814 | let kind = node.kind(); |
| 815 | let mut skip_children = false; |
| 816 | |
| 817 | // Function-as-value capture — independent of the dispatch ladder. |
| 818 | self.maybe_capture_fn_refs(node); |
| 819 | |
| 820 | // `window.App = {…}` / `App.utils = {…}`: the object's functions are |
| 821 | // the path's members (#2300). Its whole subtree is handled there. |
| 822 | if kind == "assignment_expression" && self.extract_assigned_object_owner(node, true) { |
| 823 | return; |
| 824 | } |
| 825 | |
| 826 | if is_function_type(kind) { |
| 827 | // (the isInsideClassLike + methodTypes overlap is Python/Ruby-only) |
| 828 | self.extract_function(node, None); |
| 829 | skip_children = true; |
| 830 | } else if kind == "function_signature" && self.variant.is_ts() && is_ambient_function_signature(node, self.file_path) { |
| 831 | // A bodiless function that no implementation follows: a |
| 832 | // `declare function`, a function in a `declare module` body or a `.d.ts`. |
| 833 | self.extract_function(node, None); |
| 834 | skip_children = true; |
| 835 | } else if is_class_node(self.variant, node) { |
| 836 | self.extract_class(node); |
| 837 | skip_children = true; |
| 838 | } else if is_method_type(self.variant, kind) |
| 839 | && (!is_signature_method_type(kind) || self.inside_class_like()) |
| 840 | { |
| 841 | if classify_ts_class_member(node) == Member::Property { |
| 842 | let prop = self.extract_property(node); |
| 843 | // The initializer walked under the property took its own |
| 844 | // candidates; the scan covers the rest of the field. |
| 845 | let mut walked: Option<HashSet<usize>> = None; |
| 846 | if let (Some((row, name)), Some(value)) = (prop, node.child_by_field_name("value")) { |
| 847 | self.stack.push(Scope { row, kind: "property", name }); |
| 848 | self.visit_function_body(value); |
| 849 | self.stack.pop(); |
| 850 | walked = Some(HashSet::from([value.id()])); |
| 851 | } |
| 852 | self.scan_fn_ref_subtree(node, 0, walked.as_ref()); |
| 853 | } else { |
| 854 | self.extract_method(node); |
| 855 | } |
| 856 | skip_children = true; |
| 857 | } else if self.variant.is_ts() && kind == "interface_declaration" { |
| 858 | self.extract_interface(node); |
| 859 | skip_children = true; |
| 860 | } else if self.variant.is_ts() && kind == "enum_declaration" { |
| 861 | self.extract_enum(node); |
| 862 | skip_children = true; |
| 863 | } else if self.variant.is_ts() && kind == "type_alias_declaration" { |
| 864 | skip_children = self.extract_type_alias(node); |
| 865 | } else if is_variable_type(kind) && !self.inside_class_like() { |
| 866 | // An initializer extract_variable walked under the symbol it |
| 867 | // declares (a constant's, a component wrapper's) captured its own |
| 868 | // candidates; the scan skips it. |
| 869 | let walked = self.extract_variable(node); |
no test coverage detected