moonscript
moonscript copied to clipboard
Assignment of `if` and `switch` to a variable.
The current code generated for this is potentially dangerous as it injects a name into a scope where the same name may have been re-declared as local.
The compiler is actually smart enough to not do that (you can try and stick _exp_0 = true before your assignment to switch and see what happens)
It's not that, it's this.
i = if fflag
1
else
local i
i = 1
while next(i)
i += 1
i
It's also an issue with the do statement-as-expression being assigned.