Browse Source

[eval] catch a Break (closes #6443)

Simon Krajewski 8 years ago
parent
commit
c83d2f9a78

+ 1 - 1
src/macro/eval/evalEmitter.ml

@@ -309,7 +309,7 @@ let emit_do_while_break_continue exec_cond exec_body env =
 		ignore(exec_body env); run_while_continue exec_cond exec_body env
 	with
 		| Break -> ()
-		| Continue -> run_while_continue exec_cond exec_body env
+		| Continue -> try run_while_continue exec_cond exec_body env with Break -> ()
 	end;
 	vnull
 

+ 13 - 0
tests/misc/projects/Issue6443/Main.hx

@@ -0,0 +1,13 @@
+class Main {
+	static function main() {
+		var first = true;
+		do {
+			if (first) {
+				first = false;
+				continue;
+			}
+			break;
+		} while (true);
+		Sys.stderr().writeString("ok");
+	}
+}

+ 1 - 0
tests/misc/projects/Issue6443/compile.hxml

@@ -0,0 +1 @@
+--macro Main.main()

+ 1 - 0
tests/misc/projects/Issue6443/compile.hxml.stderr

@@ -0,0 +1 @@
+ok