]> Nishi Git Mirror - gwion.git/commitdiff
:art: Move cast_to in emit_exp
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 20 Sep 2019 22:43:35 +0000 (00:43 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 20 Sep 2019 22:43:35 +0000 (00:43 +0200)
src/emit/emit.c

index 88530019062e8c16d27b4673b33b2e3d5a5e8d06..594535dc96287bf1406e9ba35b1fab2eeaeef6d0 100644 (file)
@@ -1153,12 +1153,12 @@ DECL_EXP_FUNC(emit)
 ANN2(1) static m_bool emit_exp(const Emitter emit, Exp exp, const m_bool ref) {
   do {
     CHECK_BB(exp_func[exp->exp_type](emit, &exp->d))
-    if(exp->cast_to)
-      CHECK_BB(emit_implicit_cast(emit, exp, exp->cast_to))
     if(ref && isa(exp->type, t_object) > 0 && isa(exp->type, t_shred) < 0 ) { // beware fork
       const Instr instr = emit_add_instr(emit, RegAddRef);
       instr->m_val = exp->emit_var;
     }
+    if(exp->cast_to)
+      CHECK_BB(emit_implicit_cast(emit, exp, exp->cast_to))
     if(emit->env->func && isa(exp->type, t_lambda) < 0 && isa(exp->type, t_function) > 0 &&
         !GET_FLAG(exp->type->e->d.func->value_ref->d.func_ref, pure))
       UNSET_FLAG(emit->env->func, pure);