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

Method flush_fn_ref_candidates

codegraph-kernel/src/ccpp/mod.rs:2461–2500  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2459 /// at FILE scope skip the same-file/import gate (C has no symbol imports);
2460 /// cpp additionally requires explicit `&` forms outside those positions.
2461 fn flush_fn_ref_candidates(&mut self) {
2462 let cands = std::mem::take(&mut self.fn_ref_cands);
2463 if cands.is_empty() || util::is_generated_file(self.file_path) {
2464 return;
2465 }
2466 let address_of_only = self.variant == Variant::Cpp;
2467 let mut seen: HashSet<(String, String)> = HashSet::new();
2468 for c in cands {
2469 let at_file_scope = self.node_ids[c.from as usize].starts_with("file:");
2470 if address_of_only
2471 && !c.explicit_ref
2472 && !(at_file_scope && matches!(c.mode, Mode::Value | Mode::List))
2473 {
2474 continue;
2475 }
2476 if !c.name.starts_with("this.") && !c.name.contains("::") {
2477 let skip_gate = matches!(c.mode, Mode::Value | Mode::List) && at_file_scope;
2478 if !skip_gate
2479 && !self.defined_fn_names.contains(&c.name)
2480 && !self.imported_names.contains(&c.name)
2481 {
2482 continue;
2483 }
2484 }
2485 if !seen.insert((self.node_ids[c.from as usize].clone(), c.name.clone())) {
2486 continue;
2487 }
2488 let column = util::col16(self.src, &self.line_starts, c.row, c.column_byte);
2489 let name_ref = self.arena.put(&c.name);
2490 self.tables.push_ref(&RefRow {
2491 from_idx: c.from,
2492 kind: FUNCTION_REF_CODE,
2493 line: c.line,
2494 column,
2495 reference_name: name_ref,
2496 candidates: NONE_STR,
2497 from_id_str: NONE_STR,
2498 });
2499 }
2500 }
2501
2502 // --- value refs (C only: VALUE_REF_LANGS has 'c', not 'cpp') -------------
2503

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