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

Source from the content-addressed store, hash-verified

884 }
885
886 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
887 stack_guard!();
888 let kind = node.kind();
889 self.maybe_capture_fn_refs(node);
890
891 if kind == "call_expression" {
892 self.extract_call(node);
893 }
894 // (INSTANTIATION_KINDS has no kotlin members; extractBareCall absent.)
895
896 self.extract_static_member_ref(node);
897
898 if kind == "function_declaration" {
899 let name = self.extract_name(node);
900 if name != "<anonymous>" {
901 // extractFunction diverts receiver-bearing nested fns to
902 // extractMethod itself.
903 self.extract_function(node);
904 return;
905 }
906 }
907 if kind == "class_declaration" {
908 let mut classified = "class";
909 for i in 0..node.child_count() {
910 if let Some(c) = node.child(i) {
911 if c.kind() == "interface" {
912 classified = "interface";
913 break;
914 }
915 if c.kind() == "enum" {
916 classified = "enum";
917 break;
918 }
919 }
920 }
921 match classified {
922 "interface" => self.extract_interface(node),
923 "enum" => self.extract_enum(node),
924 _ => self.extract_class(node),
925 }
926 return;
927 }
928 // object_declaration is NOT dispatched here — a body-local object's
929 // `fun`s hit the function branch above and leak out as FUNCTIONS
930 // under the enclosing fn; its properties mint nothing (quirk).
931
932 for i in 0..node.named_child_count() {
933 if let Some(c) = node.named_child(i) {
934 self.visit_for_calls_and_structure(c);
935 }
936 }
937 }
938
939 // --- extractors ------------------------------------------------------------------
940

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