diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 2 | ||||
-rw-r--r-- | src/nvim/eval.h | 2 | ||||
-rw-r--r-- | src/nvim/eval/encode.c | 5 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 204c0fb1ef..aaad9fab34 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -379,6 +379,8 @@ static struct vimvar { VV(VV_FALSE, "false", VAR_SPECIAL, VV_RO), VV(VV_TRUE, "true", VAR_SPECIAL, VV_RO), VV(VV_NULL, "null", VAR_SPECIAL, VV_RO), + VV(VV__NULL_LIST, "_null_list", VAR_LIST, VV_RO), + VV(VV__NULL_DICT, "_null_dict", VAR_DICT, VV_RO), }; #undef VV diff --git a/src/nvim/eval.h b/src/nvim/eval.h index f81eb5d063..d6800afd52 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -122,6 +122,8 @@ typedef enum { VV_FALSE, VV_TRUE, VV_NULL, + VV__NULL_LIST, // List with NULL value. For test purposes only. + VV__NULL_DICT, // Dictionary with NULL value. For test purposes only. } VimVarIndex; /// All recognized msgpack types diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index 0bde6562b8..88c731e92a 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -287,6 +287,9 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, (val)->copyID_attr = copyID; \ } while (0) +#define TV_STRLEN(tv) \ + (tv->vval.v_string == NULL ? 0 : STRLEN(tv->vval.v_string)) + /// Define functions which convert VimL value to something else /// /// Creates function `vim_to_{name}(firstargtype firstargname, typval_T *const @@ -306,7 +309,7 @@ static int name##_convert_one_value(firstargtype firstargname, \ { \ switch (tv->v_type) { \ case VAR_STRING: { \ - CONV_STRING(tv->vval.v_string, STRLEN(tv->vval.v_string)); \ + CONV_STRING(tv->vval.v_string, TV_STRLEN(tv)); \ break; \ } \ case VAR_NUMBER: { \ |