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

Source from the content-addressed store, hash-verified

965 }
966
967 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
968 stack_guard!();
969 let kind = node.kind();
970 self.maybe_capture_fn_refs(node);
971
972 if kind == "call_expression" {
973 self.extract_call(node);
974 } else if kind == "infix_expression" {
975 self.extract_infix_call(node);
976 }
977 // (INSTANTIATION_KINDS has no kotlin members; extractBareCall absent.)
978
979 self.extract_static_member_ref(node);
980
981 // `object : Api.Listener { … }` in a body or an initializer — an
982 // anonymous class; its header is this body's code.
983 if kind == "object_literal" && self.extract_object_literal(node, true) {
984 return;
985 }
986
987 if kind == "function_declaration" {
988 let name = self.extract_name(node);
989 if name != "<anonymous>" {
990 // extractFunction diverts receiver-bearing nested fns to
991 // extractMethod itself.
992 self.extract_function(node);
993 return;
994 }
995 }
996 if kind == "class_declaration" {
997 let mut classified = "class";
998 for c in node.children(&mut node.walk()) {
999 if c.kind() == "interface" {
1000 classified = "interface";
1001 break;
1002 }
1003 if c.kind() == "enum" {
1004 classified = "enum";
1005 break;
1006 }
1007 }
1008 match classified {
1009 "interface" => self.extract_interface(node),
1010 "enum" => self.extract_enum(node),
1011 _ => self.extract_class(node),
1012 }
1013 return;
1014 }
1015 // object_declaration is NOT dispatched here — a body-local object's
1016 // `fun`s hit the function branch above and leak out as FUNCTIONS
1017 // under the enclosing fn; its properties mint nothing (quirk).
1018
1019 for c in node.named_children(&mut node.walk()) {
1020 self.visit_for_calls_and_structure(c);
1021 }
1022 }
1023
1024 // --- extractors ------------------------------------------------------------------

Callers 2

visit_function_bodyMethod · 0.45

Calls 12

extract_infix_callMethod · 0.80
childrenMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
walkMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
extract_classMethod · 0.45

Tested by

no test coverage detected