Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
cefacc8608
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  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));