瀏覽代碼

- fixed issue with break inside a switch/default block (prevented hscript to work properly)

Franco Ponticelli 14 年之前
父節點
當前提交
0ec629cda3
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      genphp.ml

+ 5 - 0
genphp.ml

@@ -1437,10 +1437,15 @@ and gen_expr ctx e =
 		| None -> ()
 		| Some e ->
 			spr ctx "default:";
+			let old_loop = ctx.in_loop in
+			ctx.in_loop <- false;
+			ctx.nested_loops <- ctx.nested_loops + 1;
 			restore_in_block ctx in_block;
 			gen_expr ctx (mk_block e);
 			print ctx "break";
 			newline ctx;
+			ctx.nested_loops <- ctx.nested_loops - 1;
+			ctx.in_loop <- old_loop;
 		);
 		spr ctx "}";
 		b()