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)
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 035c731..fa5ee3c 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -29,7 +29,7 @@
call CheckDefFailure(['let x:string = "x"'], 'E1069:')
call CheckDefFailure(['let a:string = "x"'], 'E1069:')
- let a: number = 6
+ let a: number = 6 #comment
assert_equal(6, a)
if has('channel')
@@ -44,7 +44,7 @@
let Funky2: func = function('len')
let Party2: func = funcref('g:Test_syntax')
- g:newvar = 'new'
+ g:newvar = 'new' #comment
assert_equal('new', g:newvar)
assert_equal('yes', g:existing)
@@ -821,6 +821,22 @@
set errorformat&
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')
let someJob = test_null_job()
diff --git a/src/version.c b/src/version.c
index 24ce5e8..e1df007 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1246,
+/**/
1245,
/**/
1244,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 4b569f9..31cb31e 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5706,7 +5706,7 @@
goto theend;
}
- ret = end;
+ ret = skipwhite(end);
theend:
vim_free(name);