Convert enum values to number for LuaJIT 2.0.5 compat
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
ljkiwi - Free LuaJIT FFI kiwi (Cassowary derived) constraint solver.
|
ljkiwi - Free LuaJIT FFI kiwi (Cassowary derived) constraint solver.
|
||||||
|
|
||||||
[](https://github.com/jkl1337/ljkiwi/actions/workflows/ci.yml)
|
[](https://github.com/jkl1337/ljkiwi/actions/workflows/busted.yml)
|
||||||
[](https://coveralls.io/github/jkl1337/ljkiwi?branch=master)
|
[](https://coveralls.io/github/jkl1337/ljkiwi?branch=master)
|
||||||
[](https://luarocks.org/modules/jkl/ljkiwi)
|
[](https://luarocks.org/modules/jkl/ljkiwi)
|
||||||
|
|
||||||
|
|||||||
6
kiwi.lua
6
kiwi.lua
@@ -871,7 +871,8 @@ do
|
|||||||
function kiwi.error_mask(kinds, invert)
|
function kiwi.error_mask(kinds, invert)
|
||||||
local mask = 0
|
local mask = 0
|
||||||
for _, k in ipairs(kinds) do
|
for _, k in ipairs(kinds) do
|
||||||
mask = bor(mask, lshift(1, kiwi.ErrKind(k)))
|
-- must use tonumber only for LuaJIT 2.0 compatibility
|
||||||
|
mask = bor(mask, lshift(1, tonumber(kiwi.ErrKind(k)) --[[@as integer]]))
|
||||||
end
|
end
|
||||||
return invert and bit.bnot(mask) or mask
|
return invert and bit.bnot(mask) or mask
|
||||||
end
|
end
|
||||||
@@ -940,8 +941,9 @@ do
|
|||||||
end
|
end
|
||||||
local errdata = new_error(kind, message, solver, item)
|
local errdata = new_error(kind, message, solver, item)
|
||||||
local error_mask = solver and solver.error_mask_ or 0
|
local error_mask = solver and solver.error_mask_ or 0
|
||||||
|
-- tonumber only required for LuaJIT 2.0 compatibility
|
||||||
return item,
|
return item,
|
||||||
band(error_mask, lshift(1, kind --[[@as integer]])) == 0 and error(errdata)
|
band(error_mask, lshift(1, tonumber(kind) --[[@as integer]])) == 0 and error(errdata)
|
||||||
or errdata
|
or errdata
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
|
|||||||
Reference in New Issue
Block a user