Преглед на файлове

treat {} as the special case that it is

Simon Krajewski преди 2 месеца
родител
ревизия
ccfb373091
променени са 2 файла, в които са добавени 13 реда и са изтрити 1 реда
  1. 1 1
      src/coro/coroFromTexpr.ml
  2. 12 0
      tests/misc/coroutines/src/issues/aidan/Issue164.hx

+ 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);
+	}
+}