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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

Callers 2

hookMethod · 0.45

Calls 8

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

Tested by

no test coverage detected