فهرست منبع

Lua : don't generate TLocal expressions in gen_block_element

Once again, I'm finding a case where Haxe will generate a variable as
the complete entire in a block. E.g., a plain "x" variable expression:

```
var x = 4;
x;
```

Lua can't handle that, and since this expression has no side effect we
can just avoid generating it in the first place.
Justin Donaldson 10 سال پیش
والد
کامیت
ccaeed5e59
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      genlua.ml

+ 1 - 1
genlua.ml

@@ -727,7 +727,7 @@ and gen_block_element ?(after=false) ctx e =
 		spr ctx "(function() return ";
 		gen_tbinop ctx op e1 e2;
 		spr ctx " end)()";
-	| TConst c -> ()
+	| TConst _ | TLocal _ -> ()
 	| TBlock el ->
 		List.iter (gen_block_element ~after ctx) el
 	| TCall ({ eexpr = TLocal { v_name = "__feature__" } }, { eexpr = TConst (TString f) } :: eif :: eelse) ->