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)
| 1785 | /// at FILE scope skip the same-file/import gate (C has no symbol imports); |
| 1786 | /// cpp additionally requires explicit `&` forms outside those positions. |
| 1787 | fn flush_fn_ref_candidates(&mut self) { |
| 1788 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 1789 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 1790 | return; |
| 1791 | } |
| 1792 | let address_of_only = self.variant == Variant::Cpp; |
| 1793 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 1794 | for c in cands { |
| 1795 | let at_file_scope = self.node_ids[c.from as usize].starts_with("file:"); |
| 1796 | if address_of_only |
| 1797 | && !c.explicit_ref |
| 1798 | && !(at_file_scope && matches!(c.mode, Mode::Value | Mode::List)) |
| 1799 | { |
| 1800 | continue; |
| 1801 | } |
| 1802 | if !c.name.starts_with("this.") && !c.name.contains("::") { |
| 1803 | let skip_gate = matches!(c.mode, Mode::Value | Mode::List) && at_file_scope; |
| 1804 | if !skip_gate |
| 1805 | && !self.defined_fn_names.contains(&c.name) |
| 1806 | && !self.imported_names.contains(&c.name) |
| 1807 | { |
| 1808 | continue; |
| 1809 | } |
| 1810 | } |
| 1811 | if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) { |
| 1812 | continue; |
| 1813 | } |
| 1814 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 1815 | let name_ref = self.arena.put(&c.name); |
| 1816 | self.tables.push_ref(&RefRow { |
| 1817 | from_idx: c.from, |
| 1818 | kind: FUNCTION_REF_CODE, |
| 1819 | line: c.line, |
| 1820 | column, |
| 1821 | reference_name: name_ref, |
| 1822 | candidates: NONE_STR, |
| 1823 | from_id_str: NONE_STR, |
| 1824 | }); |
| 1825 | } |
| 1826 | } |
| 1827 | |
| 1828 | // --- value refs (C only: VALUE_REF_LANGS has 'c', not 'cpp') ------------- |
| 1829 |
no test coverage detected