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

Function receiver_ident

internal/cbm/cbm.c:1093–1118  ·  view source on GitHub ↗

Extract the receiver identifier from a def's receiver text — Go's "(s *Store)" / "(s Store)" → "s". Stores the identifier start in *out and returns its length; returns 0 for unnamed receivers ("(*Store)", "(Store)"), where no second token follows the identifier (a lone token is the TYPE, not a name — such methods have no receiver variable to call through anyway).

Source from the content-addressed store, hash-verified

1091// where no second token follows the identifier (a lone token is the TYPE, not
1092// a name — such methods have no receiver variable to call through anyway).
1093static size_t receiver_ident(const char *recv_text, const char **out) {
1094 const char *p = recv_text;
1095 if (*p == '(') {
1096 p++;
1097 }
1098 while (*p == ' ' || *p == '\t') {
1099 p++;
1100 }
1101 const char *start = p;
1102 while ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') ||
1103 *p == '_') {
1104 p++;
1105 }
1106 size_t len = (size_t)(p - start);
1107 if (len == 0) {
1108 return 0; // "(*Store)": leading '*', no identifier
1109 }
1110 while (*p == ' ' || *p == '\t') {
1111 p++;
1112 }
1113 if (*p == ')' || *p == '\0') {
1114 return 0; // "(Store)": single token is the type, receiver unnamed
1115 }
1116 *out = start;
1117 return len;
1118}
1119
1120// Whether a callee expression targets the same instance/class as the enclosing
1121// def, i.e. counts as genuine self-recursion rather than a same-named call on a

Callers 1

is_self_receiverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected