| 771 | } |
| 772 | |
| 773 | fn flush_fn_ref_candidates(&mut self) { |
| 774 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 775 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 776 | return; |
| 777 | } |
| 778 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 779 | for (from, c) in cands { |
| 780 | // Gate: `this.<member>` always flushes; everything else must match |
| 781 | // a same-file function/method or an imported name. (The `::` and |
| 782 | // ungated-mode policies belong to other languages' specs.) |
| 783 | if !c.name.starts_with("this.") |
| 784 | && !c.name.contains("::") |
| 785 | && !self.defined_fn_names.contains(&c.name) |
| 786 | && !self.imported_names.contains(&c.name) |
| 787 | { |
| 788 | continue; |
| 789 | } |
| 790 | // Dedupe on the node ID STRING, not the row — ids collide for |
| 791 | // same-(kind, name, line) nodes (minified one-liners) and the TS |
| 792 | // side keys its dedupe on `${fromNodeId}|${name}`. |
| 793 | if !seen.insert((self.node_ids[from as usize].clone(), c.name.clone())) { |
| 794 | continue; |
| 795 | } |
| 796 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 797 | let name_ref = self.arena.put(&c.name); |
| 798 | self.tables.push_ref(&RefRow { |
| 799 | from_idx: from, |
| 800 | kind: FUNCTION_REF_CODE, |
| 801 | line: c.line, |
| 802 | column, |
| 803 | reference_name: name_ref, |
| 804 | candidates: NONE_STR, |
| 805 | from_id_str: NONE_STR, |
| 806 | }); |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | // --- the dispatcher (visitNode) -------------------------------------------- |
| 811 | |