mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2096: Vim9: command modifiers not restored after assignment
Problem: Vim9: command modifiers not restored after assignment. Solution: Jump to nextline instead of using continue.
This commit is contained in:
parent
4029cabbe7
commit
f665e97ffa
@ -1784,6 +1784,22 @@ def Test_reset_did_emsg()
|
|||||||
delfunc! g:Func
|
delfunc! g:Func
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_continues_with_silent_error()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
g:result = 'none'
|
||||||
|
def Func()
|
||||||
|
silent! g:result += 3
|
||||||
|
g:result = 'yes'
|
||||||
|
enddef
|
||||||
|
# error is silenced, function does not abort
|
||||||
|
Func()
|
||||||
|
assert_equal('yes', g:result)
|
||||||
|
unlet g:result
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_abort_even_with_silent()
|
def Test_abort_even_with_silent()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
@ -1792,13 +1808,38 @@ def Test_abort_even_with_silent()
|
|||||||
eval {-> ''}() .. '' .. {}['X']
|
eval {-> ''}() .. '' .. {}['X']
|
||||||
g:result = 'yes'
|
g:result = 'yes'
|
||||||
enddef
|
enddef
|
||||||
sil! Func()
|
silent! Func()
|
||||||
assert_equal('none', g:result)
|
assert_equal('none', g:result)
|
||||||
unlet g:result
|
unlet g:result
|
||||||
END
|
END
|
||||||
CheckScriptSuccess(lines)
|
CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_cmdmod_silent_restored()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Func()
|
||||||
|
g:result = 'none'
|
||||||
|
silent! g:result += 3
|
||||||
|
g:result = 'none'
|
||||||
|
g:result += 3
|
||||||
|
enddef
|
||||||
|
Func()
|
||||||
|
END
|
||||||
|
# can't use CheckScriptFailure, it ignores the :silent!
|
||||||
|
var fname = 'Xdefsilent'
|
||||||
|
writefile(lines, fname)
|
||||||
|
var caught = 'no'
|
||||||
|
try
|
||||||
|
exe 'source ' .. fname
|
||||||
|
catch /E1030:/
|
||||||
|
caught = 'yes'
|
||||||
|
assert_match('Func, line 4', v:throwpoint)
|
||||||
|
endtry
|
||||||
|
assert_equal('yes', caught)
|
||||||
|
delete(fname)
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_dict_member_with_silent()
|
def Test_dict_member_with_silent()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
2096,
|
||||||
/**/
|
/**/
|
||||||
2095,
|
2095,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1933,14 +1933,8 @@ generate_cmdmods(cctx_T *cctx, cmdmod_T *cmod)
|
|||||||
static int
|
static int
|
||||||
generate_undo_cmdmods(cctx_T *cctx)
|
generate_undo_cmdmods(cctx_T *cctx)
|
||||||
{
|
{
|
||||||
isn_T *isn;
|
if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL)
|
||||||
|
return FAIL;
|
||||||
if (cctx->ctx_has_cmdmod)
|
|
||||||
{
|
|
||||||
if ((isn = generate_instr(cctx, ISN_CMDMOD_REV)) == NULL)
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7578,7 +7572,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
|||||||
line = compile_assignment(ea.cmd, &ea, CMD_SIZE, &cctx);
|
line = compile_assignment(ea.cmd, &ea, CMD_SIZE, &cctx);
|
||||||
if (line == NULL || line == ea.cmd)
|
if (line == NULL || line == ea.cmd)
|
||||||
goto erret;
|
goto erret;
|
||||||
continue;
|
goto nextline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7590,7 +7584,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
|||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
goto erret;
|
goto erret;
|
||||||
if (line != ea.cmd)
|
if (line != ea.cmd)
|
||||||
continue;
|
goto nextline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7629,7 +7623,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
|||||||
if (cctx.ctx_skip == SKIP_YES)
|
if (cctx.ctx_skip == SKIP_YES)
|
||||||
{
|
{
|
||||||
line += STRLEN(line);
|
line += STRLEN(line);
|
||||||
continue;
|
goto nextline;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expression or function call.
|
// Expression or function call.
|
||||||
|
@ -2432,6 +2432,7 @@ call_def_function(
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
n1 = tv_get_number_chk(tv1, &error);
|
n1 = tv_get_number_chk(tv1, &error);
|
||||||
if (error)
|
if (error)
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user