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

Method normalize_fn_ref_value

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

normalizeValue for cFamilySpec: bare identifiers, and the pointer_expression unwrap (`&fn`; `&Cls::m` keeps the qualified name).

(&mut self, v: Node<'t>, from: u32, mode: Mode, explicit_ref: bool, depth: u32)

Source from the content-addressed store, hash-verified

2385 /// normalizeValue for cFamilySpec: bare identifiers, and the
2386 /// pointer_expression unwrap (`&fn`; `&Cls::m` keeps the qualified name).
2387 fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, mode: Mode, explicit_ref: bool, depth: u32) {
2388 stack_guard!();
2389 if depth > 4 {
2390 return;
2391 }
2392 match v.kind() {
2393 "identifier" => {
2394 let name = self.text(v);
2395 if name.is_empty() || is_stoplisted(name) {
2396 return;
2397 }
2398 self.push_fn_ref_cand(from, name.to_string(), mode, explicit_ref, v);
2399 }
2400 "pointer_expression" => {
2401 // `&x` is a function value; `*x` is a data read.
2402 if v.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
2403 return;
2404 }
2405 let Some(inner) = v.child_by_field_name("argument") else { return };
2406 if inner.kind() == "qualified_identifier" {
2407 let text = self.text(inner).trim();
2408 if qualified_ref_re().is_match(text) && !is_stoplisted(text) {
2409 self.push_fn_ref_cand(from, text.to_string(), mode, explicit_ref, inner);
2410 }
2411 return;
2412 }
2413 self.normalize_fn_ref_value(inner, from, mode, explicit_ref, depth + 1);
2414 }
2415 _ => {}
2416 }
2417 }
2418
2419 fn push_fn_ref_cand(&mut self, from: u32, name: String, mode: Mode, explicit_ref: bool, node: Node) {
2420 let p = node.start_position();

Callers 1

maybe_capture_fn_refsMethod · 0.45

Calls 5

qualified_ref_reFunction · 0.85
mapMethod · 0.80
is_stoplistedFunction · 0.70
textMethod · 0.65
push_fn_ref_candMethod · 0.45

Tested by

no test coverage detected