浏览代码

use cast instead of temp var when inlining Dynamic

Simon Krajewski 9 年之前
父节点
当前提交
781442433e
共有 1 个文件被更改,包括 1 次插入1 次删除
  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
 			(*