Patch 9.0.0799
Problem: In compiled function ->() on next line not recognized.
Solution: Also check for "(". (closes #11405)
Files: src/vim9expr.c, src/testdir/test_lambda.vim
*** ../vim-9.0.0798/src/vim9expr.c 2022-10-17 13:13:28.705183595 +0100
--- src/vim9expr.c 2022-10-19 18:03:32.803690272 +0100
***************
*** 1788,1799 ****
{
char_u *next = peek_next_line_from_context(cctx);
! // If a following line starts with "->{" or "->X" advance to that
! // line, so that a line break before "->" is allowed.
// Also if a following line starts with ".x".
if (next != NULL &&
((next[0] == '-' && next[1] == '>'
&& (next[2] == '{'
|| ASCII_ISALPHA(*skipwhite(next + 2))))
|| (next[0] == '.' && eval_isdictc(next[1]))))
{
--- 1788,1800 ----
{
char_u *next = peek_next_line_from_context(cctx);
! // If a following line starts with "->{", "->(" or "->X" advance to
! // that line, so that a line break before "->" is allowed.
// Also if a following line starts with ".x".
if (next != NULL &&
((next[0] == '-' && next[1] == '>'
&& (next[2] == '{'
+ || next[2] == '('
|| ASCII_ISALPHA(*skipwhite(next + 2))))
|| (next[0] == '.' && eval_isdictc(next[1]))))
{
*** ../vim-9.0.0798/src/testdir/test_lambda.vim 2022-09-29 21:01:52.202807948
+0100
--- src/testdir/test_lambda.vim 2022-10-19 18:02:23.015668028 +0100
***************
*** 82,87 ****
--- 82,104 ----
call v9.CheckDefAndScriptSuccess(lines)
endfunc
+ def Test_lamba_compiled_linebreak()
+ var lines =<< trim END
+ vim9script
+
+ def Echo(what: any)
+ assert_equal('hello world', what)
+ enddef
+ def That()
+ printf("hello ")
+ ->((x) => x .. "world")()
+ ->Echo()
+ enddef
+ That()
+ END
+ v9.CheckScriptSuccess(lines)
+ enddef
+
func Test_lambda_with_partial()
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
*** ../vim-9.0.0798/src/version.c 2022-10-19 15:39:45.296658667 +0100
--- src/version.c 2022-10-19 17:58:55.515602205 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 799,
/**/
--
A disclaimer for the disclaimer:
"and before I get a huge amount of complaints , I have no control over the
disclaimer at the end of this mail :-)" (Timothy Aldrich)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20221019170527.C2DAD1C05E3%40moolenaar.net.