소스 검색

- 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()