Problem: No error for "|" after "{" in lamda.
Solution: Check for invalid "|". (closes #11199)
'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
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;
int lnum_save = -1;
linenr_T sourcing_lnum_top = SOURCING_LNUM;
- if (!ends_excmd2(*arg, skipwhite(*arg + 1)))
+ *arg = skipwhite(*arg + 1);
+ if (**arg == '|' || !ends_excmd2(start, *arg))
{
- semsg(_(e_trailing_characters_str), *arg + 1);
+ semsg(_(e_trailing_characters_str), *arg);
return FAIL;
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 553,
/**/
552,
/**/