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

Function resolve_file_semantic

src/pipeline/pass_parallel.c:3928–3966  ·  view source on GitHub ↗

Resolve INHERITS + DECORATES + IMPLEMENTS for one file. */

Source from the content-addressed store, hash-verified

3926
3927/* Resolve INHERITS + DECORATES + IMPLEMENTS for one file. */
3928static void resolve_file_semantic(resolve_ctx_t *rc, resolve_worker_state_t *ws,
3929 CBMFileResult *result, const char *rel, CBMLanguage lang,
3930 const char *module_qn, const char **imp_keys,
3931 const char **imp_vals, int imp_count,
3932 const cbm_php_vendor_names_t *php_vendor) {
3933 const pp_file_scope_t fs = {&result->imports, rel, lang};
3934 for (int d = 0; d < result->defs.count; d++) {
3935 CBMDefinition *def = &result->defs.items[d];
3936 if (!def->qualified_name) {
3937 continue;
3938 }
3939 const cbm_gbuf_node_t *node = cbm_gbuf_find_by_qn(rc->main_gbuf, def->qualified_name);
3940 if (!node) {
3941 continue;
3942 }
3943 resolve_def_inherits(rc, ws, def, node, &fs, module_qn, imp_keys, imp_vals, imp_count,
3944 php_vendor);
3945 resolve_def_decorators(rc, ws, def, node, module_qn, imp_keys, imp_vals, imp_count, lang);
3946 }
3947 for (int t = 0; t < result->impl_traits.count; t++) {
3948 CBMImplTrait *it = &result->impl_traits.items[t];
3949 if (!it->trait_name || !it->struct_name) {
3950 continue;
3951 }
3952 const char *tqn = resolve_as_class(rc->registry, it->trait_name, module_qn, imp_keys,
3953 imp_vals, imp_count, lang);
3954 const char *sqn = resolve_as_class(rc->registry, it->struct_name, module_qn, imp_keys,
3955 imp_vals, imp_count, lang);
3956 if (!tqn || !sqn) {
3957 continue;
3958 }
3959 const cbm_gbuf_node_t *tn = cbm_gbuf_find_by_qn(rc->main_gbuf, tqn);
3960 const cbm_gbuf_node_t *sn = cbm_gbuf_find_by_qn(rc->main_gbuf, sqn);
3961 if (tn && sn && tn->id != sn->id) {
3962 cbm_gbuf_insert_edge(ws->local_edge_buf, sn->id, tn->id, "IMPLEMENTS", "{}");
3963 ws->semantic_resolved++;
3964 }
3965 }
3966}
3967
3968/* F4: get (or lazily build ONCE) the shared all_defs Rust registry. Called by the
3969 * first worker that hits a NULL-filter rust file; later null-files reuse it. Fast

Callers 1

resolve_workerFunction · 0.85

Calls 5

cbm_gbuf_find_by_qnFunction · 0.85
resolve_def_inheritsFunction · 0.85
resolve_def_decoratorsFunction · 0.85
cbm_gbuf_insert_edgeFunction · 0.85
resolve_as_classFunction · 0.70

Tested by

no test coverage detected