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

Method flush_fn_ref_candidates

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

Source from the content-addressed store, hash-verified

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

Callers 1

extractFunction · 0.45

Calls 4

is_generated_fileFunction · 0.85
col16Function · 0.85
putMethod · 0.80
push_refMethod · 0.45

Tested by

no test coverage detected