MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / visit_for_calls_and_structure

Method visit_for_calls_and_structure

codegraph-kernel/src/php.rs:615–669  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

613 }
614
615 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
616 let kind = node.kind();
617 self.maybe_capture_fn_refs(node);
618
619 if matches!(
620 kind,
621 "function_call_expression" | "member_call_expression" | "scoped_call_expression"
622 ) {
623 self.extract_call(node);
624 } else if kind == "object_creation_expression" {
625 self.extract_instantiation(node);
626 if let Some(anon_body) = find_anonymous_class_body(node) {
627 self.extract_anonymous_class(node, anon_body);
628 return;
629 }
630 }
631
632 // Static value reads (`Cls::CONST`, `Cls::$prop`, `Cls::class`).
633 self.extract_static_member_ref(node);
634
635 // Nested NAMED functions; body-level class/trait/enum/interface
636 // declarations (the polyfill idiom). NOTE: no method_declaration
637 // branch — in-body anonymous-class methods vanish (delta #1), and the
638 // visitNode hook does NOT run here (a const_declaration in a body-level
639 // class still extracts via extractClass's own visitNode body walk).
640 if kind == "function_definition" {
641 let name = self.extract_name(node);
642 if name != "<anonymous>" {
643 self.extract_function(node);
644 return;
645 }
646 }
647 if kind == "class_declaration" {
648 self.extract_class(node, "class");
649 return;
650 }
651 if kind == "trait_declaration" {
652 self.extract_class(node, "trait");
653 return;
654 }
655 if kind == "enum_declaration" {
656 self.extract_enum(node);
657 return;
658 }
659 if kind == "interface_declaration" {
660 self.extract_interface(node);
661 return;
662 }
663
664 for i in 0..node.named_child_count() {
665 if let Some(c) = node.named_child(i) {
666 self.visit_for_calls_and_structure(c);
667 }
668 }
669 }
670
671 // --- extractors ----------------------------------------------------------------
672

Callers 1

visit_function_bodyMethod · 0.45

Calls 11

maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected