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

Method record_cpp_fn_ptr_binding

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

recordCppFnPtrBinding (tree-sitter.ts:5089).

(&mut self, local_name: &str, value: Option<Node>)

Source from the content-addressed store, hash-verified

1957
1958 /// recordCppFnPtrBinding (tree-sitter.ts:5089).
1959 fn record_cpp_fn_ptr_binding(&mut self, local_name: &str, value: Option<Node>) {
1960 let Some(value) = value else { return };
1961 if value.kind() != "pointer_expression" {
1962 return;
1963 }
1964 if value.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
1965 return; // `*p` dereference, not address-of
1966 }
1967 let arg = value
1968 .child_by_field_name("argument")
1969 .or_else(|| value.named_child(0));
1970 let Some(arg) = arg else { return };
1971 if !matches!(arg.kind(), "identifier" | "template_function" | "qualified_identifier") {
1972 return;
1973 }
1974 if self.stack.is_empty() {
1975 return;
1976 }
1977 let caller_row = self.top_row();
1978 let target = strip_cpp_template_args(self.text(arg));
1979 if target.is_empty() || target == local_name {
1980 return;
1981 }
1982 let targets = self
1983 .local_fn_ptrs
1984 .entry(caller_row)
1985 .or_default()
1986 .entry(local_name.to_string())
1987 .or_default();
1988 if !targets.contains(&target) {
1989 targets.push(target); // Set semantics, insertion-ordered
1990 }
1991 }
1992
1993 /// extractStaticMemberRef — cpp only (c is not in STATIC_MEMBER_LANGS).
1994 /// In this grammar the firing shape is `field_expression` (listed in

Callers 1

Calls 5

strip_cpp_template_argsFunction · 0.85
mapMethod · 0.80
pushMethod · 0.80
textMethod · 0.65
top_rowMethod · 0.45

Tested by

no test coverage detected