summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-22 22:03:14 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-22 22:03:14 +0100
commitf5f4e85f0189790ab81c0005b703604721db13d4 (patch)
tree941a13046f1c770cc610519320f131c0b675e657 /src/userfunc.c
parent69082916c8b5d321545d60b9f5facad0a2dd5a4e (diff)
downloadvim-git-f5f4e85f0189790ab81c0005b703604721db13d4.tar.gz
patch 9.0.0553: no error for "|" after "{" in lamdav9.0.0553
Problem: No error for "|" after "{" in lamda. Solution: Check for invalid "|". (closes #11199)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 83221a855..cc90b95b7 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1166,6 +1166,7 @@ lambda_function_body(
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,9 +1180,10 @@ lambda_function_body(
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;
}