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

Method visit_for_calls_and_structure

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

Source from the content-addressed store, hash-verified

725 }
726
727 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
728 stack_guard!();
729 let kind = node.kind();
730 self.maybe_capture_fn_refs(node);
731
732 if kind == "call_expression" {
733 self.extract_call(node);
734 }
735 // (INSTANTIATION_KINDS has no kotlin members; extractBareCall absent.)
736
737 self.extract_static_member_ref(node);
738
739 if kind == "function_declaration" {
740 let name = self.extract_name(node);
741 if name != "<anonymous>" {
742 // extractFunction diverts receiver-bearing nested fns to
743 // extractMethod itself.
744 self.extract_function(node);
745 return;
746 }
747 }
748 if kind == "class_declaration" {
749 let mut classified = "class";
750 for i in 0..node.child_count() {
751 if let Some(c) = node.child(i) {
752 if c.kind() == "interface" {
753 classified = "interface";
754 break;
755 }
756 if c.kind() == "enum" {
757 classified = "enum";
758 break;
759 }
760 }
761 }
762 match classified {
763 "interface" => self.extract_interface(node),
764 "enum" => self.extract_enum(node),
765 _ => self.extract_class(node),
766 }
767 return;
768 }
769 // object_declaration is NOT dispatched here — a body-local object's
770 // `fun`s hit the function branch above and leak out as FUNCTIONS
771 // under the enclosing fn; its properties mint nothing (quirk).
772
773 for i in 0..node.named_child_count() {
774 if let Some(c) = node.named_child(i) {
775 self.visit_for_calls_and_structure(c);
776 }
777 }
778 }
779
780 // --- extractors ------------------------------------------------------------------
781

Callers 1

visit_function_bodyMethod · 0.45

Calls 8

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

Tested by

no test coverage detected