Problem: Vim9: memory leak when text after a nested function.
Solution: Free the function if text is found after "enddef".
enddef
def Test_using_var_as_arg()
- writefile(['def Func(x: number)', 'var x = 234', 'enddef', 'defcompile'], 'Xdef')
- assert_fails('so Xdef', 'E1006:', '', 1, 'Func')
- delete('Xdef')
+ var lines =<< trim END
+ def Func(x: number)
+ var x = 234
+ enddef
+ END
+ CheckDefFailure(lines, 'E1006:')
+
+ lines =<< trim END
+ def Func(Ref: number)
+ def Ref()
+ enddef
+ enddef
+ END
+ CheckDefFailure(lines, 'E1073:')
enddef
def DictArg(arg: dict<string>)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3951,
/**/
3950,
/**/
semsg(_(e_text_found_after_str_str),
eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd);
r = FAIL;
+ func_ptr_unref(ufunc);
goto theend;
}