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