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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

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