(&mut self, node: Node<'t>)
| 560 | // --- the dispatcher (visitNode, Swift-relevant branches) ----------------------- |
| 561 | |
| 562 | fn visit_node(&mut self, node: Node<'t>) { |
| 563 | let kind = node.kind(); |
| 564 | let mut skip_children = false; |
| 565 | |
| 566 | self.maybe_capture_fn_refs(node); |
| 567 | |
| 568 | if kind == "function_declaration" { |
| 569 | if self.inside_class_like() { |
| 570 | self.extract_method(node); |
| 571 | } else { |
| 572 | self.extract_function(node); |
| 573 | } |
| 574 | skip_children = true; |
| 575 | } else if kind == "class_declaration" { |
| 576 | // classifyClassNode: `struct`/`enum` keyword children; actor and |
| 577 | // extension fall through to 'class'. |
| 578 | let mut classified = "class"; |
| 579 | for i in 0..node.child_count() { |
| 580 | if let Some(c) = node.child(i) { |
| 581 | if c.kind() == "struct" { |
| 582 | classified = "struct"; |
| 583 | break; |
| 584 | } |
| 585 | if c.kind() == "enum" { |
| 586 | classified = "enum"; |
| 587 | break; |
| 588 | } |
| 589 | } |
| 590 | } |
| 591 | match classified { |
| 592 | "struct" => self.extract_struct(node), |
| 593 | "enum" => self.extract_enum(node), |
| 594 | _ => self.extract_class(node), |
| 595 | } |
| 596 | skip_children = true; |
| 597 | } else if kind == "protocol_declaration" { |
| 598 | self.extract_interface(node); |
| 599 | skip_children = true; |
| 600 | } else if kind == "typealias_declaration" { |
| 601 | skip_children = self.extract_type_alias(node); |
| 602 | } else if kind == "property_declaration" && !self.inside_class_like() { |
| 603 | // Top-level let/var (extractVariable's swift branch). Initializers |
| 604 | // are NEVER walked — candidates-only scan. |
| 605 | self.extract_variable(node); |
| 606 | self.scan_fn_ref_subtree(node, 0); |
| 607 | skip_children = true; |
| 608 | } else if matches!(kind, "property_declaration" | "protocol_property_declaration") |
| 609 | && self.inside_class_like() |
| 610 | { |
| 611 | skip_children = self.dedicated_property_branch(node); |
| 612 | } else if kind == "import_declaration" { |
| 613 | self.extract_import(node); |
| 614 | } else if kind == "call_expression" { |
| 615 | self.extract_call(node); |
| 616 | } |
| 617 | // init/deinit/subscript declarations, macro_invocation, directive, |
| 618 | // diagnostic, operator/precedence declarations, protocol function |
| 619 | // requirements, associatedtype: no branch — recursed. Their calls |
no test coverage detected