Patch 9.0.0553
Problem: No error for "|" after "{" in lamda.
Solution: Check for invalid "|". (closes #11199)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-9.0.0552/src/userfunc.c 2022-09-19 15:54:29.543117874 +0100
--- src/userfunc.c 2022-09-22 21:52:40.624245983 +0100
***************
*** 1166,1171 ****
--- 1166,1172 ----
garray_T *default_args,
char_u *ret_type)
{
+ char_u *start = *arg;
int evaluate = (evalarg->eval_flags & EVAL_EVALUATE);
garray_T *gap = &evalarg->eval_ga;
garray_T *freegap = &evalarg->eval_freega;
***************
*** 1179,1187 ****
int lnum_save = -1;
linenr_T sourcing_lnum_top = SOURCING_LNUM;
! if (!ends_excmd2(*arg, skipwhite(*arg + 1)))
{
! semsg(_(e_trailing_characters_str), *arg + 1);
return FAIL;
}
--- 1180,1189 ----
int lnum_save = -1;
linenr_T sourcing_lnum_top = SOURCING_LNUM;
! *arg = skipwhite(*arg + 1);
! if (**arg == '|' || !ends_excmd2(start, *arg))
{
! semsg(_(e_trailing_characters_str), *arg);
return FAIL;
}
*** ../vim-9.0.0552/src/testdir/test_vim9_func.vim 2022-09-14
00:30:47.081316534 +0100
--- src/testdir/test_vim9_func.vim 2022-09-22 21:59:23.496128514 +0100
***************
*** 1492,1497 ****
--- 1492,1520 ----
'x = filter(["bbb"], (_, v) => v =~ x)'])
enddef
+ def Test_lambda_invalid_block()
+ var lines =<< trim END
+ timer_start(0, (_) => { # echo
+ echo 'yes'
+ })
+ END
+ v9.CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ timer_start(0, (_) => { " echo
+ echo 'yes'
+ })
+ END
+ v9.CheckDefAndScriptFailure(lines, 'E488: Trailing characters: " echo')
+
+ lines =<< trim END
+ timer_start(0, (_) => { | echo
+ echo 'yes'
+ })
+ END
+ v9.CheckDefAndScriptFailure(lines, 'E488: Trailing characters: | echo')
+ enddef
+
def Test_pass_legacy_lambda_to_def_func()
var lines =<< trim END
vim9script
*** ../vim-9.0.0552/src/version.c 2022-09-22 21:35:16.041424474 +0100
--- src/version.c 2022-09-22 21:53:44.252188564 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 553,
/**/
--
hundred-and-one symptoms of being an internet addict:
137. You decide to stay in college for an additional year or two,
just so you can have the free Internet access.
/// 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/20220922210342.DF73C1C0796%40moolenaar.net.