PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org/docs/Introduction
MIT License
338 stars 20 forks source link

Allow usage of walrus operator in unconditional subexpressions #817

Closed Sainan closed 2 months ago

Sainan commented 2 months ago

Fixes #815, fixes #816. Doesn't seem to make any regressions with regards to #776.

Sainan commented 2 months ago

With the and case it's a bit tricky, because this UB is still possible:

if false and a := 1 then
else
    print(a)
end
XmiliaH commented 2 months ago

This seems to be bugged:

local x = 2

while (x+2+a:=2) do
    print(a)
end

should print 2 but prints 4.