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

Function resolve_using

src/pipeline/doc_links_cs.c:5762–5783  ·  view source on GitHub ↗

What a using directive names: a namespace into u->ns, a type into u->ent * (CS_AMBIGUOUS for several). Both stay CS_NONE for what the repository does * not have. `c` is the scope the directive is resolved in. */

Source from the content-addressed store, hash-verified

5760 * (CS_AMBIGUOUS for several). Both stay CS_NONE for what the repository does
5761 * not have. `c` is the scope the directive is resolved in. */
5762static void resolve_using(cs_using_t *u, const cs_ctx_t *c) {
5763 cs_seg_t segs[CS_MAX_SEGS];
5764 int n = 0;
5765 cs_ctx_t at = *c;
5766 bool glob = false;
5767 u->ns = CS_NONE;
5768 u->ent = CS_NONE;
5769 if (!parse_name(u->target, strlen(u->target), segs, &n, &glob)) {
5770 return;
5771 }
5772 at.glob = at.glob || glob;
5773 cs_tp_t tp = resolve_path(&at, segs, n, false);
5774 if (tp.st == CS_TP_NS && u->kind != 's') {
5775 u->ns = tp.ns;
5776 } else if (tp.st == CS_TP_TYPE && u->kind != 'n') {
5777 u->ent = tp.ent;
5778 u->joined = tp.joined;
5779 } else if (tp.st == CS_TP_RES && res_is(&tp.res, CBM_DOCLINK_REASON_AMBIGUOUS) &&
5780 u->kind != 'n') {
5781 u->ent = CS_AMBIGUOUS;
5782 }
5783}
5784
5785/* True when the directive brings in names the repository does not declare:
5786 * a namespace it has no declaration of (or a standard-library one, which it

Callers 1

resolve_usingsFunction · 0.85

Calls 3

parse_nameFunction · 0.85
res_isFunction · 0.85
resolve_pathFunction · 0.70

Tested by

no test coverage detected