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

Method normalize_fn_ref_value

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

1690 /// normalizeValue for cFamilySpec: bare identifiers, and the
1691 /// pointer_expression unwrap (`&fn`; `&Cls::m` keeps the qualified name).
1692 fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, mode: Mode, explicit_ref: bool, depth: u32) {
1693 if depth > 4 {
1694 return;
1695 }
1696 match v.kind() {
1697 "identifier" => {
1698 let name = self.text(v);
1699 if name.is_empty() || is_stoplisted(name) {
1700 return;
1701 }
1702 self.push_fn_ref_cand(from, name.to_string(), mode, explicit_ref, v);
1703 }
1704 "pointer_expression" => {
1705 // `&x` is a function value; `*x` is a data read.
1706 if v.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
1707 return;
1708 }
1709 let Some(inner) = v.child_by_field_name("argument") else { return };
1710 if inner.kind() == "qualified_identifier" {
1711 let text = self.text(inner).trim();
1712 if qualified_ref_re().is_match(text) && !is_stoplisted(text) {
1713 self.push_fn_ref_cand(from, text.to_string(), mode, explicit_ref, inner);
1714 }
1715 return;
1716 }
1717 self.normalize_fn_ref_value(inner, from, mode, explicit_ref, depth + 1);
1718 }
1719 _ => {}
1720 }
1721 }
1722
1723 fn push_fn_ref_cand(&mut self, from: u32, name: String, mode: Mode, explicit_ref: bool, node: Node) {
1724 let p = node.start_position();

Callers 1

maybe_capture_fn_refsMethod · 0.45

Calls 4

qualified_ref_reFunction · 0.85
is_stoplistedFunction · 0.70
textMethod · 0.45
push_fn_ref_candMethod · 0.45

Tested by

no test coverage detected