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

Method scan_fn_ref_subtree

codegraph-kernel/src/python.rs:971–997  ·  view source on GitHub ↗
(&mut self, node: Node<'t>, depth: u32, walked: &[usize])

Source from the content-addressed store, hash-verified

969 }
970
971 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) {
972 stack_guard!();
973 if depth > 12 {
974 return;
975 }
976 // Subtrees the body walker has already been through.
977 if walked.contains(&node.id()) {
978 return;
979 }
980 // Halts at functionTypes ∪ the fixed arrow/lambda list — python's
981 // `lambda` kind is NOT in that list (mirrored).
982 if depth > 0
983 && matches!(
984 node.kind(),
985 "function_definition" | "arrow_function" | "function_expression" | "lambda_literal"
986 | "lambda_expression"
987 )
988 {
989 return;
990 }
991 self.maybe_capture_fn_refs(node);
992 for i in 0..node.named_child_count() {
993 if let Some(c) = node.named_child(i) {
994 self.scan_fn_ref_subtree(c, depth + 1, walked);
995 }
996 }
997 }
998
999 fn flush_fn_ref_candidates(&mut self) {
1000 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visit_nodeMethod · 0.45

Calls 2

idMethod · 0.80
maybe_capture_fn_refsMethod · 0.45

Tested by

no test coverage detected