Browse Source

move add_feature to DCE (closes #2129)

Simon Krajewski 12 years ago
parent
commit
bf2556d6d9
2 changed files with 2 additions and 2 deletions
  1. 2 0
      dce.ml
  2. 0 2
      typer.ml

+ 2 - 0
dce.ml

@@ -298,6 +298,7 @@ and expr dce e =
 			mark_t dce v.v_type;
 		) vl;
 	| TCast(e, Some mt) ->
+		add_feature dce.com "typed_cast";
 		mark_mt dce mt;
 		expr dce e;
 	| TTypeExpr mt ->
@@ -305,6 +306,7 @@ and expr dce e =
 	| TTry(e, vl) ->
 		expr dce e;
 		List.iter (fun (v,e) ->
+			if v.v_type != t_dynamic then add_feature dce.com "typed_catch";
 			expr dce e;
 			mark_t dce v.v_type;
 		) vl;

+ 0 - 2
typer.ml

@@ -2649,7 +2649,6 @@ and type_expr ctx (e,p) (with_type:with_type) =
 					List.iter (fun pt ->
 						if pt != t_dynamic then error "Catch class parameter must be Dynamic" p;
 					) params;
-					add_feature ctx.com "typed_catch";
 					(match path with
 					| x :: _ , _ -> x
 					| [] , name -> name)
@@ -2845,7 +2844,6 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		let e = type_expr ctx e Value in
 		mk (TCast (e,None)) (mk_mono()) p
 	| ECast (e, Some t) ->
-		add_feature ctx.com "typed_cast";
 		let t = Typeload.load_complex_type ctx (pos e) t in
 		let texpr = (match follow t with
 		| TInst (_,params) | TEnum (_,params) ->