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

Method visit_node

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

Source from the content-addressed store, hash-verified

885 // --- the dispatcher (visitNode, Kotlin-relevant branches) -----------------------
886
887 fn visit_node(&mut self, node: Node<'t>) {
888 stack_guard!();
889 if let Some(walked) = self.try_visit_hook(node) {
890 self.scan_fn_ref_subtree(node, 0, &walked.into_iter().collect());
891 return;
892 }
893
894 let kind = node.kind();
895 let mut skip_children = false;
896
897 self.maybe_capture_fn_refs(node);
898
899 if kind == "function_declaration" {
900 if self.inside_class_like() {
901 self.extract_method(node);
902 } else {
903 self.extract_function(node);
904 }
905 skip_children = true;
906 } else if kind == "class_declaration" {
907 // classifyClassNode: `interface`/`enum` keyword children.
908 let mut classified = "class";
909 for c in node.children(&mut node.walk()) {
910 if c.kind() == "interface" {
911 classified = "interface";
912 break;
913 }
914 if c.kind() == "enum" {
915 classified = "enum";
916 break;
917 }
918 }
919 match classified {
920 "interface" => self.extract_interface(node),
921 "enum" => self.extract_enum(node),
922 _ => self.extract_class(node),
923 }
924 skip_children = true;
925 } else if kind == "object_declaration" {
926 // extraClassNodeTypes → extractClass → kind `class`.
927 self.extract_class(node);
928 skip_children = true;
929 } else if kind == "type_alias" {
930 skip_children = self.extract_type_alias(node);
931 } else if kind == "property_declaration" {
932 // Hook-declined destructuring: extractField/extractVariable both
933 // find no matching children for kotlin — NOTHING minted, RHS
934 // invisible; candidates-only scan.
935 self.scan_fn_ref_subtree(node, 0, &HashSet::new());
936 skip_children = true;
937 } else if kind == "import_header" {
938 self.extract_import(node);
939 } else if kind == "call_expression" {
940 self.extract_call(node);
941 } else if kind == "infix_expression" {
942 self.extract_infix_call(node);
943 } else if kind == "object_literal" {
944 // `object : Api.Listener { … }` — an anonymous class.

Callers 6

extractFunction · 0.45
extract_classMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
visit_enum_entry_bodyMethod · 0.45

Calls 15

childrenMethod · 0.80
extract_infix_callMethod · 0.80
try_visit_hookMethod · 0.45
scan_fn_ref_subtreeMethod · 0.45
collectMethod · 0.45
maybe_capture_fn_refsMethod · 0.45
inside_class_likeMethod · 0.45
extract_methodMethod · 0.45
extract_functionMethod · 0.45
walkMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected