Browse Source

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

Franco Ponticelli 14 years ago
parent
commit
0ec629cda3
1 changed files with 5 additions and 0 deletions
  1. 5 0
      genphp.ml

+ 5 - 0
genphp.ml

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