mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -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:
@@ -386,6 +386,33 @@ def Test_disassemble_blob_add()
|
|||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def s:BlobIndexSlice()
|
||||||
|
var b: blob = 0z112233
|
||||||
|
echo b[1]
|
||||||
|
echo b[1 : 2]
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_blob_index_slice()
|
||||||
|
var res = execute('disass s:BlobIndexSlice')
|
||||||
|
assert_match('<SNR>\d*_BlobIndexSlice\_s*' ..
|
||||||
|
'var b: blob = 0z112233\_s*' ..
|
||||||
|
'\d PUSHBLOB 0z112233\_s*' ..
|
||||||
|
'\d STORE $0\_s*' ..
|
||||||
|
'echo b\[1\]\_s*' ..
|
||||||
|
'\d LOAD $0\_s*' ..
|
||||||
|
'\d PUSHNR 1\_s*' ..
|
||||||
|
'\d BLOBINDEX\_s*' ..
|
||||||
|
'\d ECHO 1\_s*' ..
|
||||||
|
'echo b\[1 : 2\]\_s*' ..
|
||||||
|
'\d LOAD $0\_s*' ..
|
||||||
|
'\d PUSHNR 1\_s*' ..
|
||||||
|
'\d\+ PUSHNR 2\_s*' ..
|
||||||
|
'\d\+ BLOBSLICE\_s*' ..
|
||||||
|
'\d\+ ECHO 1\_s*' ..
|
||||||
|
'\d\+ RETURN 0',
|
||||||
|
res)
|
||||||
|
enddef
|
||||||
|
|
||||||
def s:ScriptFuncUnlet()
|
def s:ScriptFuncUnlet()
|
||||||
g:somevar = "value"
|
g:somevar = "value"
|
||||||
unlet g:somevar
|
unlet g:somevar
|
||||||
@@ -2018,5 +2045,17 @@ def Test_profiled()
|
|||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def s:EchoMessages()
|
||||||
|
echohl ErrorMsg | echom v:exception | echohl NONE
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_nextcmd()
|
||||||
|
# splitting commands and removing trailing blanks should not change the line
|
||||||
|
var res = execute('disass s:EchoMessages')
|
||||||
|
assert_match('<SNR>\d*_EchoMessages\_s*' ..
|
||||||
|
'echohl ErrorMsg | echom v:exception | echohl NONE',
|
||||||
|
res)
|
||||||
|
enddef
|
||||||
|
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2762,
|
||||||
/**/
|
/**/
|
||||||
2761,
|
2761,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -8486,6 +8486,7 @@ compile_def_function(
|
|||||||
cctx_T *outer_cctx)
|
cctx_T *outer_cctx)
|
||||||
{
|
{
|
||||||
char_u *line = NULL;
|
char_u *line = NULL;
|
||||||
|
char_u *line_to_free = NULL;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char *errormsg = NULL; // error message
|
char *errormsg = NULL; // error message
|
||||||
cctx_T cctx;
|
cctx_T cctx;
|
||||||
@@ -8647,6 +8648,14 @@ compile_def_function(
|
|||||||
#endif
|
#endif
|
||||||
break;
|
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);
|
CLEAR_FIELD(ea);
|
||||||
@@ -9095,6 +9104,7 @@ erret:
|
|||||||
if (do_estack_push)
|
if (do_estack_push)
|
||||||
estack_pop();
|
estack_pop();
|
||||||
|
|
||||||
|
vim_free(line_to_free);
|
||||||
free_imported(&cctx);
|
free_imported(&cctx);
|
||||||
free_locals(&cctx);
|
free_locals(&cctx);
|
||||||
ga_clear(&cctx.ctx_type_stack);
|
ga_clear(&cctx.ctx_type_stack);
|
||||||
|
Reference in New Issue
Block a user