From a2e18eb02c997e0b9fce305cfe992c9e359d44ad Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 10 Sep 2019 22:47:04 +0200 Subject: [PATCH] :bug: Tuple fix --- src/lib/tuple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/tuple.c b/src/lib/tuple.c index 54f5417a..12505a68 100644 --- a/src/lib/tuple.c +++ b/src/lib/tuple.c @@ -70,7 +70,7 @@ static FREEARG(freearg_tuple_at) { ANN static void emit_unpack_instr_inner(const Emitter emit, struct TupleEmit *te) { const Instr instr = emit_add_instr(emit, TupleUnpack); struct UnpackInfo_ *info = mp_malloc(emit->gwion->mp, UnpackInfo); - info->obj_offset = te->tmp_offset; + info->obj_offset = te->obj_offset; info->mem_offset = te->mem_offset; info->size = te->sz; instr->m_val = (m_uint)info; @@ -87,19 +87,19 @@ ANN static int tuple_continue(struct TupleEmit *te) { ANN static void unpack_instr_decl(const Emitter emit, struct TupleEmit *te) { m_uint sz = 0; te->sz = 0; + te->obj_offset = te->tmp_offset; do { if(te->e->exp_type == ae_exp_decl) { const Value value = te->e->d.exp_decl.list->self->value; te->sz += value->type->size; + sz += value->type->size; value->offset = emit_local(emit, value->type->size, 0); - te->tmp_offset = te->obj_offset; - te->obj_offset += ((Type)vector_at(te->v, te->idx))->size; } else { - sz = ((Type)vector_at(te->v, te->idx))->size; + sz += ((Type)vector_at(te->v, te->idx))->size; break; } } while(tuple_continue(te)); - te->obj_offset += sz; + te->tmp_offset += sz; } ANN void emit_unpack_instr(const Emitter emit, struct TupleEmit *te) { -- 2.43.0