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:725–775  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

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

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