2
0
Эх сурвалжийг харах

Lua : fix situations where value returned is an opassign expression

Justin Donaldson 10 жил өмнө
parent
commit
09082cf452
1 өөрчлөгдсөн 10 нэмэгдсэн , 3 устгасан
  1. 10 3
      genlua.ml

+ 10 - 3
genlua.ml

@@ -1096,9 +1096,16 @@ and gen_return ctx e eo =
     | None ->
 	    spr ctx "do return end"
     | Some e ->
-	    spr ctx "do return ";
-	    gen_value ctx e;
-	    spr ctx " end"
+	    (match e.eexpr with
+	    | TBinop(OpAssign, e1, e2) ->
+		gen_expr ctx e;
+		spr ctx " do return ";
+		gen_value ctx e1;
+		spr ctx " end";
+	    | _ ->
+		spr ctx "do return ";
+		gen_value ctx e;
+		spr ctx " end");
 	)
 
 and gen_iife_assign ctx f =