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

Method scan_fn_ref_subtree

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

751 /// scanFnRefSubtree: capture-only walk of subtrees the main walkers skip.
752 /// `walked`: subtrees a body walk has already been through.
753 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>) {
754 stack_guard!();
755 if depth > 12 {
756 return;
757 }
758 if walked.map(|w| w.contains(&node.id())).unwrap_or(false) {
759 return;
760 }
761 let kind = node.kind();
762 if depth > 0
763 && (is_function_type(kind) || matches!(kind, "lambda_literal" | "lambda_expression"))
764 {
765 return;
766 }
767 self.maybe_capture_fn_refs(node);
768 for c in node.named_children(&mut node.walk()) {
769 self.scan_fn_ref_subtree(c, depth + 1, walked);
770 }
771 }
772
773 fn flush_fn_ref_candidates(&mut self) {
774 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visit_nodeMethod · 0.45

Calls 5

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

Tested by

no test coverage detected