소스 검색

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