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

Method visit_body

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

Source from the content-addressed store, hash-verified

1179 // --- visitFunctionBody (:5129-5286) — scala rows ----------------------
1180
1181 fn visit_body(&mut self, node: Node<'t>) {
1182 stack_guard!();
1183 self.maybe_capture_fn_refs(node);
1184
1185 let kind = node.kind();
1186 if kind == "call_expression" {
1187 self.extract_call(node);
1188 // falls through to recursion
1189 } else if kind == "instance_expression" {
1190 // instantiates + recursion (findAnonymousClassBody null): anon
1191 // template_body defs are NOT dispatched here (functionTypes
1192 // empty; methodTypes not checked in this walker) — their calls
1193 // attribute to the enclosing method.
1194 self.extract_instantiation(node);
1195 }
1196
1197 self.extract_static_member_ref(node);
1198
1199 // Nested named defs mint NOTHING (:5245 checks functionTypes — EMPTY;
1200 // the inverse of kotlin). Body-local classes/objects/traits/enums DO
1201 // extract fully.
1202 match kind {
1203 "class_definition" => {
1204 self.extract_class(node, "class");
1205 return;
1206 }
1207 "object_definition" => {
1208 self.extract_class(node, "module");
1209 return;
1210 }
1211 "trait_definition" => {
1212 self.extract_class(node, "trait");
1213 return;
1214 }
1215 "enum_definition" => {
1216 self.extract_enum(node);
1217 return;
1218 }
1219 _ => {}
1220 }
1221
1222 let mut cursor = node.walk();
1223 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
1224 for child in children {
1225 self.visit_body(child);
1226 }
1227 }
1228
1229 // --- function-as-value capture (#756) — SCALA_SPEC --------------------
1230

Callers 2

hookMethod · 0.45

Calls 8

walkMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected