(&mut self, node: Node<'t>)
| 622 | } |
| 623 | |
| 624 | fn visit_for_calls_and_structure(&mut self, node: Node<'t>) { |
| 625 | stack_guard!(); |
| 626 | let kind = node.kind(); |
| 627 | self.maybe_capture_fn_refs(node); |
| 628 | |
| 629 | // A `require`/`include` in a body includes its file there, so the |
| 630 | // function depends on it (#3296), as visitForCallsAndStructure does. |
| 631 | // Its children are still walked below. |
| 632 | if matches!( |
| 633 | kind, |
| 634 | "include_expression" | "include_once_expression" | "require_expression" |
| 635 | | "require_once_expression" |
| 636 | ) { |
| 637 | self.extract_import(node); |
| 638 | } |
| 639 | |
| 640 | if matches!( |
| 641 | kind, |
| 642 | "function_call_expression" | "member_call_expression" | "scoped_call_expression" |
| 643 | ) { |
| 644 | self.extract_call(node); |
| 645 | } else if kind == "object_creation_expression" { |
| 646 | self.extract_instantiation(node); |
| 647 | if let Some(anon_body) = find_anonymous_class_body(node) { |
| 648 | self.extract_anonymous_class(node, anon_body); |
| 649 | return; |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | // Static value reads (`Cls::CONST`, `Cls::$prop`, `Cls::class`). |
| 654 | self.extract_static_member_ref(node); |
| 655 | |
| 656 | // Nested NAMED functions; body-level class/trait/enum/interface |
| 657 | // declarations (the polyfill idiom). NOTE: no method_declaration |
| 658 | // branch — in-body anonymous-class methods vanish (delta #1), and the |
| 659 | // visitNode hook does NOT run here (a const_declaration in a body-level |
| 660 | // class still extracts via extractClass's own visitNode body walk). |
| 661 | if kind == "function_definition" { |
| 662 | let name = self.extract_name(node); |
| 663 | if name != "<anonymous>" { |
| 664 | self.extract_function(node); |
| 665 | return; |
| 666 | } |
| 667 | } |
| 668 | if kind == "class_declaration" { |
| 669 | self.extract_class(node, "class"); |
| 670 | return; |
| 671 | } |
| 672 | if kind == "trait_declaration" { |
| 673 | self.extract_class(node, "trait"); |
| 674 | return; |
| 675 | } |
| 676 | if kind == "enum_declaration" { |
| 677 | self.extract_enum(node); |
| 678 | return; |
| 679 | } |
| 680 | if kind == "interface_declaration" { |
| 681 | self.extract_interface(node); |
no test coverage detected