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

Function scope_index_note

internal/cbm/lsp/scope.c:118–131  ·  view source on GitHub ↗

Record a freshly appended binding in the frame's index, building the index * the first time the frame outgrows one chunk. */

Source from the content-addressed store, hash-verified

116/* Record a freshly appended binding in the frame's index, building the index
117 * the first time the frame outgrows one chunk. */
118static void scope_index_note(CBMScope *scope, CBMVarBinding *b) {
119 if (scope->index.cap == 0) {
120 if (scope->binding_count > CBM_SCOPE_CHUNK_BINDINGS) {
121 scope_index_rebuild(scope, SCOPE_INDEX_MIN_CAP);
122 }
123 return;
124 }
125 if (scope->index.count >= scope->index.cap / 2) {
126 scope_index_rebuild(scope, scope->index.cap); /* includes b; sizes from binding_count */
127 return;
128 }
129 scope_index_place(scope->index.slots, scope->index.cap, b);
130 scope->index.count++;
131}
132
133/* The binding of name in one frame: hashed when the frame has an index,
134 * otherwise the linear chunk scan (small frames, or no index memory). */

Callers 1

cbm_scope_bind_valueFunction · 0.85

Calls 2

scope_index_rebuildFunction · 0.85
scope_index_placeFunction · 0.85

Tested by

no test coverage detected