Remove misc.readonly

Fix #571
This commit is contained in:
hrsh7th
2021-11-23 23:22:22 +09:00
parent 6fa7681812
commit ac476e05df
3 changed files with 2 additions and 23 deletions

View File

@@ -168,19 +168,6 @@ misc.to_vimindex = function(text, utfindex)
return utfindex + 1
end
---Return readonly version object
---@generic T
---@param tbl T
---@return T
misc.readonly = function(tbl)
return setmetatable({}, {
__index = tbl,
__newindex = function()
error('this table is readonly.')
end,
})
end
---Mark the function as deprecated
misc.deprecated = function(fn, msg)
local printed = false

View File

@@ -49,12 +49,4 @@ describe('misc', function()
assert.are.equal(merged.a, nil)
end)
it('readonly', function()
local o = { a = 1, b = 2 }
local r = misc.readonly(o)
assert.are.equal(r.a, 1)
assert.has_error(function()
r.a = 5
end)
end)
end)