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

Method flush_fn_ref_candidates

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

Source from the content-addressed store, hash-verified

569 }
570
571 fn flush_fn_ref_candidates(&mut self) {
572 let cands = std::mem::take(&mut self.fn_ref_cands);
573 if cands.is_empty() || util::is_generated_file(self.file_path) {
574 return;
575 }
576 let mut seen: HashSet<(String, String)> = HashSet::new();
577 for (from, c) in cands {
578 // Gate: `this.<member>` always flushes; everything else must match
579 // a same-file function/method or an imported name. (The `::` and
580 // ungated-mode policies belong to other languages' specs.)
581 if !c.name.starts_with("this.")
582 && !c.name.contains("::")
583 && !self.defined_fn_names.contains(&c.name)
584 && !self.imported_names.contains(&c.name)
585 {
586 continue;
587 }
588 // Dedupe on the node ID STRING, not the row — ids collide for
589 // same-(kind, name, line) nodes (minified one-liners) and the TS
590 // side keys its dedupe on `${fromNodeId}|${name}`.
591 if !seen.insert((self.node_ids[from as usize].clone(), c.name.clone())) {
592 continue;
593 }
594 let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte);
595 let name_ref = self.arena.put(&c.name);
596 self.tables.push_ref(&RefRow {
597 from_idx: from,
598 kind: FUNCTION_REF_CODE,
599 line: c.line,
600 column,
601 reference_name: name_ref,
602 candidates: NONE_STR,
603 from_id_str: NONE_STR,
604 });
605 }
606 }
607
608 // --- the dispatcher (visitNode) --------------------------------------------
609

Callers 1

extractFunction · 0.45

Calls 4

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

Tested by

no test coverage detected