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:1411–1443  ·  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

1409
1410 /// recordCppFnPtrBinding (tree-sitter.ts:5089).
1411 fn record_cpp_fn_ptr_binding(&mut self, local_name: &str, value: Option<Node>) {
1412 let Some(value) = value else { return };
1413 if value.kind() != "pointer_expression" {
1414 return;
1415 }
1416 if value.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
1417 return; // `*p` dereference, not address-of
1418 }
1419 let arg = value
1420 .child_by_field_name("argument")
1421 .or_else(|| value.named_child(0));
1422 let Some(arg) = arg else { return };
1423 if !matches!(arg.kind(), "identifier" | "template_function" | "qualified_identifier") {
1424 return;
1425 }
1426 if self.stack.is_empty() {
1427 return;
1428 }
1429 let caller_row = self.top_row();
1430 let target = strip_cpp_template_args(self.text(arg));
1431 if target.is_empty() || target == local_name {
1432 return;
1433 }
1434 let targets = self
1435 .local_fn_ptrs
1436 .entry(caller_row)
1437 .or_default()
1438 .entry(local_name.to_string())
1439 .or_default();
1440 if !targets.contains(&target) {
1441 targets.push(target); // Set semantics, insertion-ordered
1442 }
1443 }
1444
1445 /// extractStaticMemberRef — cpp only (c is not in STATIC_MEMBER_LANGS).
1446 /// In this grammar the firing shape is `field_expression` (listed in

Callers 1

Calls 3

strip_cpp_template_argsFunction · 0.85
top_rowMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected