From 1d7a228c75b86afe30635715e479b4719df7938b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 11 May 2020 01:48:00 +0200 Subject: [PATCH] :art: Improve gack --- src/emit/emit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index 1b2ef156..c3083fa7 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -498,10 +498,12 @@ ANN static inline void struct_interp(const Emitter emit, const Exp e) { } } -ANN static void interp_multi(const Emitter emit, Var_Decl_List list) { +ANN static void interp_multi(const Emitter emit, const Exp e) { + Var_Decl_List list = e->d.exp_decl.list; + const int emit_var = exp_getvar(e); m_uint offset = 0; while(list->next) { - offset += list->self->value->type->size; + offset += !emit_var ? list->self->value->type->size : SZ_INT; list = list->next; } if(offset) @@ -520,7 +522,7 @@ ANN static m_bool emit_interp(const Emitter emit, const Exp exp) { return GW_ERROR; } if(e->exp_type == ae_exp_decl) // why only objects? - interp_multi(emit, e->d.exp_decl.list); + interp_multi(emit, e); regseti(emit, (m_uint)e->info->type); const m_bool isobj = isa(e->info->type, emit->gwion->type[et_object]) > 0; if(isobj && !GET_FLAG(e->info->type, force)) -- 2.43.0