| 932 | } |
| 933 | |
| 934 | fn flush_fn_ref_candidates(&mut self) { |
| 935 | let cands = std::mem::take(&mut self.fn_ref_cands); |
| 936 | if cands.is_empty() || util::is_generated_file(self.file_path) { |
| 937 | return; |
| 938 | } |
| 939 | let mut seen: HashSet<(String, String)> = HashSet::new(); |
| 940 | for c in cands { |
| 941 | // Gate: same-file function/method names ∪ imported names (lua |
| 942 | // candidates are always bare identifiers — no `this.`/`::`). |
| 943 | if !c.name.starts_with("this.") |
| 944 | && !c.name.contains("::") |
| 945 | && !self.defined_fn_names.contains(&c.name) |
| 946 | && !self.imported_names.contains(&c.name) |
| 947 | { |
| 948 | continue; |
| 949 | } |
| 950 | if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) { |
| 951 | continue; |
| 952 | } |
| 953 | let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte); |
| 954 | let name_ref = self.arena.put(&c.name); |
| 955 | self.tables.push_ref(&RefRow { |
| 956 | from_idx: c.from, |
| 957 | kind: FUNCTION_REF_CODE, |
| 958 | line: c.line, |
| 959 | column, |
| 960 | reference_name: name_ref, |
| 961 | candidates: NONE_STR, |
| 962 | from_id_str: NONE_STR, |
| 963 | }); |
| 964 | } |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef { |