File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -1492,6 +1492,29 @@ def Test_lambda_uses_assigned_var()
14921492 ' x = filter(["bbb"], (_, v) => v =~ x)' ])
14931493enddef
14941494
1495+ def Test_lambda_invalid_block ()
1496+ var lines = << trim END
1497+ timer_start (0 , (_) = > { # echo
1498+ echo ' yes'
1499+ })
1500+ END
1501+ v9.CheckDefAndScriptSuccess (lines )
1502+
1503+ lines = << trim END
1504+ timer_start (0 , (_) = > { " echo
1505+ echo ' yes'
1506+ })
1507+ END
1508+ v9.CheckDefAndScriptFailure (lines , ' E488: Trailing characters: " echo' )
1509+
1510+ lines = << trim END
1511+ timer_start (0 , (_) = > { | echo
1512+ echo ' yes'
1513+ })
1514+ END
1515+ v9.CheckDefAndScriptFailure (lines , ' E488: Trailing characters: | echo' )
1516+ enddef
1517+
14951518def Test_pass_legacy_lambda_to_def_func ()
14961519 var lines = << trim END
14971520 vim9script
Original file line number Diff line number Diff line change @@ -1166,6 +1166,7 @@ lambda_function_body(
11661166 garray_T * default_args ,
11671167 char_u * ret_type )
11681168{
1169+ char_u * start = * arg ;
11691170 int evaluate = (evalarg -> eval_flags & EVAL_EVALUATE );
11701171 garray_T * gap = & evalarg -> eval_ga ;
11711172 garray_T * freegap = & evalarg -> eval_freega ;
@@ -1179,9 +1180,10 @@ lambda_function_body(
11791180 int lnum_save = -1 ;
11801181 linenr_T sourcing_lnum_top = SOURCING_LNUM ;
11811182
1182- if (!ends_excmd2 (* arg , skipwhite (* arg + 1 )))
1183+ * arg = skipwhite (* arg + 1 );
1184+ if (* * arg == '|' || !ends_excmd2 (start , * arg ))
11831185 {
1184- semsg (_ (e_trailing_characters_str ), * arg + 1 );
1186+ semsg (_ (e_trailing_characters_str ), * arg );
11851187 return FAIL ;
11861188 }
11871189
Original file line number Diff line number Diff line change @@ -699,6 +699,8 @@ static char *(features[]) =
699699
700700static int included_patches [] =
701701{ /* Add new patch number below this line */
702+ /**/
703+ 553 ,
702704/**/
703705 552 ,
704706/**/
You can’t perform that action at this time.
0 commit comments