From 6ad27157966e10827119334a52309d127411de7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 20 May 2020 17:53:49 +0200 Subject: [PATCH] :art: pop_exp takes decl into account --- src/emit/emit.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index a13f3c7a..74016467 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -322,10 +322,9 @@ ANN static m_bool emit_symbol_builtin(const Emitter emit, const Symbol *data) { const m_uint size = v->type->size; const Instr instr = emit_kind(emit, size, exp_getvar(prim_exp(data)), regpushimm); if(!exp_getvar(prim_exp(data)) && size == SZ_INT) { - if(isa(v->type, emit->gwion->type[et_object]) > 0) { - instr->opcode = eRegPushImm; + if(isa(v->type, emit->gwion->type[et_object]) > 0) instr->m_val = (m_uint)v->d.ptr; - } else if(v->d.ptr) + else if(v->d.ptr) instr->m_val = *(m_uint*)v->d.ptr; } else { assert(v->d.ptr); // instr->m_val = v->d.ptr; @@ -817,6 +816,13 @@ ANN static inline void pop_exp(const Emitter emit, Exp e) { ANN static inline m_bool emit_exp_pop_next(const Emitter emit, Exp e) { CHECK_BB(emit_exp(emit, e)) + if(e->exp_type == ae_exp_decl) { + Var_Decl_List list = e->d.exp_decl.list->next; + while(list) { + regpop(emit, !exp_getvar(e) ? list->self->value->type->size : SZ_INT); + list = list->next; + } + } if(e->next) pop_exp(emit, e->next); return GW_OK; -- 2.43.0