changeset 21658:140a9082f87c v8.2.1379

patch 8.2.1379: curly braces expression ending in " }" does not work Commit: https://github.com/vim/vim/commit/ae95a3946b012d4e68bcb20b28f691f6d3b9caaf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 6 16:38:12 2020 +0200 patch 8.2.1379: curly braces expression ending in " }" does not work Problem: Curly braces expression ending in " }" does not work. Solution: Skip over white space when checking for "}". (closes https://github.com/vim/vim/issues/6634)
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Aug 2020 16:45:04 +0200
parents bd3b9e792ad6
children e7e3d2a0df51
files src/dict.c src/testdir/test_eval_stuff.vim src/version.c
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -817,7 +817,7 @@ eval_dict(char_u **arg, typval_T *rettv,
     {
 	if (eval1(&start, &tv, NULL) == FAIL)	// recursive!
 	    return FAIL;
-	if (*start == '}')
+	if (*skipwhite(start) == '}')
 	    return NOTDONE;
     }
 
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -532,4 +532,26 @@ func Test_setreg_basic()
   call assert_fails('call setreg(1, ["", "", [], ""])', 'E730:')
 endfunc
 
+func Test_curly_assignment()
+  let s:svar = 'svar'
+  let g:gvar = 'gvar'
+  let lname = 'gvar'
+  let gname = 'gvar'
+  let {'s:'.lname} = {'g:'.gname}
+  call assert_equal('gvar', s:gvar)
+  let s:gvar = ''
+  let { 's:'.lname } = { 'g:'.gname }
+  call assert_equal('gvar', s:gvar)
+  let s:gvar = ''
+  let { 's:' . lname } = { 'g:' . gname }
+  call assert_equal('gvar', s:gvar)
+  let s:gvar = ''
+  let { 's:' .. lname } = { 'g:' .. gname }
+  call assert_equal('gvar', s:gvar)
+
+  unlet s:svar
+  unlet s:gvar
+  unlet g:gvar
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1379,
+/**/
     1378,
 /**/
     1377,