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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 7

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