diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-20 07:34:50 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-09-23 14:42:57 +0200 |
commit | 737f58e23230ea14f1648ac1fc7f442ea0f8563c (patch) | |
tree | d16bee4c0ad2bb5ff2ec058cd09133a285674fef /src/nvim/eval | |
parent | 5acdc4499e2036c90172b2b085f207ee4d5cfee4 (diff) | |
download | rneovim-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/eval')
-rw-r--r-- | src/nvim/eval/funcs.c | 6 | ||||
-rw-r--r-- | src/nvim/eval/typval_defs.h | 6 | ||||
-rw-r--r-- | src/nvim/eval/typval_encode.c.h | 3 | ||||
-rw-r--r-- | src/nvim/eval/userfunc.c | 6 | ||||
-rw-r--r-- | src/nvim/eval/userfunc.h | 8 | ||||
-rw-r--r-- | src/nvim/eval/vars.c | 4 |
6 files changed, 16 insertions, 17 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index ef638802ad..e8b9288717 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -995,9 +995,9 @@ static void f_ctxget(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } Arena arena = ARENA_EMPTY; - Dictionary ctx_dict = ctx_to_dict(ctx, &arena); + Dict ctx_dict = ctx_to_dict(ctx, &arena); Error err = ERROR_INIT; - object_to_vim(DICTIONARY_OBJ(ctx_dict), rettv, &err); + object_to_vim(DICT_OBJ(ctx_dict), rettv, &err); arena_mem_free(arena_finish(&arena)); api_clear_error(&err); } @@ -1067,7 +1067,7 @@ static void f_ctxset(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) did_emsg = false; Arena arena = ARENA_EMPTY; - Dictionary dict = vim_to_object(&argvars[0], &arena, true).data.dictionary; + Dict dict = vim_to_object(&argvars[0], &arena, true).data.dict; Context tmp = CONTEXT_INIT; Error err = ERROR_INIT; ctx_from_dict(dict, &tmp, &err); diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index e88e6a222a..1ec7631c4b 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -109,7 +109,7 @@ typedef enum { VAR_STRING, ///< String, .v_string is used. VAR_FUNC, ///< Function reference, .v_string is used as function name. VAR_LIST, ///< List, .v_list is used. - VAR_DICT, ///< Dictionary, .v_dict is used. + VAR_DICT, ///< Dict, .v_dict is used. VAR_FLOAT, ///< Floating-point value, .v_float is used. VAR_BOOL, ///< true, false VAR_SPECIAL, ///< Special value (null), .v_special is used. @@ -141,7 +141,7 @@ typedef struct { float_T v_float; ///< Floating-point number, for VAR_FLOAT. char *v_string; ///< String, for VAR_STRING and VAR_FUNC, can be NULL. list_T *v_list; ///< List for VAR_LIST, can be NULL. - dict_T *v_dict; ///< Dictionary for VAR_DICT, can be NULL. + dict_T *v_dict; ///< Dict for VAR_DICT, can be NULL. partial_T *v_partial; ///< Closure: function with args. blob_T *v_blob; ///< Blob for VAR_BLOB, can be NULL. } vval; ///< Actual value. @@ -259,7 +259,7 @@ struct dictvar_S { dict_T *dv_copydict; ///< Copied dict used by deepcopy(). dict_T *dv_used_next; ///< Next dictionary in used dictionaries list. dict_T *dv_used_prev; ///< Previous dictionary in used dictionaries list. - QUEUE watchers; ///< Dictionary key watchers set by user code. + QUEUE watchers; ///< Dict key watchers set by user code. LuaRef lua_table_ref; }; diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index 3a78fc5afd..c0e994562c 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -173,8 +173,7 @@ /// point to a special dictionary. /// @param dict Converted dictionary, lvalue or #TYPVAL_ENCODE_NODICT_VAR /// (for dictionaries represented as special lists). -/// @param len Dictionary length. Is an expression which evaluates to an -/// integer. +/// @param len Dict length. Is an expression which evaluates to an integer. /// @def TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START /// @brief Macros used after pushing dictionary onto the stack diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index d2bae72531..4f1098632c 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -955,7 +955,7 @@ void remove_funccal(void) /// @param[out] rettv Return value. /// @param[in] firstline First line of range. /// @param[in] lastline Last line of range. -/// @param selfdict Dictionary for "self" for dictionary functions. +/// @param selfdict Dict for "self" for dictionary functions. void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict) FUNC_ATTR_NONNULL_ARG(1, 3, 4) @@ -1922,7 +1922,7 @@ static int list_func_head(ufunc_T *fp, bool indent, bool force) } /// Get a function name, translating "<SID>" and "<SNR>". -/// Also handles a Funcref in a List or Dictionary. +/// Also handles a Funcref in a List or Dict. /// flags: /// TFN_INT: internal function name OK /// TFN_QUIET: be quiet @@ -3242,7 +3242,7 @@ static int ex_call_inner(exarg_T *eap, char *name, char **arg, char *startarg, break; } - // Handle a function returning a Funcref, Dictionary or List. + // Handle a function returning a Funcref, Dict or List. if (handle_subscript((const char **)arg, &rettv, &EVALARG_EVALUATE, true) == FAIL) { failed = true; break; diff --git a/src/nvim/eval/userfunc.h b/src/nvim/eval/userfunc.h index b3488b15a7..0a27403a4b 100644 --- a/src/nvim/eval/userfunc.h +++ b/src/nvim/eval/userfunc.h @@ -32,9 +32,9 @@ /// Structure used by trans_function_name() typedef struct { - dict_T *fd_dict; ///< Dictionary used. - char *fd_newkey; ///< New key in "dict" in allocated memory. - dictitem_T *fd_di; ///< Dictionary item used. + dict_T *fd_dict; ///< Dict used. + char *fd_newkey; ///< New key in "dict" in allocated memory. + dictitem_T *fd_di; ///< Dict item used. } funcdict_T; typedef struct funccal_entry funccal_entry_T; @@ -69,7 +69,7 @@ typedef struct { bool *fe_doesrange; ///< [out] if not NULL: function handled range bool fe_evaluate; ///< actually evaluate expressions partial_T *fe_partial; ///< for extra arguments - dict_T *fe_selfdict; ///< Dictionary for "self" + dict_T *fe_selfdict; ///< Dict for "self" typval_T *fe_basetv; ///< base for base->method() bool fe_found_var; ///< if the function is not found then give an ///< error that a variable is not callable. diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 3a5d056a9a..a33636667e 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1108,7 +1108,7 @@ static int do_unlet_var(lval_T *lp, char *name_end, exarg_T *eap, int deep FUNC_ // unlet a List item. tv_list_item_remove(lp->ll_list, lp->ll_li); } else { - // unlet a Dictionary item. + // unlet a Dict item. dict_T *d = lp->ll_dict; assert(d != NULL); dictitem_T *di = lp->ll_di; @@ -1283,7 +1283,7 @@ static int do_lock_var(lval_T *lp, char *name_end FUNC_ATTR_UNUSED, exarg_T *eap // (un)lock a List item. tv_item_lock(TV_LIST_ITEM_TV(lp->ll_li), deep, lock, false); } else { - // (un)lock a Dictionary item. + // (un)lock a Dict item. tv_item_lock(&lp->ll_di->di_tv, deep, lock, false); } |