From: fennecdjay Date: Thu, 3 Nov 2022 18:49:19 +0000 (+0100) Subject: :art: Fix gack behavior (mainly foreach loops) X-Git-Tag: nightly~207^2~91 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0f3d5dc11dc65da5e76b3a53aea5e502bb60c8e6;p=gwion.git :art: Fix gack behavior (mainly foreach loops) --- diff --git a/src/emit/emit.c b/src/emit/emit.c index baf3c8e3..92ed22ea 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -796,11 +796,12 @@ ANN static inline void interp_size(const Emitter emit, const Exp e) { } ANN static void emit_gack_type(const Emitter emit, const Exp e) { - if (e->exp_type != ae_exp_cast || + if (e->exp_type == ae_exp_cast || (e->exp_type == ae_exp_primary && e->d.prim.prim_type == ae_prim_str)) return; const m_bool isobj = isa(e->type, emit->gwion->type[et_object]) > 0; - if (isobj && !GET_FLAG(e->type, final)) emit_add_instr(emit, GackType); + if (isobj && (tflag(e->type, tflag_ref) || !GET_FLAG(e->type, final))) + emit_add_instr(emit, GackType); } ANN /*static*/ m_bool emit_interp(const Emitter emit, const Exp exp) {