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

Method flush_fn_ref_candidates

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

Source from the content-addressed store, hash-verified

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

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