Explorar el Código

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 hace 10 años
padre
commit
ccaeed5e59
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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) ->