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:1957–1989  ·  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

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