]> git.e2factory.org Git - e2factory.git/commitdiff
Revert "class: add obj_(un)lock_rw methods for debugging"
authorTobias Ulmer <tu@emlix.com>
Thu, 12 Mar 2015 17:13:02 +0000 (18:13 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
This reverts commit 881b2326718b872f02e0bc53ec3676f5e90d20a2.

generic/class.lua

index aa20ccd6d058d91a56512776104678053e785fd9..48b60e44e729ff99b5734ccd1bb1be014e89c84e 100644 (file)
@@ -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: