blob: b79ad850a01cd45e221a0e3c85bec2425d6ddfa2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
----
-- user-function definition (`fndef`).
--
-- When called, expands to its body with params bound to the fn arguments (see
-- `invoke.fn_invoke`).
--
-- @classmod FnDef
class FnDef
--- static functions
-- @section static
--- create a new instance
--
-- @classmethod
-- @tparam {Value,...} params (`AST:quote`d) naming the function parameters
-- @tparam AST body (`AST:quote`d) expression the function evaluates to
-- @tparam Scope scope the lexical scope the function was defined in (closure)
new: (@params, @body, @scope) =>
__tostring: =>
"(fn (#{table.concat [p\stringify! for p in *@params], ' '}) ...)"
{
:FnDef
}
|