diff options
author | ZyX <kp-pav@yandex.ru> | 2016-05-09 20:04:22 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-06-24 16:53:26 +0300 |
commit | f2f9ab6f3578447a1c30988f5e9930a655277202 (patch) | |
tree | 36d1a1d66b3cef3387be3c1acf14528e41ea0b03 /src/nvim/eval/typval_encode.h | |
parent | e07da3a71ba2586b0919ba4517de6e5b056f3b37 (diff) | |
download | rneovim-f2f9ab6f3578447a1c30988f5e9930a655277202.tar.gz rneovim-f2f9ab6f3578447a1c30988f5e9930a655277202.tar.bz2 rneovim-f2f9ab6f3578447a1c30988f5e9930a655277202.zip |
eval: Also make clear_tv non-recursive
Diffstat (limited to 'src/nvim/eval/typval_encode.h')
-rw-r--r-- | src/nvim/eval/typval_encode.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/eval/typval_encode.h b/src/nvim/eval/typval_encode.h index e73a1ce057..98fa7b26c6 100644 --- a/src/nvim/eval/typval_encode.h +++ b/src/nvim/eval/typval_encode.h @@ -104,7 +104,7 @@ /// @brief Macros used to check special dictionary key /// /// @param label Label for goto in case check was not successfull. -/// @param kv_pair List with two elements: key and value. +/// @param key typval_T key to check. /// @def TYPVAL_ENCODE_CONV_DICT_AFTER_KEY /// @brief Macros used after finishing converting dictionary key @@ -154,6 +154,7 @@ typedef enum { /// Structure representing current VimL to messagepack conversion state typedef struct { MPConvStackValType type; ///< Type of the stack entry. + typval_T *tv; ///< Currently converted typval_T. union { struct { dict_T *dict; ///< Currently converted dictionary. @@ -217,10 +218,10 @@ static inline size_t tv_strlen(const typval_T *const tv) /// tv)` which returns OK or FAIL and helper functions. /// /// @param scope Scope of the main function: either nothing or `static`. +/// @param name Name of the target converter. /// @param firstargtype Type of the first argument. It will be used to return /// the results. /// @param firstargname Name of the first argument. -/// @param name Name of the target converter. #define TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(scope, name, firstargtype, \ firstargname) \ static int name##_convert_one_value(firstargtype firstargname, \ @@ -257,6 +258,7 @@ static int name##_convert_one_value(firstargtype firstargname, \ TYPVAL_ENCODE_CONV_LIST_START(tv->vval.v_list->lv_len); \ _mp_push(*mpstack, ((MPConvStackVal) { \ .type = kMPConvList, \ + .tv = tv, \ .data = { \ .l = { \ .list = tv->vval.v_list, \ @@ -387,6 +389,7 @@ static int name##_convert_one_value(firstargtype firstargname, \ lv_copyID, kMPConvList); \ TYPVAL_ENCODE_CONV_LIST_START(val_di->di_tv.vval.v_list->lv_len); \ _mp_push(*mpstack, ((MPConvStackVal) { \ + .tv = tv, \ .type = kMPConvList, \ .data = { \ .l = { \ @@ -417,6 +420,7 @@ static int name##_convert_one_value(firstargtype firstargname, \ kMPConvPairs); \ TYPVAL_ENCODE_CONV_DICT_START(val_list->lv_len); \ _mp_push(*mpstack, ((MPConvStackVal) { \ + .tv = tv, \ .type = kMPConvPairs, \ .data = { \ .l = { \ @@ -457,6 +461,7 @@ name##_convert_one_value_regular_dict: \ kMPConvDict); \ TYPVAL_ENCODE_CONV_DICT_START(tv->vval.v_dict->dv_hashtab.ht_used); \ _mp_push(*mpstack, ((MPConvStackVal) { \ + .tv = tv, \ .type = kMPConvDict, \ .data = { \ .d = { \ @@ -537,7 +542,7 @@ scope int encode_vim_to_##name(firstargtype firstargname, typval_T *const tv, \ } \ const list_T *const kv_pair = cur_mpsv->data.l.li->li_tv.vval.v_list; \ TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK( \ - encode_vim_to_##name##_error_ret, kv_pair); \ + encode_vim_to_##name##_error_ret, kv_pair->lv_first->li_tv); \ if (name##_convert_one_value(firstargname, &mpstack, \ &kv_pair->lv_first->li_tv, copyID, \ objname) == FAIL) { \ |