summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-19 20:48:59 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-19 20:48:59 +0200
commit682d0a15462f3d4f9404e98a56b340ae131cbb09 (patch)
tree8f5c50220344851d41c7c236529f17235b3f7d8a
parent2f8ce0ae8a8247563be0a77a308130e767e0566e (diff)
patch 8.2.1251: Vim9: warning for pointer usage, test failure undetectedv8.2.1251
Problem: Vim9: warning for pointer usage, test failure undetected. Solution: Fix pointer indirection. Give error when executing function failed for any reason. Fix instruction names.
-rw-r--r--src/proto/userfunc.pro1
-rw-r--r--src/userfunc.c2
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c15
4 files changed, 13 insertions, 7 deletions
diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro
index 75a1562570..9c9eb2df7a 100644
--- a/src/proto/userfunc.pro
+++ b/src/proto/userfunc.pro
@@ -22,6 +22,7 @@ int get_callback_depth(void);
int call_callback(callback_T *callback, int len, typval_T *rettv, int argcount, typval_T *argvars);
void user_func_error(int error, char_u *name);
int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, funcexe_T *funcexe);
+char_u *printable_func_name(ufunc_T *fp);
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags, funcdict_T *fdp, partial_T **partial);
char_u *untrans_function_name(char_u *name);
ufunc_T *def_function(exarg_T *eap, char_u *name_arg);
diff --git a/src/userfunc.c b/src/userfunc.c
index b4b8ccf910..eda1f242f5 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2122,7 +2122,7 @@ theend:
return ret;
}
- static char_u *
+ char_u *
printable_func_name(ufunc_T *fp)
{
return fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name;
diff --git a/src/version.c b/src/version.c
index 936e4df96f..444870e3f2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1251,
+/**/
1250,
/**/
1249,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 35419dae42..f022b5ba85 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -714,8 +714,7 @@ call_def_function(
{
if (called_emsg == called_emsg_before)
semsg(_("E1091: Function is not compiled: %s"),
- ufunc->uf_name_exp == NULL
- ? ufunc->uf_name : ufunc->uf_name_exp);
+ printable_func_name(ufunc));
return FAIL;
}
@@ -1139,10 +1138,10 @@ call_def_function(
switch (iptr->isn_type)
{
- case ISN_LOADG: d = get_globvar_dict(); break;
- case ISN_LOADB: d = &curbuf->b_vars; break;
- case ISN_LOADW: d = &curwin->w_vars; break;
- case ISN_LOADT: d = &curtab->tp_vars; break;
+ case ISN_LOADGDICT: d = get_globvar_dict(); break;
+ case ISN_LOADBDICT: d = curbuf->b_vars; break;
+ case ISN_LOADWDICT: d = curwin->w_vars; break;
+ case ISN_LOADTDICT: d = curtab->tp_vars; break;
default: // Cannot reach here
goto failed;
}
@@ -2497,6 +2496,10 @@ failed_early:
vim_free(ectx.ec_stack.ga_data);
vim_free(ectx.ec_trystack.ga_data);
+
+ if (ret != OK && called_emsg == called_emsg_before)
+ semsg(_("E1099: Unknown error while executing %s"),
+ printable_func_name(ufunc));
return ret;
}