MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / calls_edge_targets

Function calls_edge_targets

tests/test_lang_contract.c:1364–1386  ·  view source on GitHub ↗

True if some CALLS edge's TARGET node carries `label` and a QN ending with * `qn_suffix` — i.e. the call resolved to that specific definition. */

Source from the content-addressed store, hash-verified

1362/* True if some CALLS edge's TARGET node carries `label` and a QN ending with
1363 * `qn_suffix` — i.e. the call resolved to that specific definition. */
1364static int calls_edge_targets(cbm_store_t *store, const char *project, const char *label,
1365 const char *qn_suffix) {
1366 cbm_edge_t *edges = NULL;
1367 int n = 0;
1368 if (cbm_store_find_edges_by_type(store, project, "CALLS", &edges, &n) != CBM_STORE_OK)
1369 return 0;
1370 int found = 0;
1371 size_t sl = strlen(qn_suffix);
1372 for (int i = 0; i < n && !found; i++) {
1373 cbm_node_t tgt;
1374 if (cbm_store_find_node_by_id(store, edges[i].target_id, &tgt) != CBM_STORE_OK)
1375 continue;
1376 const char *qn = tgt.qualified_name;
1377 if (qn && tgt.label && strcmp(tgt.label, label) == 0) {
1378 size_t ql = strlen(qn);
1379 if (ql >= sl && strcmp(qn + ql - sl, qn_suffix) == 0)
1380 found = 1;
1381 }
1382 cbm_node_free_fields(&tgt);
1383 }
1384 cbm_store_free_edges(edges, n);
1385 return found;
1386}
1387
1388/* #988: `from m import f as g; g()` produced NO CALLS edge — the Python LSP
1389 * bound the alias as MODULE("m.f") (the from-style heuristic keys on the

Callers 1

Calls 4

cbm_node_free_fieldsFunction · 0.85
cbm_store_free_edgesFunction · 0.85

Tested by

no test coverage detected