MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / flush_fn_ref_candidates

Method flush_fn_ref_candidates

codegraph-kernel/src/lua.rs:807–838  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

805 }
806
807 fn flush_fn_ref_candidates(&mut self) {
808 let cands = std::mem::take(&mut self.fn_ref_cands);
809 if cands.is_empty() || util::is_generated_file(self.file_path) {
810 return;
811 }
812 let mut seen: HashSet<(String, String)> = HashSet::new();
813 for c in cands {
814 // Gate: same-file function/method names ∪ imported names (lua
815 // candidates are always bare identifiers — no `this.`/`::`).
816 if !c.name.starts_with("this.")
817 && !c.name.contains("::")
818 && !self.defined_fn_names.contains(&c.name)
819 && !self.imported_names.contains(&c.name)
820 {
821 continue;
822 }
823 if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) {
824 continue;
825 }
826 let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte);
827 let name_ref = self.arena.put(&c.name);
828 self.tables.push_ref(&RefRow {
829 from_idx: c.from,
830 kind: FUNCTION_REF_CODE,
831 line: c.line,
832 column,
833 reference_name: name_ref,
834 candidates: NONE_STR,
835 from_id_str: NONE_STR,
836 });
837 }
838 }
839}
840
841fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef {

Callers 1

extractFunction · 0.45

Calls 4

is_generated_fileFunction · 0.85
col16Function · 0.85
putMethod · 0.80
push_refMethod · 0.45

Tested by

no test coverage detected