flushFnRefCandidates with the cFamily gate policy: value/list positions at FILE scope skip the same-file/import gate (C has no symbol imports); cpp additionally requires explicit `&` forms outside those positions.
(&mut self)
| 1760 | /// at FILE scope skip the same-file/import gate (C has no symbol imports); |
| 1761 | /// cpp additionally requires explicit `&` forms outside those positions. |
| 1762 | fn flush_fn_ref_candidates(&mut self) { |
| 1763 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 1764 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 1765 | return; |
| 1766 | } |
| 1767 | let address_of_only = self.variant == Variant::Cpp; |
| 1768 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 1769 | for c in cands { |
| 1770 | let at_file_scope = self.node_ids[c.from as usize].starts_with("file:"); |
| 1771 | if address_of_only |
| 1772 | && !c.explicit_ref |
| 1773 | && !(at_file_scope && matches!(c.mode, Mode::Value | Mode::List)) |
| 1774 | { |
| 1775 | continue; |
| 1776 | } |
| 1777 | if !c.name.starts_with("this.") && !c.name.contains("::") { |
| 1778 | let skip_gate = matches!(c.mode, Mode::Value | Mode::List) && at_file_scope; |
| 1779 | if !skip_gate |
| 1780 | && !self.defined_fn_names.contains(&c.name) |
| 1781 | && !self.imported_names.contains(&c.name) |
| 1782 | { |
| 1783 | continue; |
| 1784 | } |
| 1785 | } |
| 1786 | if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) { |
| 1787 | continue; |
| 1788 | } |
| 1789 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 1790 | let name_ref = self.arena.put(&c.name); |
| 1791 | self.tables.push_ref(&RefRow { |
| 1792 | from_idx: c.from, |
| 1793 | kind: FUNCTION_REF_CODE, |
| 1794 | line: c.line, |
| 1795 | column, |
| 1796 | reference_name: name_ref, |
| 1797 | candidates: NONE_STR, |
| 1798 | from_id_str: NONE_STR, |
| 1799 | }); |
| 1800 | } |
| 1801 | } |
| 1802 | |
| 1803 | // --- value refs (C only: VALUE_REF_LANGS has 'c', not 'cpp') ------------- |
| 1804 |
no test coverage detected