Record a freshly appended binding in the frame's index, building the index * the first time the frame outgrows one chunk. */
| 116 | /* Record a freshly appended binding in the frame's index, building the index |
| 117 | * the first time the frame outgrows one chunk. */ |
| 118 | static 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). */ |
no test coverage detected