| 640 | } |
| 641 | |
| 642 | fn flush_fn_ref_candidates(&mut self) { |
| 643 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 644 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 645 | return; |
| 646 | } |
| 647 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 648 | for (from, c) in cands { |
| 649 | // Gate: `this.<member>` always flushes; everything else must match |
| 650 | // a same-file function/method or an imported name. (The `::` and |
| 651 | // ungated-mode policies belong to other languages' specs.) |
| 652 | if !c.name.starts_with("this.") |
| 653 | && !c.name.contains("::") |
| 654 | && !self.defined_fn_names.contains(&c.name) |
| 655 | && !self.imported_names.contains(&c.name) |
| 656 | { |
| 657 | continue; |
| 658 | } |
| 659 | // Dedupe on the node ID STRING, not the row — ids collide for |
| 660 | // same-(kind, name, line) nodes (minified one-liners) and the TS |
| 661 | // side keys its dedupe on `${fromNodeId}|${name}`. |
| 662 | if !seen.insert((self.node_ids[from as usize].clone(), c.name.clone())) { |
| 663 | continue; |
| 664 | } |
| 665 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 666 | let name_ref = self.arena.put(&c.name); |
| 667 | self.tables.push_ref(&RefRow { |
| 668 | from_idx: from, |
| 669 | kind: FUNCTION_REF_CODE, |
| 670 | line: c.line, |
| 671 | column, |
| 672 | reference_name: name_ref, |
| 673 | candidates: NONE_STR, |
| 674 | from_id_str: NONE_STR, |
| 675 | }); |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | // --- the dispatcher (visitNode) -------------------------------------------- |
| 680 | |