| 912 | } |
| 913 | |
| 914 | static 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 |
nothing calls this directly
no test coverage detected