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

Function pr_search

src/pipeline/doc_links_php.c:733–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731}
732
733static bool pr_search(pr_search_t *s, int ti, int depth) {
734 if (depth > PR_MAX_DEPTH) {
735 s->open = true;
736 return false;
737 }
738 if (pr_seen(s, ti)) {
739 return false;
740 }
741 const pr_type_t *t = &s->c->ix->types[ti];
742 for (int i = 0; i < t->nmembers; i++) {
743 if (pr_member_is(s, &t->members[i])) {
744 s->owner = ti;
745 s->found = &t->members[i];
746 return true;
747 }
748 }
749 static const char order[] = {'t', 'e', 'i'}; /* traits, superclass, interfaces */
750 for (size_t o = 0; o < sizeof(order); o++) {
751 for (int i = 0; i < t->nbases; i++) {
752 if (t->bases[i].rel != order[o] || !t->bases[i].fqn) {
753 continue;
754 }
755 pr_res_t r = pr_find_type(s->c, t->bases[i].fqn, strlen(t->bases[i].fqn));
756 if (r.kind == PR_TYPE && pr_search(s, r.type, depth + SKIP_ONE)) {
757 return true;
758 }
759 s->amb = s->amb || r.kind == PR_AMBIGUOUS;
760 s->open = s->open || r.kind == PR_NONE;
761 }
762 }
763 return false;
764}
765
766/* The member's outcome: a method's node, else a graph gap. */
767static pr_res_t pr_member_node(const pr_ctx_t *c, const pr_search_t *s) {

Callers 2

pr_memberFunction · 0.85
pr_functionFunction · 0.85

Calls 3

pr_seenFunction · 0.85
pr_member_isFunction · 0.85
pr_find_typeFunction · 0.85

Tested by

no test coverage detected