| 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 | |