瀏覽代碼

we actually only need the upcast detection for Cpp and As3

Simon Krajewski 12 年之前
父節點
當前提交
b0401bdb36
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      optimizer.ml

+ 1 - 2
optimizer.ml

@@ -380,14 +380,13 @@ let rec type_inline ctx cf f ethis params tret config p force =
 				| _ -> try
 					type_eq EqStrict etype tret;
 					e
-				with Unify_error _ ->
+				with Unify_error _ when (match ctx.com.platform with Cpp -> true | Flash when Common.defined ctx.com Define.As3 -> true | _ -> false) ->
 					(* try to detect upcasts: in that case we may use a safe cast *)
 					Type.unify tret etype;
 					let ct = match follow tret with
 						| TInst(c,_) -> Some (TClassDecl c)
 						| _ -> None
 					in
-					add_feature ctx.com "typed_cast";
 					mk (TCast (e,ct)) tret e.epos)
 			with Unify_error _ ->
 				mk (TCast (e,None)) tret e.epos)