From df9615f114ce8cd23d3293dd8d66ff0811a877dc Mon Sep 17 00:00:00 2001 From: s-ol Date: Tue, 11 Feb 2020 14:08:12 +0100 Subject: fix def-and-reused op updaterate --- core/const.moon | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'core') 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_ -- cgit v1.2.3