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

Method flush_fn_ref_candidates

codegraph-kernel/src/ccpp/mod.rs:2459–2498  ·  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

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

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