Ver código fonte

Lua : Fix iffe assign

I need to stash this context variable, because it can change inside
this method body, and I always need to remember its original value.
Justin Donaldson 10 anos atrás
pai
commit
1ef9c0497e
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      genlua.ml

+ 3 - 2
genlua.ml

@@ -907,7 +907,8 @@ and gen_value ctx e =
 and gen_tbinop ctx op e1 e2 =
 and gen_tbinop ctx op e1 e2 =
     (match op with
     (match op with
     | Ast.OpAssign ->
     | Ast.OpAssign ->
-	    if ctx.iife_assign then spr ctx "(function() ";
+	    let iife_assign = ctx.iife_assign in
+	    if iife_assign then spr ctx "(function() ";
 	    (match e2.eexpr with
 	    (match e2.eexpr with
 	    | TBinop(OpAssign as op, e3, e4) ->
 	    | TBinop(OpAssign as op, e3, e4) ->
 		gen_tbinop ctx op e3 e4;
 		gen_tbinop ctx op e3 e4;
@@ -919,7 +920,7 @@ and gen_tbinop ctx op e1 e2 =
 		gen_value ctx e1;
 		gen_value ctx e1;
 		print ctx " %s " (Ast.s_binop op);
 		print ctx " %s " (Ast.s_binop op);
 		gen_value ctx e2);
 		gen_value ctx e2);
-	    if ctx.iife_assign then begin
+	    if iife_assign then begin
 		spr ctx " return ";
 		spr ctx " return ";
 		gen_value ctx e1;
 		gen_value ctx e1;
 		spr ctx " end)()";
 		spr ctx " end)()";