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:1949–1981  ·  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

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