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

Method scan_fn_ref_subtree

codegraph-kernel/src/tsjs/mod.rs:620–640  ·  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

618 /// scanFnRefSubtree: capture-only walk of subtrees the main walkers skip.
619 /// `walked`: subtrees a body walk has already been through.
620 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>) {
621 stack_guard!();
622 if depth > 12 {
623 return;
624 }
625 if walked.map(|w| w.contains(&node.id())).unwrap_or(false) {
626 return;
627 }
628 let kind = node.kind();
629 if depth > 0
630 && (is_function_type(kind) || matches!(kind, "lambda_literal" | "lambda_expression"))
631 {
632 return;
633 }
634 self.maybe_capture_fn_refs(node);
635 for i in 0..node.named_child_count() {
636 if let Some(c) = node.named_child(i) {
637 self.scan_fn_ref_subtree(c, depth + 1, walked);
638 }
639 }
640 }
641
642 fn flush_fn_ref_candidates(&mut self) {
643 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