From: Tobias Ulmer Date: Thu, 12 Mar 2015 17:13:02 +0000 (+0100) Subject: Revert "class: add obj_(un)lock_rw methods for debugging" X-Git-Tag: e2factory-2.3.15rc1~180 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=89139e72b34509ec7f17875c6a8daf3e00046ea9;p=e2factory.git Revert "class: add obj_(un)lock_rw methods for debugging" This reverts commit 881b2326718b872f02e0bc53ec3676f5e90d20a2. --- diff --git a/generic/class.lua b/generic/class.lua index aa20ccd..48b60e4 100644 --- a/generic/class.lua +++ b/generic/class.lua @@ -159,42 +159,6 @@ function Object.static:includes(mixin) ) end -function Object:obj_lock_rw() - local mt = getmetatable(self) - assert(mt, "object: metatable is missing") - assert(mt.__newindex == nil, "object metatable: __newindex in use") - mt.__newindex = function (t, k, v) - error(string.format("attempt to set uninitialized key in (%s)[%s] to %s", - tostring(t), tostring(k), tostring(v))) - end - - local idx = rawget(mt, "__index") -- upvalue - assert(type(idx) == "table", "object metatable: __index not a table") - if type(idx) == "table" then - rawset(mt, "__index_orig", idx) - - mt.__index = function (t, k) - local r = idx[k] - if r == nil then - error(string.format("attempted to read nil value from (%s)[%s]", - tostring(idx), tostring(k))) - end - return r - end - - end -end - -function Object:obj_unlock_rw() - local mt = getmetatable(self) - assert(mt, "object lacks metatable!") - mt.__newindex = nil - - local idx = rawget(mt, "__index_orig") - assert(type(idx) == "table", "object metatable: __index_orig not a table") - rawset(mt, "__index", idx) -end - function Object:initialize() end function Object:__tostring() return "instance of " .. tostring(self.class) end @@ -221,5 +185,3 @@ middleclass.Object = Object setmetatable(middleclass, { __call = function(_, ...) return middleclass.class(...) end }) return middleclass - --- vim:sw=2:sts=2:et: