浏览代码

Lua : fix situations where value returned is an opassign expression

Justin Donaldson 10 年之前
父节点
当前提交
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 =