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

Function class_node

src/pipeline/doc_links_cs.c:2934–2951  ·  view source on GitHub ↗

The node of the nearest of `e`'s own declarations of one class -- an * implementation's, or (`stub`) a reference assembly's stub's -- that has * one; never a test declaration's for product code. NULL when none has. */

Source from the content-addressed store, hash-verified

2932 * implementation's, or (`stub`) a reference assembly's stub's -- that has
2933 * one; never a test declaration's for product code. NULL when none has. */
2934static const cbm_gbuf_node_t *class_node(const cs_ctx_t *c, const cs_entity_t *e, bool stub) {
2935 const cs_index_t *ix = c->ix;
2936 const cs_bind_t *best = NULL;
2937 for (int test = 0; test <= (c->prod ? 0 : SKIP_ONE); test++) {
2938 int b = 0;
2939 int a =
2940 class_range(e->binds, e->ndecls,
2941 (unsigned char)((stub ? CS_CLS_REF : 0) | (test ? CS_CLS_TEST : 0)), &b);
2942 if (a >= b) {
2943 continue;
2944 }
2945 const cs_bind_t *at = &e->binds[nearest_bind(ix, e->binds, a, b, c->file)];
2946 if (!best || file_nearer(ix, at->file, best->file, c->file)) {
2947 best = at;
2948 }
2949 }
2950 return best ? ix->files[best->file].types[best->type].node : NULL;
2951}
2952
2953/* True when one of `e`'s own declarations is in view, with a node or
2954 * without: for product code one that is not test code. */

Callers 2

impl_nodeFunction · 0.85
type_resultFunction · 0.85

Calls 3

class_rangeFunction · 0.85
nearest_bindFunction · 0.85
file_nearerFunction · 0.85

Tested by

no test coverage detected