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

Source from the content-addressed store, hash-verified

1125 }
1126
1127 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
1128 stack_guard!();
1129 let kind = node.kind();
1130 self.maybe_capture_fn_refs(node);
1131
1132 // Rocket route macros: handler paths live in a raw token tree.
1133 if kind == "macro_invocation" {
1134 self.extract_rust_route_macro(node);
1135 }
1136
1137 if kind == "call_expression" {
1138 self.extract_call(node);
1139 } else if kind == "struct_expression" {
1140 self.extract_instantiation(node);
1141 }
1142
1143 // Nested NAMED fns become their own nodes (a nested fn inside an impl
1144 // method walks up to the impl and indexes as a METHOD).
1145 if matches!(kind, "function_item" | "function_signature_item") {
1146 let name = self.extract_name(node);
1147 if name != "<anonymous>" {
1148 self.extract_fn_or_method(node);
1149 return;
1150 }
1151 }
1152
1153 // Structural nodes inside bodies.
1154 if kind == "struct_item" {
1155 self.extract_aggregate(node, "struct");
1156 return;
1157 }
1158 if kind == "union_item" {
1159 self.extract_aggregate(node, "union");
1160 return;
1161 }
1162 if kind == "enum_item" {
1163 self.extract_enum(node);
1164 return;
1165 }
1166 if kind == "trait_item" {
1167 self.extract_interface(node);
1168 return;
1169 }
1170
1171 for i in 0..node.named_child_count() {
1172 if let Some(c) = node.named_child(i) {
1173 self.visit_for_calls_and_structure(c);
1174 }
1175 }
1176 }
1177
1178 // --- fn refs (RUST_SPEC) ----------------------------------------------------
1179

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_aggregateMethod · 0.45
extract_enumMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected