Dan Korostelev %!s(int64=9) %!d(string=hai) anos
pai
achega
d08c194185
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      src/optimization/dce.ml

+ 9 - 0
src/optimization/dce.ml

@@ -517,6 +517,15 @@ and expr dce e =
 		expr dce e;
 	| TThrow e ->
 		check_and_add_feature dce "has_throw";
+		(*
+			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;
 		expr dce e
 	| _ ->