Ver código fonte

treat {} as the special case that it is

Simon Krajewski 2 meses atrás
pai
commit
ccfb373091

+ 1 - 1
src/coro/coroFromTexpr.ml

@@ -63,7 +63,7 @@ let expr_to_coro ctx etmp_result etmp_error_unwrapped cb_root e =
 	let loop_stack = ref [] in
 	let rec loop cb ret e = match e.eexpr with
 		(* special cases *)
-		| TConst TThis ->
+		| TConst TThis | TBlock [] ->
 			Some (cb,e)
 		(* simple values *)
 		| TConst _ | TLocal _ | TTypeExpr _ | TIdent _ ->

+ 12 - 0
tests/misc/coroutines/src/issues/aidan/Issue164.hx

@@ -0,0 +1,12 @@
+package issues.aidan;
+
+class Issue164 extends utest.Test {
+	@:coroutine function f() {
+		{};
+		throw "this won't run";
+	}
+
+	function test() {
+		Assert.raises(() -> CoroRun.run(f), String);
+	}
+}