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

Method flush_fn_ref_candidates

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

Source from the content-addressed store, hash-verified

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

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