Browse Source

[dce] recursively keep all toString if something is thrown (saves nadako)

Simon Krajewski 8 years ago
parent
commit
92172f4565
1 changed files with 5 additions and 10 deletions
  1. 5 10
      src/optimization/dce.ml

+ 5 - 10
src/optimization/dce.ml

@@ -585,16 +585,11 @@ and expr dce e =
 	| TThrow e ->
 		check_and_add_feature dce "has_throw";
 		expr dce e;
-		(*
-			TODO: Simon, save me! \o
-			This is a hack needed to keep toString field of the actual exception objects
-			that are thrown, but are wrapped into HaxeError before DCE comes into play.
-		*)
-		let e = (match e.eexpr with
-			| TNew({cl_path=(["js";"_Boot"],"HaxeError")}, _, [eoriginal]) -> eoriginal
-			| _ -> e
-		) in
-		to_string dce e.etype
+		let rec loop e =
+			to_string dce e.etype;
+			Type.iter loop e
+		in
+		loop e
 	| _ ->
 		Type.iter (expr dce) e