mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Problem: Vim9: not all commands using ends_excmd() tested. Solution: Find # comment after regular commands. Add more tests. Report error for where it was caused.
This commit is contained in:
@@ -488,6 +488,7 @@ call_def_function(
|
||||
int idx;
|
||||
int ret = FAIL;
|
||||
int defcount = ufunc->uf_args.ga_len - argc;
|
||||
int save_sc_version = current_sctx.sc_version;
|
||||
|
||||
// Get pointer to item in the stack.
|
||||
#define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
|
||||
@@ -565,6 +566,9 @@ call_def_function(
|
||||
ectx.ec_instr = dfunc->df_instr;
|
||||
}
|
||||
|
||||
// Commands behave like vim9script.
|
||||
current_sctx.sc_version = SCRIPT_VERSION_VIM9;
|
||||
|
||||
// Decide where to start execution, handles optional arguments.
|
||||
init_instr_idx(ufunc, argc, &ectx);
|
||||
|
||||
@@ -582,6 +586,16 @@ call_def_function(
|
||||
did_throw = TRUE;
|
||||
}
|
||||
|
||||
if (did_emsg && msg_list != NULL && *msg_list != NULL)
|
||||
{
|
||||
// Turn an error message into an exception.
|
||||
did_emsg = FALSE;
|
||||
if (throw_exception(*msg_list, ET_ERROR, NULL) == FAIL)
|
||||
goto failed;
|
||||
did_throw = TRUE;
|
||||
*msg_list = NULL;
|
||||
}
|
||||
|
||||
if (did_throw && !ectx.ec_in_catch)
|
||||
{
|
||||
garray_T *trystack = &ectx.ec_trystack;
|
||||
@@ -1774,6 +1788,7 @@ failed:
|
||||
while (ectx.ec_frame != initial_frame_ptr)
|
||||
func_return(&ectx);
|
||||
failed_early:
|
||||
current_sctx.sc_version = save_sc_version;
|
||||
for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx)
|
||||
clear_tv(STACK_TV(idx));
|
||||
vim_free(ectx.ec_stack.ga_data);
|
||||
@@ -1807,6 +1822,14 @@ ex_disassemble(exarg_T *eap)
|
||||
}
|
||||
|
||||
ufunc = find_func(fname, NULL);
|
||||
if (ufunc == NULL)
|
||||
{
|
||||
char_u *p = untrans_function_name(fname);
|
||||
|
||||
if (p != NULL)
|
||||
// Try again without making it script-local.
|
||||
ufunc = find_func(p, NULL);
|
||||
}
|
||||
vim_free(fname);
|
||||
if (ufunc == NULL)
|
||||
{
|
||||
|
Reference in New Issue
Block a user