aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_meta.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-09-08 16:44:18 +0100
committerLewis Russell <lewis6991@gmail.com>2022-09-09 09:54:54 +0100
commit925a8119902ebe63343374f9edc57b4ea6038d08 (patch)
treebb020882783adea8c326f1abbb8dcd4779e5ec91 /runtime/lua/vim/_meta.lua
parent7533ceec13a1dd9a1e46a523975bddf52f533a93 (diff)
downloadrneovim-925a8119902ebe63343374f9edc57b4ea6038d08.tar.gz
rneovim-925a8119902ebe63343374f9edc57b4ea6038d08.tar.bz2
rneovim-925a8119902ebe63343374f9edc57b4ea6038d08.zip
refactor(vim.opt): remove value_mutator()
Diffstat (limited to 'runtime/lua/vim/_meta.lua')
-rw-r--r--runtime/lua/vim/_meta.lua19
1 files changed, 5 insertions, 14 deletions
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index f78c2da581..9daef780f4 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -365,11 +365,6 @@ local convert_value_to_lua = (function()
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
local prepend_value = (function()
local methods = {
@@ -399,11 +394,9 @@ local prepend_value = (function()
}
return function(info, current, new)
- return value_mutator(
- info,
+ methods[info.metatype](
convert_value_to_lua(info, current),
- convert_value_to_lua(info, new),
- methods
+ convert_value_to_lua(info, new)
)
end
end)()
@@ -437,11 +430,9 @@ local add_value = (function()
}
return function(info, current, new)
- return value_mutator(
- info,
+ methods[info.metatype](
convert_value_to_lua(info, current),
- convert_value_to_lua(info, new),
- methods
+ convert_value_to_lua(info, new)
)
end
end)()
@@ -512,7 +503,7 @@ local remove_value = (function()
}
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)()