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

Method flush_fn_ref_candidates

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

Source from the content-addressed store, hash-verified

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

Callers 1

extractFunction · 0.45

Calls 5

is_generated_fileFunction · 0.85
col16Function · 0.85
putMethod · 0.65
takeFunction · 0.50
push_refMethod · 0.45

Tested by

no test coverage detected