diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-11 13:08:12 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-11 13:08:12 +0000 |
| commit | df9615f114ce8cd23d3293dd8d66ff0811a877dc (patch) | |
| tree | f34572b4e720cac5a538ef8315647225d90a9875 /core | |
| parent | add MIDI input ops (diff) | |
| download | alive-df9615f114ce8cd23d3293dd8d66ff0811a877dc.tar.gz alive-df9615f114ce8cd23d3293dd8d66ff0811a877dc.zip | |
fix def-and-reused op updaterate
Diffstat (limited to 'core')
| -rw-r--r-- | core/const.moon | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/const.moon b/core/const.moon index 45c44eb..99e4178 100644 --- a/core/const.moon +++ b/core/const.moon @@ -10,6 +10,15 @@ ancestor = (klass) -> klass = klass.__parent klass +class Ref + new: (@original) => + + get: (...) => @original\get ... + getc: (...) => @original\get ... + + destroy: => + update: => + class Const types = { sym: true @@ -110,4 +119,18 @@ class Const Const typ, val + @wrap_ref: (val) -> + if base = rawget val, '__base' + -- a class + error "#{name}: cannot wrap_ref class '#{val.__name}'" + elseif val.__class + -- an instance + switch ancestor val.__class + when Op then Ref val + when Const then val + else + error "#{name}: cannot wrap_ref '#{val.__class.__name}' instance" + else + error "#{name}: cannot wrap_ref Lua type '#{type val}'" + :Const, :load_ |
