Follow segs[from, n) from where `cur` stands: each is a member of what the * one before named -- a namespace or type of a namespace, a type nested in a * type. There is no second try from anywhere else. */
| 5064 | * one before named -- a namespace or type of a namespace, a type nested in a |
| 5065 | * type. There is no second try from anywhere else. */ |
| 5066 | static cs_tp_t path_from(const cs_ctx_t *c, cs_tp_t cur, const cs_seg_t *segs, int from, int n) { |
| 5067 | for (int i = from; i < n; i++) { |
| 5068 | cs_found_t fd = {0}; |
| 5069 | if (cur.st == CS_TP_NS) { |
| 5070 | int child = segs[i].arity > 0 |
| 5071 | ? CS_NONE |
| 5072 | : ns_in_view(c, cur.ns, segs[i].name, strlen(segs[i].name)); |
| 5073 | add_types(c, true, cur.ns, segs[i].name, type_arity(segs[i].arity), &fd); |
| 5074 | if (child >= 0 && fd.n == 0 && !fd.invisible) { |
| 5075 | cur.ns = child; |
| 5076 | continue; |
| 5077 | } |
| 5078 | fd.n += child >= 0; |
| 5079 | } else { |
| 5080 | add_types(c, false, cur.ent, segs[i].name, type_arity(segs[i].arity), &fd); |
| 5081 | } |
| 5082 | if (fd.n > SKIP_ONE) { |
| 5083 | return tp_res(found_ambiguous(&fd)); |
| 5084 | } |
| 5085 | if (fd.n == 0) { |
| 5086 | if (fd.invisible) { |
| 5087 | return tp_res(res_unres(CBM_DOCLINK_REASON_TEST_ONLY)); |
| 5088 | } |
| 5089 | cur.st = cur.st == CS_TP_NS ? CS_TP_NSFAIL : CS_TP_PARTIAL; |
| 5090 | cur.next = &segs[i]; |
| 5091 | return cur; |
| 5092 | } |
| 5093 | cur.st = CS_TP_TYPE; |
| 5094 | cur.ent = fd.first.id; |
| 5095 | if (fd.joined) { |
| 5096 | cur.joined = true; |
| 5097 | cur.exact = false; |
| 5098 | cur.in_ns = false; |
| 5099 | } |
| 5100 | } |
| 5101 | return cur; |
| 5102 | } |
| 5103 | |
| 5104 | /* An open scope: a using in view names a namespace or type the repository |
| 5105 | * does not declare, or the project's global usings could not be evaluated. |
no test coverage detected