0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2762: Vim9: function line truncated when compiling

Problem:    Vim9: function line truncated when compiling.
Solution:   Copy the line before processing it. (closes #8101)
This commit is contained in:
Bram Moolenaar
2021-04-14 12:40:00 +02:00
parent 2e240bd428
commit f62d73933a
3 changed files with 51 additions and 0 deletions

View File

@@ -8486,6 +8486,7 @@ compile_def_function(
cctx_T *outer_cctx)
{
char_u *line = NULL;
char_u *line_to_free = NULL;
char_u *p;
char *errormsg = NULL; // error message
cctx_T cctx;
@@ -8647,6 +8648,14 @@ compile_def_function(
#endif
break;
}
// Make a copy, splitting off nextcmd and removing trailing spaces
// may change it.
if (line != NULL)
{
line = vim_strsave(line);
vim_free(line_to_free);
line_to_free = line;
}
}
CLEAR_FIELD(ea);
@@ -9095,6 +9104,7 @@ erret:
if (do_estack_push)
estack_pop();
vim_free(line_to_free);
free_imported(&cctx);
free_locals(&cctx);
ga_clear(&cctx.ctx_type_stack);