summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-19 18:04:49 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-19 18:04:49 +0100
commitd0fbb41eaa737dd64877c8cebaff19854e2d504f (patch)
tree4f6bf9f57087535af63a4503a2a81192468bcb15 /src
parent3c708c43908ba44f075bbaa7daf584c6b46d9723 (diff)
patch 9.0.0799: in compiled function ->() on next line not recognizedv9.0.0799
Problem: In compiled function ->() on next line not recognized. Solution: Also check for "(". (closes #11405)
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_lambda.vim17
-rw-r--r--src/version.c2
-rw-r--r--src/vim9expr.c5
3 files changed, 22 insertions, 2 deletions
diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim
index 3e348a0a01..250ce5c481 100644
--- a/src/testdir/test_lambda.vim
+++ b/src/testdir/test_lambda.vim
@@ -82,6 +82,23 @@ func Test_lambda_vim9cmd_linebreak()
call v9.CheckDefAndScriptSuccess(lines)
endfunc
+def Test_lamba_compiled_linebreak()
+ var lines =<< trim END
+ vim9script
+
+ def Echo(what: any)
+ assert_equal('hello world', what)
+ enddef
+ def That()
+ printf("hello ")
+ ->((x) => x .. "world")()
+ ->Echo()
+ enddef
+ That()
+ END
+ v9.CheckScriptSuccess(lines)
+enddef
+
func Test_lambda_with_partial()
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
diff --git a/src/version.c b/src/version.c
index e612e53661..c068ac3fed 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 799,
+/**/
798,
/**/
797,
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 854c09d01c..1fbe05b072 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -1788,12 +1788,13 @@ compile_subscript(
{
char_u *next = peek_next_line_from_context(cctx);
- // If a following line starts with "->{" or "->X" advance to that
- // line, so that a line break before "->" is allowed.
+ // If a following line starts with "->{", "->(" or "->X" advance to
+ // that line, so that a line break before "->" is allowed.
// Also if a following line starts with ".x".
if (next != NULL &&
((next[0] == '-' && next[1] == '>'
&& (next[2] == '{'
+ || next[2] == '('
|| ASCII_ISALPHA(*skipwhite(next + 2))))
|| (next[0] == '.' && eval_isdictc(next[1]))))
{