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

Variable must now be explicitly marked as persistent

This commit is contained in:
Étienne Fildadut 2022-09-27 18:41:40 +09:00
parent e9606cdee0
commit 2c6d66c222
11 changed files with 384 additions and 106 deletions

View file

@ -309,7 +309,7 @@ local function eval(state, exp)
local depth, err = check_constraint(state, param.full_name, val)
if not depth then
ok = false
local v = state.variable_constraints[param.full_name].value
local v = state.variable_metadata[param.full_name].constraint.value
table.insert(tried_function_error_messages, ("%s: argument %s is not of expected type %s"):format(fn.pretty_signature, param.name, format(v) or v))
break
end
@ -347,7 +347,7 @@ local function eval(state, exp)
local depth, err = check_constraint(state, param.full_name, assignment)
if not depth then
ok = false
local v = state.variable_constraints[param.full_name].value
local v = state.variable_metadata[param.full_name].constraint.value
table.insert(tried_function_error_messages, ("%s: argument %s is not of expected type %s"):format(fn.pretty_signature, param.name, format(v) or v))
end
depths.assignment = depth
@ -418,8 +418,11 @@ local function eval(state, exp)
if not s then return nil, e end
end
-- get function vars
local checkpoint, checkpointe = get_variable(state, fn.namespace.."🔖")
if not checkpoint then return nil, checkpointe end
local checkpoint, checkpointe
if fn.resumable then
checkpoint, checkpointe = get_variable(state, fn.namespace.."🔖")
if not checkpoint then return nil, checkpointe end
end
local seen, seene = get_variable(state, fn.namespace.."👁️")
if not seen then return nil, seene end
-- execute lua functions
@ -488,7 +491,7 @@ local function eval(state, exp)
else
local e
-- eval function from start
if paren_call or checkpoint.type == "nil" then
if paren_call or not fn.resumable or checkpoint.type == "nil" then
ret, e = run(state, fn.child)
-- resume at last checkpoint
else