Browse Source

don't double-throw all exceptions

closes #11175
Simon Krajewski 1 year ago
parent
commit
dbc9952adf
2 changed files with 12 additions and 1 deletions
  1. 1 1
      src/filters/exceptions.ml
  2. 11 0
      tests/optimization/src/issues/Issue11175.hx

+ 1 - 1
src/filters/exceptions.ml

@@ -179,7 +179,7 @@ let throw_native ctx e_thrown t p =
 		else
 			e_thrown
 	in
-	mk (TThrow e_native) t p
+	e_native
 
 let set_needs_exception_stack v =
 	if not (Meta.has Meta.NeedsExceptionStack v.v_meta) then

+ 11 - 0
tests/optimization/src/issues/Issue11175.hx

@@ -0,0 +1,11 @@
+package issues;
+
+class Issue11175 {
+	@:js('
+		throw haxe_Exception.thrown("foo");
+	')
+	@:analyzer(ignore)
+	static function test() {
+		throw "foo";
+	}
+}