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

Method scan_fn_ref_subtree

codegraph-kernel/src/tsjs/mod.rs:639–659  ·  view source on GitHub ↗

scanFnRefSubtree: capture-only walk of subtrees the main walkers skip. `walked`: subtrees a body walk has already been through.

(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>)

Source from the content-addressed store, hash-verified

637 /// scanFnRefSubtree: capture-only walk of subtrees the main walkers skip.
638 /// `walked`: subtrees a body walk has already been through.
639 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>) {
640 stack_guard!();
641 if depth > 12 {
642 return;
643 }
644 if walked.map(|w| w.contains(&node.id())).unwrap_or(false) {
645 return;
646 }
647 let kind = node.kind();
648 if depth > 0
649 && (is_function_type(kind) || matches!(kind, "lambda_literal" | "lambda_expression"))
650 {
651 return;
652 }
653 self.maybe_capture_fn_refs(node);
654 for i in 0..node.named_child_count() {
655 if let Some(c) = node.named_child(i) {
656 self.scan_fn_ref_subtree(c, depth + 1, walked);
657 }
658 }
659 }
660
661 fn flush_fn_ref_candidates(&mut self) {
662 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visit_nodeMethod · 0.45

Calls 4

is_function_typeFunction · 0.85
mapMethod · 0.80
idMethod · 0.80
maybe_capture_fn_refsMethod · 0.45

Tested by

no test coverage detected