Ver Fonte

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 há 10 anos atrás
pai
commit
ccaeed5e59
1 ficheiros alterados com 1 adições e 1 exclusões
  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) ->