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

Method flush_fn_ref_candidates

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

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

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