diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-08 08:47:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-08 08:47:01 +0800 |
commit | e93f22f28abe8f774c5e081073cb2eac0f5085fd (patch) | |
tree | f5235ef14dce746338bf8fb12a3b0c0d5facb788 /src/nvim/eval.c | |
parent | ead524656dc1664622f80509a983519a190ca48a (diff) | |
parent | 4a67f9d386bb16149eecf32f45a3cb73878f12e7 (diff) | |
download | rneovim-e93f22f28abe8f774c5e081073cb2eac0f5085fd.tar.gz rneovim-e93f22f28abe8f774c5e081073cb2eac0f5085fd.tar.bz2 rneovim-e93f22f28abe8f774c5e081073cb2eac0f5085fd.zip |
Merge pull request #20110 from ii14/vim-7c7e1e9b98d4
vim-patch:8.2.3702,9.0.0409
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 0c41381313..aa2849279e 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2997,7 +2997,9 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string) // decimal, hex or octal number vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0, true); if (len == 0) { - semsg(_(e_invexpr2), *arg); + if (evaluate) { + semsg(_(e_invexpr2), *arg); + } ret = FAIL; break; } @@ -4582,21 +4584,20 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal) { typval_T tv; char *key = NULL; - char *start = skipwhite(*arg + 1); + char *curly_expr = skipwhite(*arg + 1); char buf[NUMBUFLEN]; - // First check if it's not a curly-braces thing: {expr}. + // First check if it's not a curly-braces expression: {expr}. // Must do this without evaluating, otherwise a function may be called // twice. Unfortunately this means we need to call eval1() twice for the // first item. - // But {} is an empty Dictionary. - if (*start != '}') { - if (eval1(&start, &tv, false) == FAIL) { // recursive! - return FAIL; - } - if (*skipwhite(start) == '}') { - return NOTDONE; - } + // "{}" is an empty Dictionary. + // "#{abc}" is never a curly-braces expression. + if (*curly_expr != '}' + && !literal + && eval1(&curly_expr, &tv, false) == OK + && *skipwhite(curly_expr) == '}') { + return NOTDONE; } dict_T *d = NULL; |