Patch 8.2.1293
Problem: Vim9: :execute mixes up () expression and function call.
Solution: Do not skip white space when looking for the "(". (closes #6531)
Files: src/vim9compile.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1292/src/vim9compile.c 2020-07-23 22:41:39.779937421 +0200
--- src/vim9compile.c 2020-07-25 19:18:14.995776840 +0200
***************
*** 3755,3761 ****
}
}
! if (*p == '(')
{
garray_T *stack = &cctx->ctx_type_stack;
type_T *type;
--- 3755,3763 ----
}
}
! // Do not skip over white space to find the "(", "exeucte 'x' ()" is
! // not a function call.
! if (**arg == '(')
{
garray_T *stack = &cctx->ctx_type_stack;
type_T *type;
*** ../vim-8.2.1292/src/testdir/test_vim9_script.vim 2020-07-25
15:41:04.408638663 +0200
--- src/testdir/test_vim9_script.vim 2020-07-25 19:27:17.304934434 +0200
***************
*** 1708,1713 ****
--- 1708,1717 ----
assert_equal('execute-var-var', getline(1))
bwipe!
+ let n = true
+ execute 'echomsg' (n ? '"true"' : '"no"')
+ assert_match('^true$', Screenline(&lines))
+
call CheckDefFailure(['execute xxx'], 'E1001:')
call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
enddef
***************
*** 2634,2639 ****
--- 2638,2669 ----
quit
enddef
+ " test using a vim9script that is auto-loaded from an autocmd
+ def Test_vim9_autoload()
+ let lines =<< trim END
+ vim9script
+ def foo#test()
+ echomsg getreg('"')
+ enddef
+ END
+
+ mkdir('Xdir/autoload', 'p')
+ writefile(lines, 'Xdir/autoload/foo.vim')
+ let save_rtp = &rtp
+ exe 'set rtp^=' .. getcwd() .. '/Xdir'
+ augroup test
+ autocmd TextYankPost * call foo#test()
+ augroup END
+
+ normal Y
+
+ augroup test
+ autocmd!
+ augroup END
+ delete('Xdir', 'rf')
+ &rtp = save_rtp
+ enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new
*** ../vim-8.2.1292/src/version.c 2020-07-25 16:53:07.938737495 +0200
--- src/version.c 2020-07-25 17:35:40.996621160 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1293,
/**/
--
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
is a no brainer -- although a bit painful for your kids.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202007251739.06PHd44u372369%40masaka.moolenaar.net.