mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 20:05:38 +00:00
refactor(vim.opt): remove value_mutator()
This commit is contained in:
@@ -365,11 +365,6 @@ local convert_value_to_lua = (function()
|
|||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
--- Handles the mutation of various different values.
|
|
||||||
local value_mutator = function(info, current, new, mutator)
|
|
||||||
return mutator[info.metatype](current, new)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Handles the '^' operator
|
--- Handles the '^' operator
|
||||||
local prepend_value = (function()
|
local prepend_value = (function()
|
||||||
local methods = {
|
local methods = {
|
||||||
@@ -399,11 +394,9 @@ local prepend_value = (function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function(info, current, new)
|
return function(info, current, new)
|
||||||
return value_mutator(
|
methods[info.metatype](
|
||||||
info,
|
|
||||||
convert_value_to_lua(info, current),
|
convert_value_to_lua(info, current),
|
||||||
convert_value_to_lua(info, new),
|
convert_value_to_lua(info, new)
|
||||||
methods
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
@@ -437,11 +430,9 @@ local add_value = (function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function(info, current, new)
|
return function(info, current, new)
|
||||||
return value_mutator(
|
methods[info.metatype](
|
||||||
info,
|
|
||||||
convert_value_to_lua(info, current),
|
convert_value_to_lua(info, current),
|
||||||
convert_value_to_lua(info, new),
|
convert_value_to_lua(info, new)
|
||||||
methods
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
@@ -512,7 +503,7 @@ local remove_value = (function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function(info, current, new)
|
return function(info, current, new)
|
||||||
return value_mutator(info, convert_value_to_lua(info, current), new, methods)
|
return methods[info.metatype](convert_value_to_lua(info, current), new)
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user