0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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)
This commit is contained in:
Bram Moolenaar
2021-07-19 21:04:23 +02:00
parent 6106504e9e
commit ac2cd2b08f
3 changed files with 24 additions and 15 deletions

View File

@@ -866,26 +866,29 @@ get_function_body(
}
}
// 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;
}
}
}
}