| 1503 | } |
| 1504 | |
| 1505 | fn flush_fn_ref_candidates(&mut self) { |
| 1506 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 1507 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 1508 | return; |
| 1509 | } |
| 1510 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 1511 | for c in cands { |
| 1512 | // `this.<m>` and `Cls::m` shapes always flush; HOF-position string |
| 1513 | // callables skip the gate (unique-or-drop at resolution); the rest |
| 1514 | // gate on defined-in-file ∪ bare single-segment `use` imports |
| 1515 | // (path-shaped and `::`-shaped import refs match neither regex). |
| 1516 | if !c.name.starts_with("this.") && !c.name.contains("::") { |
| 1517 | let skip = c.skip_gate; |
| 1518 | if !skip |
| 1519 | && !self.defined_fn_names.contains(&c.name) |
| 1520 | && !self.imported_names.contains(&c.name) |
| 1521 | { |
| 1522 | continue; |
| 1523 | } |
| 1524 | } |
| 1525 | if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) { |
| 1526 | continue; |
| 1527 | } |
| 1528 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 1529 | let name_ref = self.arena.put(&c.name); |
| 1530 | self.tables.push_ref(&RefRow { |
| 1531 | from_idx: c.from, |
| 1532 | kind: FUNCTION_REF_CODE, |
| 1533 | line: c.line, |
| 1534 | column, |
| 1535 | reference_name: name_ref, |
| 1536 | candidates: NONE_STR, |
| 1537 | from_id_str: NONE_STR, |
| 1538 | }); |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | // --- value references ------------------------------------------------------------ |
| 1543 | |