0
0
mirror of https://github.com/vim/vim.git synced 2025-10-18 07:54:29 -04:00

patch 8.2.1246: Vim9: comment after assignment doesn't work

Problem:    Vim9: comment after assignment doesn't work.
Solution:   Skip over white space. (closes #6481)
This commit is contained in:
Bram Moolenaar
2020-07-19 17:17:02 +02:00
parent f398238a37
commit b209750b5e
3 changed files with 21 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ def Test_assignment()
call CheckDefFailure(['let x:string = "x"'], 'E1069:') call CheckDefFailure(['let x:string = "x"'], 'E1069:')
call CheckDefFailure(['let a:string = "x"'], 'E1069:') call CheckDefFailure(['let a:string = "x"'], 'E1069:')
let a: number = 6 let a: number = 6 #comment
assert_equal(6, a) assert_equal(6, a)
if has('channel') if has('channel')
@@ -44,7 +44,7 @@ def Test_assignment()
let Funky2: func = function('len') let Funky2: func = function('len')
let Party2: func = funcref('g:Test_syntax') let Party2: func = funcref('g:Test_syntax')
g:newvar = 'new' g:newvar = 'new' #comment
assert_equal('new', g:newvar) assert_equal('new', g:newvar)
assert_equal('yes', g:existing) assert_equal('yes', g:existing)
@@ -821,6 +821,22 @@ def Test_cexpr_vimscript()
set errorformat& set errorformat&
enddef enddef
def Test_list_vimscript()
# checks line continuation and comments
let lines =<< trim END
vim9script
let mylist = [
'one',
# comment
'two', # empty line follows
'three',
]
assert_equal(['one', 'two', 'three'], mylist)
END
CheckScriptSuccess(lines)
enddef
if has('channel') if has('channel')
let someJob = test_null_job() let someJob = test_null_job()

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1246,
/**/ /**/
1245, 1245,
/**/ /**/

View File

@@ -5706,7 +5706,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
goto theend; goto theend;
} }
ret = end; ret = skipwhite(end);
theend: theend:
vim_free(name); vim_free(name);