Support tee_local. Converts assignments in expressions (not top level statements) to return the local that is being set.
The change also makes the grammar a bit more granular, creating a distinction between assignments in expressions vs top-level statements.
// These are tee_local(s)
while (i -= 1) { ... }
const x : i32 = 2 * (i += 10);
// These are NOT tee_locals(s)
x += 10;
i = 1;
// obj.x is a syntax error, only identifiers can be tee-ed
const y : i32 = obj.x += 2;
// for loops do not support tee_local either, these are vanilla set_local
for (i = 0; i < 10; i += 1) { ... }
Fixes
select
Ternary statements were not encoded as selects, they should have been.
Negation encoding of constants
The generator was treating variable negation the same as constant negation. This meant that a - preceding anything was always a binary operation of 0 - value. Now negative constants are encoded as such.
New features
tee_local
Support tee_local. Converts assignments in expressions (not top level statements) to return the local that is being set.
The change also makes the grammar a bit more granular, creating a distinction between assignments in expressions vs top-level statements.
Fixes
select
Ternary statements were not encoded as
selects
, they should have been.Negation encoding of constants
The generator was treating variable negation the same as constant negation. This meant that a
-
preceding anything was always a binary operation of0 - value
. Now negative constants are encoded as such.