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

Method normalize_fn_ref_value

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

1713 /// normalizeValue for cFamilySpec: bare identifiers, and the
1714 /// pointer_expression unwrap (`&fn`; `&Cls::m` keeps the qualified name).
1715 fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, mode: Mode, explicit_ref: bool, depth: u32) {
1716 stack_guard!();
1717 if depth > 4 {
1718 return;
1719 }
1720 match v.kind() {
1721 "identifier" => {
1722 let name = self.text(v);
1723 if name.is_empty() || is_stoplisted(name) {
1724 return;
1725 }
1726 self.push_fn_ref_cand(from, name.to_string(), mode, explicit_ref, v);
1727 }
1728 "pointer_expression" => {
1729 // `&x` is a function value; `*x` is a data read.
1730 if v.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
1731 return;
1732 }
1733 let Some(inner) = v.child_by_field_name("argument") else { return };
1734 if inner.kind() == "qualified_identifier" {
1735 let text = self.text(inner).trim();
1736 if qualified_ref_re().is_match(text) && !is_stoplisted(text) {
1737 self.push_fn_ref_cand(from, text.to_string(), mode, explicit_ref, inner);
1738 }
1739 return;
1740 }
1741 self.normalize_fn_ref_value(inner, from, mode, explicit_ref, depth + 1);
1742 }
1743 _ => {}
1744 }
1745 }
1746
1747 fn push_fn_ref_cand(&mut self, from: u32, name: String, mode: Mode, explicit_ref: bool, node: Node) {
1748 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.65
push_fn_ref_candMethod · 0.45

Tested by

no test coverage detected