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

Method visit_for_calls_and_structure

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

Source from the content-addressed store, hash-verified

1105 }
1106
1107 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
1108 let kind = node.kind();
1109 self.maybe_capture_fn_refs(node);
1110
1111 // Rocket route macros: handler paths live in a raw token tree.
1112 if kind == "macro_invocation" {
1113 self.extract_rust_route_macro(node);
1114 }
1115
1116 if kind == "call_expression" {
1117 self.extract_call(node);
1118 } else if kind == "struct_expression" {
1119 self.extract_instantiation(node);
1120 }
1121
1122 // Nested NAMED fns become their own nodes (a nested fn inside an impl
1123 // method walks up to the impl and indexes as a METHOD).
1124 if matches!(kind, "function_item" | "function_signature_item") {
1125 let name = self.extract_name(node);
1126 if name != "<anonymous>" {
1127 self.extract_fn_or_method(node);
1128 return;
1129 }
1130 }
1131
1132 // Structural nodes inside bodies.
1133 if kind == "struct_item" {
1134 self.extract_struct(node);
1135 return;
1136 }
1137 if kind == "enum_item" {
1138 self.extract_enum(node);
1139 return;
1140 }
1141 if kind == "trait_item" {
1142 self.extract_interface(node);
1143 return;
1144 }
1145
1146 for i in 0..node.named_child_count() {
1147 if let Some(c) = node.named_child(i) {
1148 self.visit_for_calls_and_structure(c);
1149 }
1150 }
1151 }
1152
1153 // --- fn refs (RUST_SPEC) ----------------------------------------------------
1154

Callers 1

visit_function_bodyMethod · 0.45

Calls 9

extract_fn_or_methodMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
extract_nameMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected