Fix do while

Test wasn't adequate and I didn't pass an extra value to the node data
This commit is contained in:
Vurv 2023-10-14 15:51:46 -07:00
parent 59ca86eff7
commit 810a570779
2 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,13 @@ do {
assert(Num == 1000)
local Ran = 0
do {
Ran = 1
} while (0)
assert(Ran)
Calls = 1
Inc = 1
function number calls() {

View File

@ -520,7 +520,7 @@ function Parser:Stmt()
if self:Consume(TokenVariant.Keyword, Keyword.Do) then
local trace, block = self:Prev().trace, self:Block()
self:Assert( self:Consume(TokenVariant.Keyword, Keyword.While), "while expected after do and code block (do {...} )")
return Node.new(NodeVariant.While, { self:Condition(), block }, trace:stitch(self:Prev().trace))
return Node.new(NodeVariant.While, { self:Condition(), block, true }, trace:stitch(self:Prev().trace))
end
-- Event