| 3014 | } |
| 3015 | |
| 3016 | static jr_res_t jr_java_resolve(const jr_ctx_t *c, const jr_ref_t *r, bool values_only) { |
| 3017 | if (r->nsegs == 0) { |
| 3018 | return jr_java_member(c, r->member, r, JR_NONE, r->has_params, false, values_only); |
| 3019 | } |
| 3020 | jr_tp_t tp = jr_java_type_path(c, r->segs, r->nsegs); |
| 3021 | if (r->member) { |
| 3022 | if (tp.st == JR_TP_OK) { |
| 3023 | return jr_java_member(c, r->member, r, tp.ent, r->has_params, tp.exact, values_only); |
| 3024 | } |
| 3025 | /* a member type the named type does not have: javadoc finds no type */ |
| 3026 | return tp.st == JR_TP_PARTIAL ? jr_unres(CBM_DOCLINK_REASON_MISSING) : tp.res; |
| 3027 | } |
| 3028 | if (tp.st == JR_TP_OK) { |
| 3029 | return values_only ? jr_unres(CBM_DOCLINK_REASON_MISSING) |
| 3030 | : jr_type_result(c, tp.ent, tp.exact); |
| 3031 | } |
| 3032 | if (tp.st == JR_TP_PARTIAL) { |
| 3033 | return jr_unres(CBM_DOCLINK_REASON_MISSING); /* `Type.member`: Javadoc wants a '#' */ |
| 3034 | } |
| 3035 | if (r->nsegs == SKIP_ONE && tp.res.st == JR_UNRES && |
| 3036 | tp.res.reason == CBM_DOCLINK_REASON_MISSING) { |
| 3037 | /* javadoc's own fixup: a bare identifier that is no type is read as |
| 3038 | * `#identifier`, a member in the enclosing types. Only where the scope |
| 3039 | * is closed: an open one may hold a type of that name, which comes |
| 3040 | * first. */ |
| 3041 | jr_res_t m = jr_java_member(c, r->segs[0], r, JR_NONE, false, false, values_only); |
| 3042 | if (!(m.st == JR_UNRES && m.reason == CBM_DOCLINK_REASON_MISSING)) { |
| 3043 | return m; |
| 3044 | } |
| 3045 | } |
| 3046 | return tp.res; |
| 3047 | } |
| 3048 | |
| 3049 | /* ── Kotlin ──────────────────────────────────────────────────────── */ |
| 3050 |
no test coverage detected