(&mut self, node: Node<'t>)
| 679 | // --- the dispatcher (visitNode) -------------------------------------------- |
| 680 | |
| 681 | fn visit_node(&mut self, node: Node<'t>) { |
| 682 | stack_guard!(); |
| 683 | let kind = node.kind(); |
| 684 | let mut skip_children = false; |
| 685 | |
| 686 | // Function-as-value capture — independent of the dispatch ladder. |
| 687 | self.maybe_capture_fn_refs(node); |
| 688 | |
| 689 | // `window.App = {…}` / `App.utils = {…}`: the object's functions are |
| 690 | // the path's members (#2300). Its whole subtree is handled there. |
| 691 | if kind == "assignment_expression" && self.extract_assigned_object_owner(node, true) { |
| 692 | return; |
| 693 | } |
| 694 | |
| 695 | if is_function_type(kind) { |
| 696 | // (the isInsideClassLike + methodTypes overlap is Python/Ruby-only) |
| 697 | self.extract_function(node, None); |
| 698 | skip_children = true; |
| 699 | } else if kind == "function_signature" && self.variant.is_ts() && is_ambient_function_signature(node, self.file_path) { |
| 700 | // A bodiless function that no implementation follows: a |
| 701 | // `declare function`, a function in a `declare module` body or a `.d.ts`. |
| 702 | self.extract_function(node, None); |
| 703 | skip_children = true; |
| 704 | } else if is_class_node(self.variant, node) { |
| 705 | self.extract_class(node); |
| 706 | skip_children = true; |
| 707 | } else if is_method_type(self.variant, kind) |
| 708 | && (!is_signature_method_type(kind) || self.inside_class_like()) |
| 709 | { |
| 710 | if classify_ts_class_member(node) == Member::Property { |
| 711 | let prop = self.extract_property(node); |
| 712 | // The initializer walked under the property took its own |
| 713 | // candidates; the scan covers the rest of the field. |
| 714 | let mut walked: Option<HashSet<usize>> = None; |
| 715 | if let (Some((row, name)), Some(value)) = (prop, node.child_by_field_name("value")) { |
| 716 | self.stack.push(Scope { row, kind: "property", name }); |
| 717 | self.visit_function_body(value); |
| 718 | self.stack.pop(); |
| 719 | walked = Some(HashSet::from([value.id()])); |
| 720 | } |
| 721 | self.scan_fn_ref_subtree(node, 0, walked.as_ref()); |
| 722 | } else { |
| 723 | self.extract_method(node); |
| 724 | } |
| 725 | skip_children = true; |
| 726 | } else if self.variant.is_ts() && kind == "interface_declaration" { |
| 727 | self.extract_interface(node); |
| 728 | skip_children = true; |
| 729 | } else if self.variant.is_ts() && kind == "enum_declaration" { |
| 730 | self.extract_enum(node); |
| 731 | skip_children = true; |
| 732 | } else if self.variant.is_ts() && kind == "type_alias_declaration" { |
| 733 | skip_children = self.extract_type_alias(node); |
| 734 | } else if is_variable_type(kind) && !self.inside_class_like() { |
| 735 | // An initializer extract_variable walked under the symbol it |
| 736 | // declares (a constant's, a component wrapper's) captured its own |
| 737 | // candidates; the scan skips it. |
| 738 | let walked = self.extract_variable(node); |
no test coverage detected