]> granicus.if.org Git - vim/commitdiff
patch 8.2.2642: Vim9: no clear error for wrong inline function v8.2.2642
authorBram Moolenaar <Bram@vim.org>
Mon, 22 Mar 2021 17:22:30 +0000 (18:22 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 22 Mar 2021 17:22:30 +0000 (18:22 +0100)
Problem:    Vim9: no clear error for wrong inline function.
Solution:   Check for something following the "{".

src/testdir/test_vim9_expr.vim
src/userfunc.c
src/version.c

index 6b9b54a58f95d6b7cb485a6927421948bf4c2529..c181b203f75925135798e1f267a9ea64fa37887f 100644 (file)
@@ -1963,6 +1963,11 @@ def Test_expr7_lambda_block()
       assert_equal(['no', 'yes', 'no'], dll)
   END
   CheckDefAndScriptSuccess(lines)
+
+  lines =<< trim END
+      map([1, 2], (k, v) => { redrawt })
+  END
+  CheckDefAndScriptFailure(lines, 'E488')
 enddef
 
 def NewLambdaWithComments(): func
index a53c4769c7274c51641bbd4bd4fa2d9ecdebbeed..c9c7bc791165e691901ad1b25c02c5936db7ec2a 100644 (file)
@@ -954,10 +954,15 @@ lambda_function_body(
     int                lnum_save = -1;
     linenr_T   sourcing_lnum_top = SOURCING_LNUM;
 
+    if (!ends_excmd2(*arg, skipwhite(*arg + 1)))
+    {
+       semsg(_(e_trailing_arg), *arg + 1);
+       return FAIL;
+    }
+
     CLEAR_FIELD(eap);
     eap.cmdidx = CMD_block;
     eap.forceit = FALSE;
-    eap.arg = *arg + 1;
     eap.cmdlinep = &cmdline;
     eap.skip = !evaluate;
     if (evalarg->eval_cctx != NULL)
index 3a5365a867d81c465664f53e5352080e813115bf..fbe38b806cbfaf41d3962fbd72f73a701282635e 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2642,
 /**/
     2641,
 /**/