mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
vim-patch:8.1.1957: more code can be moved to evalvars.c
Problem: More code can be moved to evalvars.c.
Solution: Move code to where it fits better. (Yegappan Lakshmanan,
closes vim/vim#4883)
da6c033421
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/eval/vars.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight.h"
|
||||
@@ -578,7 +579,7 @@ Object tabpage_del_var(Tabpage tabpage, String name, Arena *arena, Error *err)
|
||||
Object vim_set_var(String name, Object value, Arena *arena, Error *err)
|
||||
FUNC_API_DEPRECATED_SINCE(1)
|
||||
{
|
||||
return dict_set_var(&globvardict, name, value, false, true, arena, err);
|
||||
return dict_set_var(get_globvar_dict(), name, value, false, true, arena, err);
|
||||
}
|
||||
|
||||
/// @deprecated
|
||||
@@ -586,7 +587,7 @@ Object vim_set_var(String name, Object value, Arena *arena, Error *err)
|
||||
Object vim_del_var(String name, Arena *arena, Error *err)
|
||||
FUNC_API_DEPRECATED_SINCE(1)
|
||||
{
|
||||
return dict_set_var(&globvardict, name, NIL, true, true, arena, err);
|
||||
return dict_set_var(get_globvar_dict(), name, NIL, true, true, arena, err);
|
||||
}
|
||||
|
||||
static int64_t convert_index(int64_t index)
|
||||
|
||||
@@ -230,7 +230,7 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, bool retva
|
||||
rv = vim_to_object(&di->di_tv, arena, false);
|
||||
}
|
||||
bool type_error = false;
|
||||
if (dict == &vimvardict
|
||||
if (dict == get_vimvar_dict()
|
||||
&& !before_set_vvar(key.data, di, &tv, true, watched, &type_error)) {
|
||||
tv_clear(&tv);
|
||||
if (type_error) {
|
||||
|
||||
@@ -691,13 +691,13 @@ void nvim_del_current_line(Arena *arena, Error *err)
|
||||
Object nvim_get_var(String name, Arena *arena, Error *err)
|
||||
FUNC_API_SINCE(1)
|
||||
{
|
||||
dictitem_T *di = tv_dict_find(&globvardict, name.data, (ptrdiff_t)name.size);
|
||||
dictitem_T *di = tv_dict_find(get_globvar_dict(), name.data, (ptrdiff_t)name.size);
|
||||
if (di == NULL) { // try to autoload script
|
||||
bool found = script_autoload(name.data, name.size, false) && !aborting();
|
||||
VALIDATE(found, "Key not found: %s", name.data, {
|
||||
return (Object)OBJECT_INIT;
|
||||
});
|
||||
di = tv_dict_find(&globvardict, name.data, (ptrdiff_t)name.size);
|
||||
di = tv_dict_find(get_globvar_dict(), name.data, (ptrdiff_t)name.size);
|
||||
}
|
||||
VALIDATE((di != NULL), "Key not found: %s", name.data, {
|
||||
return (Object)OBJECT_INIT;
|
||||
@@ -713,7 +713,7 @@ Object nvim_get_var(String name, Arena *arena, Error *err)
|
||||
void nvim_set_var(String name, Object value, Error *err)
|
||||
FUNC_API_SINCE(1)
|
||||
{
|
||||
dict_set_var(&globvardict, name, value, false, false, NULL, err);
|
||||
dict_set_var(get_globvar_dict(), name, value, false, false, NULL, err);
|
||||
}
|
||||
|
||||
/// Removes a global (g:) variable.
|
||||
@@ -723,7 +723,7 @@ void nvim_set_var(String name, Object value, Error *err)
|
||||
void nvim_del_var(String name, Error *err)
|
||||
FUNC_API_SINCE(1)
|
||||
{
|
||||
dict_set_var(&globvardict, name, NIL, true, false, NULL, err);
|
||||
dict_set_var(get_globvar_dict(), name, NIL, true, false, NULL, err);
|
||||
}
|
||||
|
||||
/// Gets a v: variable.
|
||||
@@ -734,7 +734,7 @@ void nvim_del_var(String name, Error *err)
|
||||
Object nvim_get_vvar(String name, Arena *arena, Error *err)
|
||||
FUNC_API_SINCE(1)
|
||||
{
|
||||
return dict_get_value(&vimvardict, name, arena, err);
|
||||
return dict_get_value(get_vimvar_dict(), name, arena, err);
|
||||
}
|
||||
|
||||
/// Sets a v: variable, if it is not readonly.
|
||||
@@ -745,7 +745,7 @@ Object nvim_get_vvar(String name, Arena *arena, Error *err)
|
||||
void nvim_set_vvar(String name, Object value, Error *err)
|
||||
FUNC_API_SINCE(6)
|
||||
{
|
||||
dict_set_var(&vimvardict, name, value, false, false, NULL, err);
|
||||
dict_set_var(get_vimvar_dict(), name, value, false, false, NULL, err);
|
||||
}
|
||||
|
||||
/// Prints a message given by a list of `[text, hl_group]` "chunks".
|
||||
|
||||
Reference in New Issue
Block a user