patch 8.2.3185: Vim9: start of inline function found in comment line
Problem: Vim9: start of inline function found in comment line.
Solution: Do not check for inline function in comment line. (closes #8589)
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index e7c08f4..49109c7 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -2075,6 +2075,10 @@
})
assert_equal(['no', 'yes', 'no'], dll)
+ # ignored_inline(0, (_) => {
+ # echo 'body'
+ # })
+
sandbox var Safe = (nr: number): number => {
return nr + 7
}
diff --git a/src/userfunc.c b/src/userfunc.c
index 3dfa680..79e711c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -866,26 +866,29 @@
}
}
- // Check for nested inline function.
- end = p + STRLEN(p) - 1;
- while (end > p && VIM_ISWHITE(*end))
- --end;
- if (end > p && *end == '{')
+ if (nesting_def[nesting] ? *p != '#' : *p != '"')
{
- --end;
+ // Not a comment line: check for nested inline function.
+ end = p + STRLEN(p) - 1;
while (end > p && VIM_ISWHITE(*end))
--end;
- if (end > p + 2 && end[-1] == '=' && end[0] == '>')
+ if (end > p && *end == '{')
{
- // found trailing "=> {", start of an inline function
- if (nesting == MAX_FUNC_NESTING - 1)
- emsg(_(e_function_nesting_too_deep));
- else
+ --end;
+ while (end > p && VIM_ISWHITE(*end))
+ --end;
+ if (end > p + 2 && end[-1] == '=' && end[0] == '>')
{
- ++nesting;
- nesting_def[nesting] = TRUE;
- nesting_inline[nesting] = TRUE;
- indent += 2;
+ // found trailing "=> {", start of an inline function
+ if (nesting == MAX_FUNC_NESTING - 1)
+ emsg(_(e_function_nesting_too_deep));
+ else
+ {
+ ++nesting;
+ nesting_def[nesting] = TRUE;
+ nesting_inline[nesting] = TRUE;
+ indent += 2;
+ }
}
}
}
diff --git a/src/version.c b/src/version.c
index c6e3faf..04354c2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3185,
+/**/
3184,
/**/
3183,