Просмотр исходного кода

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 лет назад
Родитель
Сommit
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));