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

Function pr_resolve

src/pipeline/doc_links_php.c:914–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912}
913
914static void pr_resolve(const void *index, void *state, int run_file, const CBMDocLink *link,
915 const cbm_gbuf_t *graph, cbm_doclink_outcome_t *out) {
916 (void)state; /* PHP keeps no per-file working state */
917 const pr_index_t *ix = (const pr_index_t *)index;
918 out->kind = CBM_DOCLINK_UNRESOLVED;
919 out->reason = CBM_DOCLINK_REASON_MISSING;
920 out->target = NULL;
921 out->exact = false;
922 if (!ix || !link->raw || run_file < 0 || run_file >= ix->run_count ||
923 ix->run_to_file[run_file] < 0) {
924 return;
925 }
926 pr_ctx_t c = {.ix = ix, .g = graph, .src = ix->run_to_file[run_file]};
927 const pr_file_t *f = &ix->files[c.src];
928 size_t rl = strlen(link->raw);
929 pr_ref_t r;
930 if (rl > CBM_DOCLINK_PHP_REF_MAX || !pr_parse(link->raw, rl, &r)) {
931 out->reason = CBM_DOCLINK_REASON_UNPARSEABLE;
932 return;
933 }
934 pr_block_at(&c, f, link->line);
935 c.cur = pr_type_at(ix, f, link->def_line);
936 pr_res_t res;
937 if (!r.mem && r.call) {
938 res = pr_function(&c, &r);
939 } else if (!r.mem) {
940 res = pr_type_of(&c, &r);
941 if (res.kind == PR_TYPE) {
942 bool exact = res.exact;
943 res = pr_type_node(&c, res.type);
944 res.exact = exact;
945 }
946 } else {
947 res = pr_type_of(&c, &r);
948 if (res.kind == PR_TYPE) {
949 bool exact = res.exact;
950 res = pr_member(&c, res.type, &r);
951 res.exact = exact;
952 }
953 }
954 pr_out(&c, res, out);
955}
956
957/* A top-level function (F fqn flags) or a member of the type above it (K kind
958 * name) declares one name; reported as a reference spells it, the last

Callers

nothing calls this directly

Calls 8

pr_parseFunction · 0.85
pr_block_atFunction · 0.85
pr_type_atFunction · 0.85
pr_functionFunction · 0.85
pr_type_ofFunction · 0.85
pr_type_nodeFunction · 0.85
pr_memberFunction · 0.85
pr_outFunction · 0.85

Tested by

no test coverage detected