aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/encode.c
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-10-28 22:44:42 -0700
committerJames McCoy <jamessan@jamessan.com>2016-12-12 10:17:35 -0500
commitbae31b764a5607fad5d914f271e93e10c2d0bfbe (patch)
treee3af8d044005cd673f90ba33974675f92ef4347b /src/nvim/eval/encode.c
parent3213b28c01313c7f0e7e0e01f72a0fbfef85fa3e (diff)
downloadrneovim-bae31b764a5607fad5d914f271e93e10c2d0bfbe.tar.gz
rneovim-bae31b764a5607fad5d914f271e93e10c2d0bfbe.tar.bz2
rneovim-bae31b764a5607fad5d914f271e93e10c2d0bfbe.zip
vim-patch:7.4.1608
Problem: string() doesn't handle a partial. Solution: Make a string from a partial. https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Diffstat (limited to 'src/nvim/eval/encode.c')
-rw-r--r--src/nvim/eval/encode.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 57507f4430..65570a6f30 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -317,9 +317,32 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_PARTIAL(partial) \
do { \
- ga_concat(gap, "partial("); \
- TYPVAL_ENCODE_CONV_STRING(partial, STRLEN(partial)); \
- ga_append(gap, ')'); \
+ partial_T *pt = tv->vval.v_partial; \
+ garray_T ga; \
+ int i; \
+ ga_init(&ga, 1, 100); \
+ ga_concat(&ga, (char_u *)"function("); \
+ if (&pt->pt_name != NULL) { \
+ TYPVAL_ENCODE_CONV_STRING((char *)pt->pt_name, sizeof(pt->pt_name)); \
+ } \
+ if (pt != NULL && pt->pt_argc > 0) { \
+ ga_concat(&ga, (char_u *)", ["); \
+ for (i = 0; i < pt->pt_argc; i++) { \
+ if (i > 0) { \
+ ga_concat(&ga, (char_u *)", "); \
+ } \
+ ga_concat(&ga, encode_tv2string(&pt->pt_argv[i], NULL)); \
+ } \
+ ga_concat(&ga, (char_u *)"]"); \
+ } \
+ if (pt != NULL && pt->pt_dict != NULL) { \
+ typval_T dtv; \
+ ga_concat(&ga, (char_u *)", "); \
+ dtv.v_type = VAR_DICT; \
+ dtv.vval.v_dict = pt->pt_dict; \
+ ga_concat(&ga, encode_tv2string(&dtv, NULL)); \
+ } \
+ ga_concat(&ga, (char_u *)")"); \
} while (0)
#define TYPVAL_ENCODE_CONV_EMPTY_LIST() \