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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

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