mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Return break while loops
This commit is contained in:
parent
8eb4bd5ac5
commit
10084dec23
1 changed files with 2 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
local ast = require("ast")
|
local ast = require("ast")
|
||||||
local ArgumentTuple, Nil, Boolean, Identifier = ast.ArgumentTuple, ast.Nil, ast.Boolean, ast.Identifier
|
local ArgumentTuple, Nil, Boolean, Identifier, Return = ast.ArgumentTuple, ast.Nil, ast.Boolean, ast.Identifier, ast.Return
|
||||||
|
|
||||||
local if_identifier = Identifier:new("_if_status")
|
local if_identifier = Identifier:new("_if_status")
|
||||||
local if_symbol = if_identifier:to_symbol()
|
local if_symbol = if_identifier:to_symbol()
|
||||||
|
|
@ -58,6 +58,7 @@ return {
|
||||||
end
|
end
|
||||||
while cond:truthy() do
|
while cond:truthy() do
|
||||||
r = expression:call(state, ArgumentTuple:new())
|
r = expression:call(state, ArgumentTuple:new())
|
||||||
|
if Return:is(r) then break end
|
||||||
cond = condition:call(state, ArgumentTuple:new())
|
cond = condition:call(state, ArgumentTuple:new())
|
||||||
end
|
end
|
||||||
return r
|
return r
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue