浏览代码

Lua : handle more block element situations

It's necessary to treat code after if/then/else as being inside a
block.
Justin Donaldson 10 年之前
父节点
当前提交
e7297fc5cd
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      genlua.ml

+ 4 - 4
genlua.ml

@@ -532,7 +532,7 @@ and gen_expr ctx e =
 		spr ctx "if ";
 		gen_cond ctx cond;
 		spr ctx " then ";
-		gen_expr ctx e;
+		gen_block_element ctx e;
 		newline ctx;
 		(match eelse with
 		| None -> ();
@@ -543,7 +543,7 @@ and gen_expr ctx e =
 			spr ctx "else";
 			newline ctx;
 			let bend = open_block ctx in
-			gen_expr ctx e2;
+			gen_block_element ctx e2;
 			bend();
 			newline ctx);
 		spr ctx "end";
@@ -867,7 +867,7 @@ and gen_value ctx e =
 		spr ctx "if ";
 		gen_cond ctx cond;
 		spr ctx " then ";
-		gen_value ctx (assign e);
+		gen_block_element ctx (assign e);
 		let rec gen_elseif ctx e =
 		(match e with
 		| None->();
@@ -877,7 +877,7 @@ and gen_value ctx e =
 			spr ctx " elseif ";
 			gen_cond ctx cond3;
 			spr ctx " then ";
-			gen_expr ctx (assign e3);
+			gen_block_element ctx (assign e3);
 			semicolon ctx;
 			gen_elseif ctx eo3;
 		    | _ ->