summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-18 19:53:28 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-18 19:53:28 +0200
commita26b9700d73ebccd6c5459d0d66032a4249f6b72 (patch)
tree2b7c7a0dfe64a8c707f36ce107dab9660adca200 /src/vim9execute.c
parentb6fb0516ec862a18fdffe06c9400d507a7193835 (diff)
downloadvim-git-8.2.0595.tar.gz
patch 8.2.0595: Vim9: not all commands using ends_excmd() testedv8.2.0595
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.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index cddb9d213..dbc5d22ba 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -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)
{