aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-20 07:34:50 +0200
committerJustin M. Keyes <justinkz@gmail.com>2024-09-23 14:42:57 +0200
commit737f58e23230ea14f1648ac1fc7f442ea0f8563c (patch)
treed16bee4c0ad2bb5ff2ec058cd09133a285674fef /src/nvim
parent5acdc4499e2036c90172b2b085f207ee4d5cfee4 (diff)
downloadrneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.gz
rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.bz2
rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.zip
refactor(api)!: rename Dictionary => Dict
In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/api/autocmd.c10
-rw-r--r--src/nvim/api/buffer.c8
-rw-r--r--src/nvim/api/command.c30
-rw-r--r--src/nvim/api/deprecated.c10
-rw-r--r--src/nvim/api/extmark.c8
-rw-r--r--src/nvim/api/keysets_defs.h6
-rw-r--r--src/nvim/api/options.c14
-rw-r--r--src/nvim/api/private/converter.c27
-rw-r--r--src/nvim/api/private/defs.h8
-rw-r--r--src/nvim/api/private/helpers.c54
-rw-r--r--src/nvim/api/private/helpers.h10
-rw-r--r--src/nvim/api/private/validate.h8
-rw-r--r--src/nvim/api/ui.c15
-rw-r--r--src/nvim/api/vim.c90
-rw-r--r--src/nvim/api/vimscript.c46
-rw-r--r--src/nvim/api/window.c7
-rw-r--r--src/nvim/autocmd.c2
-rw-r--r--src/nvim/buffer_defs.h12
-rw-r--r--src/nvim/channel.c18
-rw-r--r--src/nvim/context.c14
-rw-r--r--src/nvim/cursor_shape.c4
-rw-r--r--src/nvim/decoration.c2
-rw-r--r--src/nvim/eval.h4
-rw-r--r--src/nvim/eval/funcs.c6
-rw-r--r--src/nvim/eval/typval_defs.h6
-rw-r--r--src/nvim/eval/typval_encode.c.h3
-rw-r--r--src/nvim/eval/userfunc.c6
-rw-r--r--src/nvim/eval/userfunc.h8
-rw-r--r--src/nvim/eval/vars.c4
-rw-r--r--src/nvim/generators/c_grammar.lua6
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua24
-rw-r--r--src/nvim/generators/gen_api_ui_events.lua6
-rw-r--r--src/nvim/generators/gen_declarations.lua2
-rw-r--r--src/nvim/generators/gen_options_enum.lua2
-rw-r--r--src/nvim/globals.h4
-rw-r--r--src/nvim/highlight.c25
-rw-r--r--src/nvim/highlight_group.c20
-rw-r--r--src/nvim/lua/converter.c149
-rw-r--r--src/nvim/main.c30
-rw-r--r--src/nvim/mapping.c30
-rw-r--r--src/nvim/msgpack_rpc/channel.c14
-rw-r--r--src/nvim/msgpack_rpc/channel_defs.h2
-rw-r--r--src/nvim/msgpack_rpc/packer.c6
-rw-r--r--src/nvim/msgpack_rpc/unpacker.c8
-rw-r--r--src/nvim/option.c17
-rw-r--r--src/nvim/os/proc.c4
-rw-r--r--src/nvim/shada.c8
-rw-r--r--src/nvim/statusline.c8
-rw-r--r--src/nvim/tui/tui.c8
-rw-r--r--src/nvim/ui.c4
-rw-r--r--src/nvim/ui_client.c20
-rw-r--r--src/nvim/usercmd.c8
-rw-r--r--src/nvim/viml/parser/expressions.c3
-rw-r--r--src/nvim/viml/parser/expressions.h2
54 files changed, 416 insertions, 434 deletions
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index ca8367b7ce..22932fd1a2 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -67,7 +67,7 @@ static int64_t next_autocmd_id = 1;
/// NOTE: When multiple patterns or events are provided, it will find all the autocommands that
/// match any combination of them.
///
-/// @param opts Dictionary with at least one of the following:
+/// @param opts Dict with at least one of the following:
/// - group (string|integer): the autocommand group name or id to match against.
/// - event (string|array): event or events to match against |autocmd-events|.
/// - pattern (string|array): pattern or patterns to match against |autocmd-pattern|.
@@ -270,7 +270,7 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Arena *arena, Error *err)
}
}
- Dictionary autocmd_info = arena_dict(arena, 11);
+ Dict autocmd_info = arena_dict(arena, 11);
if (ap->group != AUGROUP_DEFAULT) {
PUT_C(autocmd_info, "group", INTEGER_OBJ(ap->group));
@@ -334,7 +334,7 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Arena *arena, Error *err)
// PUT_C(autocmd_info, "sid", INTEGER_OBJ(ac->script_ctx.sc_sid));
// PUT_C(autocmd_info, "lnum", INTEGER_OBJ(ac->script_ctx.sc_lnum));
- kvi_push(autocmd_list, DICTIONARY_OBJ(autocmd_info));
+ kvi_push(autocmd_list, DICT_OBJ(autocmd_info));
}
}
@@ -621,7 +621,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Arena *arena, Error *err)
/// ```
///
/// @param name String: The name of the group
-/// @param opts Dictionary Parameters
+/// @param opts Dict Parameters
/// - clear (bool) optional: defaults to true. Clear existing
/// commands if the group already exists |autocmd-groups|.
/// @return Integer id of the created group.
@@ -686,7 +686,7 @@ void nvim_del_augroup_by_name(String name, Error *err)
/// Execute all autocommands for {event} that match the corresponding
/// {opts} |autocmd-execute|.
/// @param event (String|Array) The event or events to execute
-/// @param opts Dictionary of autocommand options:
+/// @param opts Dict of autocommand options:
/// - group (string|integer) optional: the autocommand group name or
/// id to match against. |autocmd-groups|.
/// - pattern (string|array) optional: defaults to "*" |autocmd-pattern|. Cannot be used
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index a0678dc3e4..3baf8a97d9 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -866,7 +866,7 @@ Integer nvim_buf_get_changedtick(Buffer buffer, Error *err)
/// @param[out] err Error details, if any
/// @returns Array of |maparg()|-like dictionaries describing mappings.
/// The "buffer" key holds the associated buffer handle.
-ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Arena *arena, Error *err)
+ArrayOf(Dict) nvim_buf_get_keymap(Buffer buffer, String mode, Arena *arena, Error *err)
FUNC_API_SINCE(3)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -1221,14 +1221,14 @@ Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
}
/// @nodoc
-Dictionary nvim__buf_stats(Buffer buffer, Arena *arena, Error *err)
+Dict nvim__buf_stats(Buffer buffer, Arena *arena, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
- return (Dictionary)ARRAY_DICT_INIT;
+ return (Dict)ARRAY_DICT_INIT;
}
- Dictionary rv = arena_dict(arena, 7);
+ Dict rv = arena_dict(arena, 7);
// Number of times the cached line was flushed.
// This should generally not increase while editing the same
// line in the same mode.
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 78be0a2cf7..ab57d5c009 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -46,7 +46,7 @@
/// @param str Command line string to parse. Cannot contain "\n".
/// @param opts Optional parameters. Reserved for future use.
/// @param[out] err Error details, if any.
-/// @return Dictionary containing command information, with these keys:
+/// @return Dict containing command information, with these keys:
/// - cmd: (string) Command name.
/// - range: (array) (optional) Command range ([<line1>] [<line2>]).
/// Omitted if command doesn't accept a range.
@@ -63,13 +63,13 @@
/// - nargs: (string) Value of |:command-nargs|.
/// - nextcmd: (string) Next command if there are multiple commands separated by a |:bar|.
/// Empty if there isn't a next command.
-/// - magic: (dictionary) Which characters have special meaning in the command arguments.
+/// - magic: (dict) Which characters have special meaning in the command arguments.
/// - file: (boolean) The command expands filenames. Which means characters such as "%",
/// "#" and wildcards are expanded.
/// - bar: (boolean) The "|" character is treated as a command separator and the double
/// quote character (") is treated as the start of a comment.
-/// - mods: (dictionary) |:command-modifiers|.
-/// - filter: (dictionary) |:filter|.
+/// - mods: (dict) |:command-modifiers|.
+/// - filter: (dict) |:filter|.
/// - pattern: (string) Filter pattern. Empty string if there is no filter.
/// - force: (boolean) Whether filter is inverted or not.
/// - silent: (boolean) |:silent|.
@@ -230,12 +230,12 @@ Dict(cmd) nvim_parse_cmd(String str, Dict(empty) *opts, Arena *arena, Error *err
PUT_KEY(result, cmd, nextcmd, CSTR_AS_OBJ(ea.nextcmd));
// TODO(bfredl): nested keydict would be nice..
- Dictionary mods = arena_dict(arena, 20);
+ Dict mods = arena_dict(arena, 20);
- Dictionary filter = arena_dict(arena, 2);
+ Dict filter = arena_dict(arena, 2);
PUT_C(filter, "pattern", CSTR_TO_ARENA_OBJ(arena, cmdinfo.cmdmod.cmod_filter_pat));
PUT_C(filter, "force", BOOLEAN_OBJ(cmdinfo.cmdmod.cmod_filter_force));
- PUT_C(mods, "filter", DICTIONARY_OBJ(filter));
+ PUT_C(mods, "filter", DICT_OBJ(filter));
PUT_C(mods, "silent", BOOLEAN_OBJ(cmdinfo.cmdmod.cmod_flags & CMOD_SILENT));
PUT_C(mods, "emsg_silent", BOOLEAN_OBJ(cmdinfo.cmdmod.cmod_flags & CMOD_ERRSILENT));
@@ -272,7 +272,7 @@ Dict(cmd) nvim_parse_cmd(String str, Dict(empty) *opts, Arena *arena, Error *err
PUT_KEY(result, cmd, mods, mods);
- Dictionary magic = arena_dict(arena, 2);
+ Dict magic = arena_dict(arena, 2);
PUT_C(magic, "file", BOOLEAN_OBJ(cmdinfo.magic.file));
PUT_C(magic, "bar", BOOLEAN_OBJ(cmdinfo.magic.bar));
PUT_KEY(result, cmd, magic, magic);
@@ -284,7 +284,7 @@ end:
/// Executes an Ex command.
///
-/// Unlike |nvim_command()| this command takes a structured Dictionary instead of a String. This
+/// Unlike |nvim_command()| this command takes a structured Dict instead of a String. This
/// allows for easier construction and manipulation of an Ex command. This also allows for things
/// such as having spaces inside a command argument, expanding filenames in a command that otherwise
/// doesn't expand filenames, etc. Command arguments may also be Number, Boolean or String.
@@ -298,7 +298,7 @@ end:
/// @see |nvim_exec2()|
/// @see |nvim_command()|
///
-/// @param cmd Command to execute. Must be a Dictionary that can contain the same values as
+/// @param cmd Command to execute. Must be a Dict that can contain the same values as
/// the return value of |nvim_parse_cmd()| except "addr", "nargs" and "nextcmd"
/// which are ignored if provided. All values except for "cmd" are optional.
/// @param opts Optional parameters.
@@ -1166,7 +1166,7 @@ err:
/// @param[out] err Error details, if any.
///
/// @returns Map of maps describing commands.
-Dictionary nvim_get_commands(Dict(get_commands) *opts, Arena *arena, Error *err)
+Dict nvim_get_commands(Dict(get_commands) *opts, Arena *arena, Error *err)
FUNC_API_SINCE(4)
{
return nvim_buf_get_commands(-1, opts, arena, err);
@@ -1179,25 +1179,25 @@ Dictionary nvim_get_commands(Dict(get_commands) *opts, Arena *arena, Error *err)
/// @param[out] err Error details, if any.
///
/// @returns Map of maps describing commands.
-Dictionary nvim_buf_get_commands(Buffer buffer, Dict(get_commands) *opts, Arena *arena, Error *err)
+Dict nvim_buf_get_commands(Buffer buffer, Dict(get_commands) *opts, Arena *arena, Error *err)
FUNC_API_SINCE(4)
{
bool global = (buffer == -1);
if (ERROR_SET(err)) {
- return (Dictionary)ARRAY_DICT_INIT;
+ return (Dict)ARRAY_DICT_INIT;
}
if (global) {
if (opts->builtin) {
api_set_error(err, kErrorTypeValidation, "builtin=true not implemented");
- return (Dictionary)ARRAY_DICT_INIT;
+ return (Dict)ARRAY_DICT_INIT;
}
return commands_array(NULL, arena);
}
buf_T *buf = find_buffer_by_handle(buffer, err);
if (opts->builtin || !buf) {
- return (Dictionary)ARRAY_DICT_INIT;
+ return (Dict)ARRAY_DICT_INIT;
}
return commands_array(buf, arena);
}
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c
index a1af354577..6376011106 100644
--- a/src/nvim/api/deprecated.c
+++ b/src/nvim/api/deprecated.c
@@ -183,11 +183,11 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A
/// @param[out] err Error details, if any
/// @return Highlight definition map
/// @see nvim_get_hl_by_name
-Dictionary nvim_get_hl_by_id(Integer hl_id, Boolean rgb, Arena *arena, Error *err)
+Dict nvim_get_hl_by_id(Integer hl_id, Boolean rgb, Arena *arena, Error *err)
FUNC_API_SINCE(3)
FUNC_API_DEPRECATED_SINCE(9)
{
- Dictionary dic = ARRAY_DICT_INIT;
+ Dict dic = ARRAY_DICT_INIT;
VALIDATE_INT((syn_get_final_id((int)hl_id) != 0), "highlight id", hl_id, {
return dic;
});
@@ -204,11 +204,11 @@ Dictionary nvim_get_hl_by_id(Integer hl_id, Boolean rgb, Arena *arena, Error *er
/// @param[out] err Error details, if any
/// @return Highlight definition map
/// @see nvim_get_hl_by_id
-Dictionary nvim_get_hl_by_name(String name, Boolean rgb, Arena *arena, Error *err)
+Dict nvim_get_hl_by_name(String name, Boolean rgb, Arena *arena, Error *err)
FUNC_API_SINCE(3)
FUNC_API_DEPRECATED_SINCE(9)
{
- Dictionary result = ARRAY_DICT_INIT;
+ Dict result = ARRAY_DICT_INIT;
int id = syn_name2id(name.data);
VALIDATE_S((id != 0), "highlight name", name.data, {
@@ -515,7 +515,7 @@ static int64_t convert_index(int64_t index)
/// @param name Option name
/// @param[out] err Error details, if any
/// @return Option Information
-Dictionary nvim_get_option_info(String name, Arena *arena, Error *err)
+Dict nvim_get_option_info(String name, Arena *arena, Error *err)
FUNC_API_SINCE(7)
FUNC_API_DEPRECATED_SINCE(11)
{
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index d694b64f66..7786c30624 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -74,10 +74,10 @@ Integer nvim_create_namespace(String name)
/// Gets existing, non-anonymous |namespace|s.
///
/// @return dict that maps from names to namespace ids.
-Dictionary nvim_get_namespaces(Arena *arena)
+Dict nvim_get_namespaces(Arena *arena)
FUNC_API_SINCE(5)
{
- Dictionary retval = arena_dict(arena, map_size(&namespace_ids));
+ Dict retval = arena_dict(arena, map_size(&namespace_ids));
String name;
handle_T id;
@@ -158,7 +158,7 @@ static Array extmark_to_array(MTPair extmark, bool id, bool add_dict, bool hl_na
if (add_dict) {
// TODO(bfredl): coding the size like this is a bit fragile.
// We want ArrayOf(Dict(set_extmark)) as the return type..
- Dictionary dict = arena_dict(arena, ARRAY_SIZE(set_extmark_table));
+ Dict dict = arena_dict(arena, ARRAY_SIZE(set_extmark_table));
PUT_C(dict, "ns_id", INTEGER_OBJ((Integer)start.ns));
@@ -183,7 +183,7 @@ static Array extmark_to_array(MTPair extmark, bool id, bool add_dict, bool hl_na
decor_to_dict_legacy(&dict, mt_decor(start), hl_name, arena);
- ADD_C(rv, DICTIONARY_OBJ(dict));
+ ADD_C(rv, DICT_OBJ(dict));
}
return rv;
diff --git a/src/nvim/api/keysets_defs.h b/src/nvim/api/keysets_defs.h
index ce4e3d56e1..552612dd13 100644
--- a/src/nvim/api/keysets_defs.h
+++ b/src/nvim/api/keysets_defs.h
@@ -275,8 +275,8 @@ typedef struct {
String reg;
Boolean bang;
Array args;
- Dictionary magic;
- Dictionary mods;
+ Dict magic;
+ Dict mods;
Object nargs;
Object addr;
Object nextcmd;
@@ -293,7 +293,7 @@ typedef struct {
Boolean silent;
Boolean emsg_silent;
Boolean unsilent;
- Dictionary filter;
+ Dict filter;
Boolean sandbox;
Boolean noautocmd;
Boolean browse;
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 5adaff8449..1a0edd551e 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -256,13 +256,13 @@ void nvim_set_option_value(uint64_t channel_id, String name, Object value, Dict(
/// Gets the option information for all options.
///
-/// The dictionary has the full option names as keys and option metadata
-/// dictionaries as detailed at |nvim_get_option_info2()|.
+/// The dict has the full option names as keys and option metadata dicts as detailed at
+/// |nvim_get_option_info2()|.
///
/// @see |nvim_get_commands()|
///
-/// @return dictionary of all options
-Dictionary nvim_get_all_options_info(Arena *arena, Error *err)
+/// @return dict of all options
+Dict nvim_get_all_options_info(Arena *arena, Error *err)
FUNC_API_SINCE(7)
{
return get_all_vimoptions(arena);
@@ -270,7 +270,7 @@ Dictionary nvim_get_all_options_info(Arena *arena, Error *err)
/// Gets the option information for one option from arbitrary buffer or window
///
-/// Resulting dictionary has keys:
+/// Resulting dict has keys:
/// - name: Name of the option (like 'filetype')
/// - shortname: Shortened name of the option (like 'ft')
/// - type: type of option ("string", "number" or "boolean")
@@ -301,7 +301,7 @@ Dictionary nvim_get_all_options_info(Arena *arena, Error *err)
/// Implies {scope} is "local".
/// @param[out] err Error details, if any
/// @return Option Information
-Dictionary nvim_get_option_info2(String name, Dict(option) *opts, Arena *arena, Error *err)
+Dict nvim_get_option_info2(String name, Dict(option) *opts, Arena *arena, Error *err)
FUNC_API_SINCE(11)
{
OptIndex opt_idx = 0;
@@ -310,7 +310,7 @@ Dictionary nvim_get_option_info2(String name, Dict(option) *opts, Arena *arena,
void *from = NULL;
if (!validate_option_value_args(opts, name.data, &opt_idx, &scope, &req_scope, &from, NULL,
err)) {
- return (Dictionary)ARRAY_DICT_INIT;
+ return (Dict)ARRAY_DICT_INIT;
}
buf_T *buf = (req_scope == kOptReqBuf) ? (buf_T *)from : curbuf;
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index a1c5816a49..59e7373f68 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -94,8 +94,7 @@ static Object typval_cbuf_to_obj(EncodedData *edata, const char *data, size_t le
kvi_push(edata->stack, ARRAY_OBJ(((Array) { .capacity = 0, .size = 0 })))
#define TYPVAL_ENCODE_CONV_EMPTY_DICT(tv, dict) \
- kvi_push(edata->stack, \
- DICTIONARY_OBJ(((Dictionary) { .capacity = 0, .size = 0 })))
+ kvi_push(edata->stack, DICT_OBJ(((Dict) { .capacity = 0, .size = 0 })))
static inline void typval_encode_list_start(EncodedData *const edata, const size_t len)
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
@@ -137,7 +136,7 @@ static inline void typval_encode_list_end(EncodedData *const edata)
static inline void typval_encode_dict_start(EncodedData *const edata, const size_t len)
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
{
- kvi_push(edata->stack, DICTIONARY_OBJ(arena_dict(edata->arena, len)));
+ kvi_push(edata->stack, DICT_OBJ(arena_dict(edata->arena, len)));
}
#define TYPVAL_ENCODE_CONV_DICT_START(tv, dict, len) \
@@ -152,13 +151,13 @@ static inline void typval_encode_after_key(EncodedData *const edata)
{
Object key = kv_pop(edata->stack);
Object *const dict = &kv_last(edata->stack);
- assert(dict->type == kObjectTypeDictionary);
- assert(dict->data.dictionary.size < dict->data.dictionary.capacity);
+ assert(dict->type == kObjectTypeDict);
+ assert(dict->data.dict.size < dict->data.dict.capacity);
if (key.type == kObjectTypeString) {
- dict->data.dictionary.items[dict->data.dictionary.size].key
+ dict->data.dict.items[dict->data.dict.size].key
= key.data.string;
} else {
- dict->data.dictionary.items[dict->data.dictionary.size].key
+ dict->data.dict.items[dict->data.dict.size].key
= STATIC_CSTR_AS_STRING("__INVALID_KEY__");
}
}
@@ -171,9 +170,9 @@ static inline void typval_encode_between_dict_items(EncodedData *const edata)
{
Object val = kv_pop(edata->stack);
Object *const dict = &kv_last(edata->stack);
- assert(dict->type == kObjectTypeDictionary);
- assert(dict->data.dictionary.size < dict->data.dictionary.capacity);
- dict->data.dictionary.items[dict->data.dictionary.size++].value = val;
+ assert(dict->type == kObjectTypeDict);
+ assert(dict->data.dict.size < dict->data.dict.capacity);
+ dict->data.dict.items[dict->data.dict.size++].value = val;
}
#define TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS(tv, dict) \
@@ -185,7 +184,7 @@ static inline void typval_encode_dict_end(EncodedData *const edata)
typval_encode_between_dict_items(edata);
#ifndef NDEBUG
const Object *const dict = &kv_last(edata->stack);
- assert(dict->data.dictionary.size == dict->data.dictionary.capacity);
+ assert(dict->data.dict.size == dict->data.dict.capacity);
#endif
}
@@ -325,11 +324,11 @@ void object_to_vim_take_luaref(Object *obj, typval_T *tv, bool take_luaref, Erro
break;
}
- case kObjectTypeDictionary: {
+ case kObjectTypeDict: {
dict_T *const dict = tv_dict_alloc();
- for (uint32_t i = 0; i < obj->data.dictionary.size; i++) {
- KeyValuePair *item = &obj->data.dictionary.items[i];
+ for (uint32_t i = 0; i < obj->data.dict.size; i++) {
+ KeyValuePair *item = &obj->data.dict.items[i];
String key = item->key;
dictitem_T *const di = tv_dict_item_alloc(key.data);
object_to_vim_take_luaref(&item->value, &di->di_tv, take_luaref, err);
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index ac3404cf86..26d5ac09a8 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -17,7 +17,7 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# define ArrayOf(...) Array
-# define DictionaryOf(...) Dictionary
+# define DictOf(...) Dict
# define Dict(name) KeyDict_##name
# define DictHash(name) KeyDict_##name##_get_field
# define DictKey(name)
@@ -88,7 +88,7 @@ typedef struct object Object;
typedef kvec_t(Object) Array;
typedef struct key_value_pair KeyValuePair;
-typedef kvec_t(KeyValuePair) Dictionary;
+typedef kvec_t(KeyValuePair) Dict;
typedef kvec_t(String) StringArray;
@@ -99,7 +99,7 @@ typedef enum {
kObjectTypeFloat,
kObjectTypeString,
kObjectTypeArray,
- kObjectTypeDictionary,
+ kObjectTypeDict,
kObjectTypeLuaRef,
// EXT types, cannot be split or reordered, see #EXT_OBJECT_TYPE_SHIFT
kObjectTypeBuffer,
@@ -127,7 +127,7 @@ struct object {
Float floating;
String string;
Array array;
- Dictionary dictionary;
+ Dict dict;
LuaRef luaref;
} data;
};
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 23119f7ada..e1fb4ed732 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -198,7 +198,7 @@ dictitem_T *dict_check_writable(dict_T *dict, String key, bool del, Error *err)
api_set_error(err, kErrorTypeException, "Key is fixed: %s", key.data);
}
} else if (dict->dv_lock) {
- api_set_error(err, kErrorTypeException, "Dictionary is locked");
+ api_set_error(err, kErrorTypeException, "Dict is locked");
} else if (key.size == 0) {
api_set_error(err, kErrorTypeValidation, "Key name is empty");
} else if (key.size > INT_MAX) {
@@ -551,9 +551,9 @@ Array arena_array(Arena *arena, size_t max_size)
return arr;
}
-Dictionary arena_dict(Arena *arena, size_t max_size)
+Dict arena_dict(Arena *arena, size_t max_size)
{
- Dictionary dict = ARRAY_DICT_INIT;
+ Dict dict = ARRAY_DICT_INIT;
kv_fixsize_arena(arena, dict, max_size);
return dict;
}
@@ -596,8 +596,8 @@ void api_free_object(Object value)
api_free_array(value.data.array);
break;
- case kObjectTypeDictionary:
- api_free_dictionary(value.data.dictionary);
+ case kObjectTypeDict:
+ api_free_dict(value.data.dict);
break;
case kObjectTypeLuaRef:
@@ -615,7 +615,7 @@ void api_free_array(Array value)
xfree(value.items);
}
-void api_free_dictionary(Dictionary value)
+void api_free_dict(Dict value)
{
for (size_t i = 0; i < value.size; i++) {
api_free_string(value.items[i].key);
@@ -648,7 +648,7 @@ Object api_metadata(void)
Arena arena = ARENA_EMPTY;
Error err = ERROR_INIT;
metadata = unpack((char *)packed_api_metadata, sizeof(packed_api_metadata), &arena, &err);
- if (ERROR_SET(&err) || metadata.type != kObjectTypeDictionary) {
+ if (ERROR_SET(&err) || metadata.type != kObjectTypeDict) {
abort();
}
mem_for_metadata = arena_finish(&arena);
@@ -684,9 +684,9 @@ Array copy_array(Array array, Arena *arena)
return rv;
}
-Dictionary copy_dictionary(Dictionary dict, Arena *arena)
+Dict copy_dict(Dict dict, Arena *arena)
{
- Dictionary rv = arena_dict(arena, dict.size);
+ Dict rv = arena_dict(arena, dict.size);
for (size_t i = 0; i < dict.size; i++) {
KeyValuePair item = dict.items[i];
PUT_C(rv, copy_string(item.ke