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

Second test batch and associated fixes

This commit is contained in:
Étienne Fildadut 2023-12-29 17:15:43 +01:00
parent 7abb116876
commit 9b7d1e436e
56 changed files with 760 additions and 27 deletions

View file

@ -28,7 +28,7 @@ local VariableMetadata = ast.abstract.Runtime {
end
if self.symbol.type_check then
local r = self.symbol.type_check:call(state, ArgumentTuple:new(value))
if not r:truthy() then error(("type check failure for %s; %s does not satisfy %s"):format(self.symbol.string, value, self.symbol.type_check)) end
if not r:truthy() then error(("type check failure for %s; %s does not satisfy %s"):format(self.symbol.string, value, self.symbol.type_check), 0) end
end
if self.symbol.alias then
local assign_args = ArgumentTuple:new()
@ -185,14 +185,12 @@ local Environment = ast.abstract.Runtime {
return self:_get_variable(state, identifier):set(state, val)
end,
-- returns a list {[symbol]=val,...} of all exported variables in the current strict layer
-- returns a list {[symbol]=val,...} of all exported variables (evaluated) in the current strict layer
list_exported = function(self, state)
assert(self.export, "not an export scope layer")
local r = {}
for _, vm in self.variables:iter(state) do
if vm.symbol.exported then
r[vm.symbol] = vm:get(state)
end
r[vm.symbol] = vm:get(state)
end
return r
end,