Skip to content

Commit d66960b

Browse files
committed
patch 8.2.1927: Vim9: get unknown error with an error in a timer function
Problem: Vim9: get unknown error with an error in a timer function. Solution: Use did_emsg instead of called_emsg. (closes #7231)
1 parent b262020 commit d66960b

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1927,
753755
/**/
754756
1926,
755757
/**/

src/vim9compile.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6998,12 +6998,11 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
69986998
char *errormsg = NULL; // error message
69996999
cctx_T cctx;
70007000
garray_T *instr;
7001-
int called_emsg_before = called_emsg;
7001+
int did_emsg_before = did_emsg;
70027002
int ret = FAIL;
70037003
sctx_T save_current_sctx = current_sctx;
70047004
int save_estack_compiling = estack_compiling;
70057005
int do_estack_push;
7006-
int emsg_before = called_emsg;
70077006
int new_def_function = FALSE;
70087007

70097008
// When using a function that was compiled before: Free old instructions.
@@ -7107,7 +7106,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
71077106

71087107
// Bail out on the first error to avoid a flood of errors and report
71097108
// the right line number when inside try/catch.
7110-
if (emsg_before != called_emsg)
7109+
if (did_emsg_before != did_emsg)
71117110
goto erret;
71127111

71137112
if (line != NULL && *line == '|')
@@ -7127,7 +7126,6 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
71277126
// beyond the last line
71287127
break;
71297128
}
7130-
emsg_before = called_emsg;
71317129

71327130
CLEAR_FIELD(ea);
71337131
ea.cmdlinep = &line;
@@ -7585,7 +7583,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
75857583

75867584
if (errormsg != NULL)
75877585
emsg(errormsg);
7588-
else if (called_emsg == called_emsg_before)
7586+
else if (did_emsg == did_emsg_before)
75897587
emsg(_(e_compiling_def_function_failed));
75907588
}
75917589

src/vim9execute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ call_def_function(
828828
int defcount = ufunc->uf_args.ga_len - argc;
829829
sctx_T save_current_sctx = current_sctx;
830830
int breakcheck_count = 0;
831-
int called_emsg_before = called_emsg;
831+
int did_emsg_before = did_emsg;
832832
int save_suppress_errthrow = suppress_errthrow;
833833
msglist_T **saved_msg_list = NULL;
834834
msglist_T *private_msg_list = NULL;
@@ -853,7 +853,7 @@ call_def_function(
853853
|| (ufunc->uf_def_status == UF_TO_BE_COMPILED
854854
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
855855
{
856-
if (called_emsg == called_emsg_before)
856+
if (did_emsg == did_emsg_before)
857857
semsg(_(e_function_is_not_compiled_str),
858858
printable_func_name(ufunc));
859859
return FAIL;
@@ -2924,7 +2924,7 @@ call_def_function(
29242924
// Not sure if this is necessary.
29252925
suppress_errthrow = save_suppress_errthrow;
29262926

2927-
if (ret != OK && called_emsg == called_emsg_before)
2927+
if (ret != OK && did_emsg == did_emsg_before)
29282928
semsg(_(e_unknown_error_while_executing_str),
29292929
printable_func_name(ufunc));
29302930
return ret;

0 commit comments

Comments
 (0)