aboutsummaryrefslogtreecommitdiffstats
path: root/alv/base/fndef.moon
blob: 836294d404f194d9317d6ebfbc1249802062d419 (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 (unevaluated) naming the function parameters
  -- @tparam AST body (unevaluated) 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
}