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

Custom format for Typed and dispatch refactor

This commit is contained in:
Étienne Fildadut 2023-12-28 14:28:14 +01:00
parent e222f0fb28
commit 91e1311560
8 changed files with 75 additions and 26 deletions

View file

@ -26,8 +26,14 @@ Quote = ast.abstract.Node {
fn(self.expression, ...)
end,
call = function(self, state, args)
assert(args.arity == 0, "Quote! does not accept arguments")
dispatch = function(self, state, args)
if args.arity == 0 then
return self, args
else
return nil, "Quote! does not accept arguments"
end
end,
call_dispatched = function(self, state, args)
return self.expression:eval(state)
end
}