Przeglądaj źródła

use cast instead of temp var when inlining Dynamic

Simon Krajewski 9 lat temu
rodzic
commit
781442433e
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      optimizer.ml

+ 1 - 1
optimizer.ml

@@ -351,7 +351,7 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
 				if we cast from Dynamic, create a local var as well to do the cast
 				once and allow DCE to perform properly.
 			*)
-			if v.v_type != t_dynamic && follow e.etype == t_dynamic then (local v).i_write <- true;
+			let e = if v.v_type != t_dynamic && follow e.etype == t_dynamic then mk (TCast(e,None)) v.v_type e.epos else e in
 			(match e.eexpr, opt with
 			| TConst TNull , Some c -> mk (TConst c) v.v_type e.epos
 			(*