aboutsummaryrefslogtreecommitdiffstats
path: root/alv/dummy.moon
blob: cc69f1083a597c406d48b1a83532d499fc8cdb6b (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
----
-- Dummy AST Node.
--
-- Implements the `AST` interface.
--
-- @classmod Dummy
import RTNode from require 'alv.rtnode'
import Constant from require 'alv.result.const'
import Error from require 'alv.error'

class Dummy
--- members
-- @section members

  --- the contained node.
  --
  -- @tfield RTNode node

--- AST interface
--
-- `Dummy` implements the `AST` interface.
-- @section ast

  --- evaluate this Dummy.
  --
  -- returns `node`
  -- @treturn RTNode `node`
  eval: => @node

  --- create a clone with its own identity.
  --
  -- returns a ref to `node`.
  --
  -- @tparam Tag parent
  -- @treturn Cell
  clone: => @

  --- stringify this Dummy.
  --
  -- throws an error, `Dummy` nodes cannot be stringified.
  stringify: => error Error 'implementation', "cannot stringify Dummy"

--- static functions
-- @section static

  --- construct a new Dummy from a `RTNode`.
  --
  -- @classmethod
  -- @tparam RTNode node
  new: (@node) =>

  --- construct a new Dummy from a plain value.
  --
  -- @tparam Type type
  -- @tparam any value
  -- @tparam string raw string
  @literal: (...) -> @@ RTNode result: Constant ...

{
  :Dummy
}