diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-10 21:30:49 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-11 15:33:19 +0100 |
commit | dda977f5c4d2fc81a0582fbaec7a6397aaf7aebf (patch) | |
tree | fe8c0ed33a2c06f116cdee5d14c6c5df54d5e216 /src | |
parent | 34cb0879551b8217db820f684d913a393f4f38cb (diff) | |
download | rneovim-dda977f5c4d2fc81a0582fbaec7a6397aaf7aebf.tar.gz rneovim-dda977f5c4d2fc81a0582fbaec7a6397aaf7aebf.tar.bz2 rneovim-dda977f5c4d2fc81a0582fbaec7a6397aaf7aebf.zip |
vim-patch:8.1.1722: error when scriptversion is 2 a making a dictionary access
Problem: Error when scriptversion is 2 a making a dictionary access.
Solution: Parse the subscript even when not evaluating the sub-expression.
(closes vim/vim#4704)
https://github.com/vim/vim/commit/61343f0c44c8e71df04918d033e0a744c0b7f8aa
:scriptversion is N/A.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index fbafe42eb2..dfbb187b5b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1456,21 +1456,18 @@ static void ex_let_const(exarg_T *eap, const bool is_const) /* * Assign the typevalue "tv" to the variable or variables at "arg_start". * Handles both "var" with any type and "[var, var; var]" with a list type. - * When "nextchars" is not NULL it points to a string with characters that + * When "op" is not NULL it points to a string with characters that * must appear after the variable(s). Use "+", "-" or "." for add, subtract * or concatenate. * Returns OK or FAIL; */ -static int -ex_let_vars( - char_u *arg_start, - typval_T *tv, - int copy, // copy values from "tv", don't move - int semicolon, // from skip_var_list() - int var_count, // from skip_var_list() - int is_const, // lock variables for :const - char_u *nextchars -) +static int ex_let_vars(char_u *arg_start, + typval_T *tv, + int copy, // copy values from "tv", don't move + int semicolon, // from skip_var_list() + int var_count, // from skip_var_list() + int is_const, // lock variables for :const + char_u *op) { char_u *arg = arg_start; typval_T ltv; @@ -1479,7 +1476,7 @@ ex_let_vars( /* * ":let var = expr" or ":for var in list" */ - if (ex_let_one(arg, tv, copy, is_const, nextchars, nextchars) == NULL) { + if (ex_let_one(arg, tv, copy, is_const, op, op) == NULL) { return FAIL; } return OK; @@ -1510,7 +1507,7 @@ ex_let_vars( while (*arg != ']') { arg = skipwhite(arg + 1); arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), true, is_const, - (const char_u *)",;]", nextchars); + (const char_u *)",;]", op); if (arg == NULL) { return FAIL; } @@ -1532,8 +1529,8 @@ ex_let_vars( ltv.vval.v_list = rest_list; tv_list_ref(rest_list); - arg = ex_let_one(skipwhite(arg + 1), <v, false, is_const, - (char_u *)"]", nextchars); + arg = ex_let_one(skipwhite(arg + 1), <v, false, is_const, (char_u *)"]", + op); tv_clear(<v); if (arg == NULL) { return FAIL; @@ -8675,6 +8672,7 @@ handle_subscript( } } + // "." is ".name" lookup when we found a dict. while (ret == OK && (((**arg == '[' || (**arg == '.' && rettv->v_type == VAR_DICT) || (**arg == '(' && (!evaluate || tv_is_func(*rettv)))) |