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

Function resolve_file_throws

src/pipeline/pass_parallel.c:3709–3738  ·  view source on GitHub ↗

Resolve throws/raises for one file. */

Source from the content-addressed store, hash-verified

3707
3708/* Resolve throws/raises for one file. */
3709static void resolve_file_throws(resolve_ctx_t *rc, resolve_worker_state_t *ws,
3710 CBMFileResult *result, const char *rel, const char *module_qn,
3711 const char **imp_keys, const char **imp_vals, int imp_count,
3712 CBMLanguage lang) {
3713 for (int t = 0; t < result->throws.count; t++) {
3714 CBMThrow *thr = &result->throws.items[t];
3715 if (!thr->exception_name || !thr->enclosing_func_qn) {
3716 continue;
3717 }
3718 /* find_source_node falls back to the per-file File node when the
3719 * lookup lands on a shared Folder/Project node (#787, #842) — same
3720 * guard resolve_file_calls/usages/rw already use. */
3721 const cbm_gbuf_node_t *src =
3722 find_source_node(rc->main_gbuf, rc->project_name, rel, thr->enclosing_func_qn);
3723 if (!src) {
3724 continue;
3725 }
3726 const char *edge_type = is_checked_exception(thr->exception_name) ? "THROWS" : "RAISES";
3727 cbm_resolution_t res = cbm_registry_resolve_lang(
3728 rc->registry, thr->exception_name, module_qn, imp_keys, imp_vals, imp_count, lang);
3729 if (!res.qualified_name || res.qualified_name[0] == '\0') {
3730 continue;
3731 }
3732 const cbm_gbuf_node_t *tgt = cbm_gbuf_find_by_qn(rc->main_gbuf, res.qualified_name);
3733 if (!tgt || src->id == tgt->id) {
3734 continue;
3735 }
3736 cbm_gbuf_insert_edge(ws->local_edge_buf, src->id, tgt->id, edge_type, "{}");
3737 }
3738}
3739
3740/* Resolve reads/writes for one file. */
3741static void resolve_file_rw(resolve_ctx_t *rc, resolve_worker_state_t *ws, CBMFileResult *result,

Callers 1

resolve_workerFunction · 0.85

Calls 5

find_source_nodeFunction · 0.85
cbm_gbuf_find_by_qnFunction · 0.85
cbm_gbuf_insert_edgeFunction · 0.85
is_checked_exceptionFunction · 0.70

Tested by

no test coverage detected