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

Method flush_fn_ref_candidates

codegraph-kernel/src/tsjs/mod.rs:642–677  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

640 }
641
642 fn flush_fn_ref_candidates(&mut self) {
643 let cands = std::mem::take(&mut self.fn_ref_cands);
644 if cands.is_empty() || util::is_generated_file(self.file_path) {
645 return;
646 }
647 let mut seen: HashSet<(String, String)> = HashSet::new();
648 for (from, c) in cands {
649 // Gate: `this.<member>` always flushes; everything else must match
650 // a same-file function/method or an imported name. (The `::` and
651 // ungated-mode policies belong to other languages' specs.)
652 if !c.name.starts_with("this.")
653 && !c.name.contains("::")
654 && !self.defined_fn_names.contains(&c.name)
655 && !self.imported_names.contains(&c.name)
656 {
657 continue;
658 }
659 // Dedupe on the node ID STRING, not the row — ids collide for
660 // same-(kind, name, line) nodes (minified one-liners) and the TS
661 // side keys its dedupe on `${fromNodeId}|${name}`.
662 if !seen.insert((self.node_ids[from as usize].clone(), c.name.clone())) {
663 continue;
664 }
665 let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte);
666 let name_ref = self.arena.put(&c.name);
667 self.tables.push_ref(&RefRow {
668 from_idx: from,
669 kind: FUNCTION_REF_CODE,
670 line: c.line,
671 column,
672 reference_name: name_ref,
673 candidates: NONE_STR,
674 from_id_str: NONE_STR,
675 });
676 }
677 }
678
679 // --- the dispatcher (visitNode) --------------------------------------------
680

Callers 1

extractFunction · 0.45

Calls 5

is_generated_fileFunction · 0.85
col16Function · 0.85
putMethod · 0.65
takeFunction · 0.50
push_refMethod · 0.45

Tested by

no test coverage detected