1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 00:59:31 +00:00

Replace checkpoint system

The previous system needed to store of the scope and full AST to build a Resumable object, which means that if persisted, updating the resumable script will have no effect.
The new system instead uses an anchor token and does not require any information besides the anchor name.
This commit is contained in:
Étienne Fildadut 2023-12-27 17:06:35 +01:00
parent c4636343b4
commit 56ed6c912b
21 changed files with 217 additions and 234 deletions

View file

@ -1,5 +1,5 @@
local ast = require("ast")
local Nil, Choice, AttachBlock = ast.Nil, ast.Choice, ast.AttachBlock
local Nil, Choice, AttachBlock, ArgumentTuple = ast.Nil, ast.Choice, ast.AttachBlock, ast.ArgumentTuple
local event_manager = require("state.event_manager")
local translation_manager = require("state.translation_manager")
@ -19,7 +19,12 @@ return {
{
"_|>_", "(txt::text, fn)",
function(state, text, func)
event_manager:write(state, Choice:new(text, func))
if func:contains_resume_target(state) then
func:call(state, ArgumentTuple:new())
event_manager:write_and_discard_on_flush(state, Choice:new(text, func))
else
event_manager:write(state, Choice:new(text, func))
end
return Nil:new()
end
},