Explorar o código

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 %!s(int64=10) %!d(string=hai) anos
pai
achega
cefacc8608
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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));