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:1427–1459  ·  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

1425
1426 /// recordCppFnPtrBinding (tree-sitter.ts:5089).
1427 fn record_cpp_fn_ptr_binding(&mut self, local_name: &str, value: Option<Node>) {
1428 let Some(value) = value else { return };
1429 if value.kind() != "pointer_expression" {
1430 return;
1431 }
1432 if value.child(0).map(|c| c.kind() != "&").unwrap_or(true) {
1433 return; // `*p` dereference, not address-of
1434 }
1435 let arg = value
1436 .child_by_field_name("argument")
1437 .or_else(|| value.named_child(0));
1438 let Some(arg) = arg else { return };
1439 if !matches!(arg.kind(), "identifier" | "template_function" | "qualified_identifier") {
1440 return;
1441 }
1442 if self.stack.is_empty() {
1443 return;
1444 }
1445 let caller_row = self.top_row();
1446 let target = strip_cpp_template_args(self.text(arg));
1447 if target.is_empty() || target == local_name {
1448 return;
1449 }
1450 let targets = self
1451 .local_fn_ptrs
1452 .entry(caller_row)
1453 .or_default()
1454 .entry(local_name.to_string())
1455 .or_default();
1456 if !targets.contains(&target) {
1457 targets.push(target); // Set semantics, insertion-ordered
1458 }
1459 }
1460
1461 /// extractStaticMemberRef — cpp only (c is not in STATIC_MEMBER_LANGS).
1462 /// In this grammar the firing shape is `field_expression` (listed in

Callers 1

Calls 3

strip_cpp_template_argsFunction · 0.85
textMethod · 0.65
top_rowMethod · 0.45

Tested by

no test coverage detected