Ver código fonte

Don't avoid exception wrapping on HL/neko/eval (#12049)

* don't avoid exception wrapping on Eval/Neko/HL

closes #12047

* fine
Simon Krajewski 7 meses atrás
pai
commit
651a81db56

+ 9 - 0
src/context/common.ml

@@ -650,6 +650,9 @@ let get_config com =
 			pf_supports_unicode = false;
 			pf_supports_unicode = false;
 			pf_scoping = { default_config.pf_scoping with
 			pf_scoping = { default_config.pf_scoping with
 				vs_flags = [ReserveAllTopLevelSymbols];
 				vs_flags = [ReserveAllTopLevelSymbols];
+			};
+			pf_exceptions = { default_config.pf_exceptions with
+				ec_avoid_wrapping = false
 			}
 			}
 		}
 		}
 	| Flash ->
 	| Flash ->
@@ -770,6 +773,9 @@ let get_config com =
 				vs_scope = BlockScope;
 				vs_scope = BlockScope;
 				vs_flags = [NoShadowing]
 				vs_flags = [NoShadowing]
 			};
 			};
+			pf_exceptions = { default_config.pf_exceptions with
+				ec_avoid_wrapping = false
+			}
 		}
 		}
 	| Eval ->
 	| Eval ->
 		{
 		{
@@ -779,6 +785,9 @@ let get_config com =
 			pf_uses_utf16 = false;
 			pf_uses_utf16 = false;
 			pf_supports_threads = true;
 			pf_supports_threads = true;
 			pf_capture_policy = CPWrapRef;
 			pf_capture_policy = CPWrapRef;
+			pf_exceptions = { default_config.pf_exceptions with
+				ec_avoid_wrapping = false
+			}
 		}
 		}
 
 
 let memory_marker = [|Unix.time()|]
 let memory_marker = [|Unix.time()|]

+ 1 - 1
tests/misc/projects/Issue4982/compile-fail.hxml.stderr

@@ -1 +1 @@
-Main.hx:3: characters 15-30 : Cannot use Void as value
+Main.hx:3: characters 15-30 : Void should be Any

+ 23 - 0
tests/unit/src/unit/issues/Issue12047.hx

@@ -0,0 +1,23 @@
+package unit.issues;
+
+import utest.Assert;
+
+class Issue12047 extends Test {
+	static function test() {
+		try {
+			throwCatchWrap();
+		} catch (err:Issue12047) {
+			trace(err);
+		} catch (e) {
+			Assert.pass();
+		}
+	}
+
+	static function throwCatchWrap() {
+		try {
+			throw "fatal";
+		} catch (e) {
+			throw e;
+		}
+	}
+}