From 0bfd6d50d77465b3b0b660fe434be9ace42963cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 21 May 2020 23:22:46 +0200 Subject: [PATCH] :art: emit_decl --- src/emit/emit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index 0b2409e1..d4da531a 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -659,14 +659,14 @@ ANN static m_bool emit_exp_decl_global(const Emitter emit, const Exp_Decl *decl, const m_bool is_array = array && array->exp; const m_bool is_obj = isa(type, emit->gwion->type[et_object]) > 0; const uint emit_addr = (!is_obj || (is_ref && !is_array)) ? emit_var : 1; - if(is_obj && (is_array || !is_ref && !GET_FLAG(v, ref))) + if(is_obj && (is_array || !is_ref) && !GET_FLAG(v, ref)) CHECK_BB(emit_instantiate_object(emit, type, array, is_ref)) const Instr instr = emit_kind(emit, v->type->size, !struct_ctor(v) ? emit_addr : 1, dotstatic); v->d.ptr = mp_calloc2(emit->gwion->mp, v->type->size); SET_FLAG(v, union); instr->m_val = (m_uint)v->d.ptr; instr->m_val2 = v->type->size; - if(is_obj && (is_array || !is_ref && !GET_FLAG(v, ref))) { + if(is_obj && (is_array || !is_ref) && !GET_FLAG(v, ref)) { const Instr assign = emit_add_instr(emit, Assign); const size_t missing_depth = type->array_depth - (array ? array->depth : 0); if(missing_depth && !GET_FLAG(decl->td, force)) { -- 2.43.0