| 65 | } |
| 66 | |
| 67 | static void _PopulateReduceCtx |
| 68 | ( |
| 69 | ListReduceCtx *ctx, |
| 70 | Record outer_record |
| 71 | ) { |
| 72 | rax *record_map = raxClone(outer_record->mapping); |
| 73 | |
| 74 | //-------------------------------------------------------------------------- |
| 75 | // map variable name |
| 76 | //-------------------------------------------------------------------------- |
| 77 | |
| 78 | intptr_t id = raxSize(record_map); |
| 79 | raxTryInsert(record_map, (unsigned char *)ctx->variable, |
| 80 | strlen(ctx->variable), (void *)id, NULL); |
| 81 | |
| 82 | //-------------------------------------------------------------------------- |
| 83 | // map accumulator name |
| 84 | //-------------------------------------------------------------------------- |
| 85 | |
| 86 | id++; |
| 87 | raxTryInsert(record_map, (unsigned char *)ctx->accumulator, |
| 88 | strlen(ctx->accumulator), (void *)id, NULL); |
| 89 | |
| 90 | ctx->record = Record_New(record_map); |
| 91 | |
| 92 | // this could just be assigned to 'id' |
| 93 | // but for safety we'll use a Record lookup |
| 94 | ctx->variable_idx = Record_GetEntryIdx(ctx->record, ctx->variable); |
| 95 | ctx->accumulator_idx = Record_GetEntryIdx(ctx->record, ctx->accumulator); |
| 96 | ASSERT(ctx->variable_idx != INVALID_INDEX); |
| 97 | ASSERT(ctx->accumulator_idx != INVALID_INDEX); |
| 98 | } |
| 99 | |
| 100 | // forward declaration of property function |
| 101 | SIValue AR_PROPERTY(SIValue *argv, int argc, void *private_data); |
no test coverage detected