瀏覽代碼

Lua : add semicolon to var declarations

Lua will try to interpret expressions across newlines.  Adding a
semicolon will prevent this.

Note that I can't just do this everywhere, in some cases, we need to allow
the expressions to be combined with other expressions via operators.
Local declarations are safe, since they are statements and not
expressions.
Justin Donaldson 10 年之前
父節點
當前提交
cefacc8608
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      genlua.ml

+ 2 - 0
genlua.ml

@@ -516,12 +516,14 @@ and gen_expr ctx e =
 				    spr ctx (ident v.v_name);
 				    spr ctx " = ";
 				    gen_value ctx e1;
+				    spr ctx ";";
 
 				| _ ->
 				    spr ctx "local ";
 				    spr ctx (ident v.v_name);
 				    spr ctx " = ";
 				    gen_value ctx e;
+				    spr ctx ";";
 		end
 	| TNew (c,_,el) ->
 		print ctx "%s.new(" (ctx.type_accessor (TClassDecl c));