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

Function generic_method_at

src/pipeline/doc_links_cs.c:5677–5697  ·  view source on GitHub ↗

The generic method declared at `line`, or CS_NONE: its type parameters are * in scope in its documentation. Of the members that start at one line the * generic methods stand first (finish_lookups), so the first one tells -- * however many members a line holds. */

Source from the content-addressed store, hash-verified

5675 * generic methods stand first (finish_lookups), so the first one tells --
5676 * however many members a line holds. */
5677static int generic_method_at(const cs_file_t *f, uint32_t line) {
5678 int lo = 0;
5679 int hi = f->nmembers;
5680 while (lo < hi) {
5681 int mid = lo + ((hi - lo) / PAIR_LEN);
5682 if (f->members[f->members_by_start[mid]].start < line) {
5683 lo = mid + SKIP_ONE;
5684 } else {
5685 hi = mid;
5686 }
5687 }
5688 if (lo < f->nmembers) {
5689 cs_work(SKIP_ONE);
5690 int mi = f->members_by_start[lo];
5691 const cs_member_t *m = &f->members[mi];
5692 if (m->start == line && m->kind == 'c' && m->arity > 0) {
5693 return mi;
5694 }
5695 }
5696 return CS_NONE;
5697}
5698
5699/* A scope of file `file`: the namespace declaration `region`, the type
5700 * `type` and the ones around it. */

Callers 1

ctx_initFunction · 0.85

Calls 1

cs_workFunction · 0.85

Tested by

no test coverage detected