mirror of
https://github.com/neovim/neovim.git
synced 2025-12-01 06:23:01 +00:00
api: Rename dict_set_value to dict_set_var
Reasonings:
1. It is not used for anything, but scope dictionaries currenly. So there is no
need to generalize and split it into dict_set_var (which will contain some
scope-dictionary-specific checks) and dict_set_value (which will work for any
dictionary).
2. Check for key size is no longer valid for non-scope dictionaries: you *can*
use empty keys there. In scope dictionaries also, but you actually are not
supposed to store there anything, but variables.
Note that actually one may still do
let b:[''] = 1
and “bypass” check for variable name. It won’t change what `echo b:` will show,
but it may affect code which iterates over scope dictionary keys and sets them
to something (if there is such code).
This commit is contained in:
@@ -368,7 +368,7 @@ Object nvim_get_var(String name, Error *err)
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_var(String name, Object value, Error *err)
|
||||
{
|
||||
dict_set_value(&globvardict, name, value, false, false, err);
|
||||
dict_set_var(&globvardict, name, value, false, false, err);
|
||||
}
|
||||
|
||||
/// Removes a global (g:) variable
|
||||
@@ -377,7 +377,7 @@ void nvim_set_var(String name, Object value, Error *err)
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_del_var(String name, Error *err)
|
||||
{
|
||||
dict_set_value(&globvardict, name, NIL, true, false, err);
|
||||
dict_set_var(&globvardict, name, NIL, true, false, err);
|
||||
}
|
||||
|
||||
/// Sets a global variable
|
||||
@@ -393,7 +393,7 @@ void nvim_del_var(String name, Error *err)
|
||||
/// or if previous value was `v:null`.
|
||||
Object vim_set_var(String name, Object value, Error *err)
|
||||
{
|
||||
return dict_set_value(&globvardict, name, value, false, true, err);
|
||||
return dict_set_var(&globvardict, name, value, false, true, err);
|
||||
}
|
||||
|
||||
/// Removes a global variable
|
||||
@@ -405,7 +405,7 @@ Object vim_set_var(String name, Object value, Error *err)
|
||||
/// @return Old value
|
||||
Object vim_del_var(String name, Error *err)
|
||||
{
|
||||
return dict_set_value(&globvardict, name, NIL, true, true, err);
|
||||
return dict_set_var(&globvardict, name, NIL, true, true, err);
|
||||
}
|
||||
|
||||
/// Gets a v: variable
|
||||
|
||||
Reference in New Issue
Block a user