summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/testdir/test_vim9_func.vim20
-rw-r--r--src/userfunc.c2
-rw-r--r--src/version.c2
3 files changed, 23 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 1a14c10167..88c0af8e0d 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1669,7 +1669,7 @@ def Test_error_in_nested_function()
assert_fails('FuncWithForwardCall()', 'E1096:', '', 1, 'FuncWithForwardCall')
enddef
-def Test_nested_functin_with_nextcmd()
+def Test_nested_function_with_nextcmd()
var lines =<< trim END
vim9script
# Define an outer function
@@ -1689,6 +1689,24 @@ def Test_nested_functin_with_nextcmd()
CheckScriptFailure(lines, 'E476: Invalid command: AAAAA')
enddef
+def Test_nested_function_with_args_split()
+ var lines =<< trim END
+ vim9script
+ def FirstFunction()
+ def SecondFunction(
+ )
+ # had a double free if the right parenthesis of the nested function is
+ # on the next line
+
+ enddef|BBBB
+ enddef
+ # Compile all functions
+ defcompile
+ END
+ # FIXME: this should fail on the BBBB
+ CheckScriptSuccess(lines)
+enddef
+
def Test_return_type_wrong()
CheckScriptFailure([
'def Func(): number',
diff --git a/src/userfunc.c b/src/userfunc.c
index e1028e7728..a7cbac3c86 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -219,6 +219,8 @@ get_function_args(
if (theline == NULL)
break;
vim_free(*line_to_free);
+ if (*eap->cmdlinep == *line_to_free)
+ *eap->cmdlinep = theline;
*line_to_free = theline;
whitep = (char_u *)" ";
p = skipwhite(theline);
diff --git a/src/version.c b/src/version.c
index 6c8bced722..5d22d98e8d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3923,
+/**/
3922,
/**/
3921,