aboutsummaryrefslogtreecommitdiffstats
path: root/base.moon
blob: 72dd62f8387b2949988de5b4b7133b771737b333 (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
import is_object from require 'moon'

class Const
  types = { sym: true, scope: true, str: true, num: true, op: true, opdef: true, macro: true }
  new: (@type, @value) =>
    assert types[@type], "invalid Const type: #{@type}"

  get: => @value
  getc: => @value

  __tostring: => "<#{@type}: #{@value}>"

class Op
  new: (@node) =>
    @setup @node\tail!

  patch: (next) =>
    @node = next
    @setup @node\tail!

  update: (dt) =>

  get: => @value
  getc: =>
    print "WARN: stream to constant", debug.traceback!
    @value

  destroy: =>

  __tostring: => "<op: #{@@__name}>"
  __inherited: (cls) =>
        cls.__base.__tostring = @__tostring

{
  :Const
  :Op
}