diff src/vim9compile.c @ 22758:48feb3dd0d25 v8.2.1927

patch 8.2.1927: Vim9: get unknown error with an error in a timer function Commit: https://github.com/vim/vim/commit/d66960bf578410e83ef96ad2f4206b26a139d817 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 30 20:46:26 2020 +0100 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 https://github.com/vim/vim/issues/7231)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Oct 2020 21:00:04 +0100
parents 02b782e80ee4
children 82a7aff951d2
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -6998,12 +6998,11 @@ compile_def_function(ufunc_T *ufunc, int
     char	*errormsg = NULL;	// error message
     cctx_T	cctx;
     garray_T	*instr;
-    int		called_emsg_before = called_emsg;
+    int		did_emsg_before = did_emsg;
     int		ret = FAIL;
     sctx_T	save_current_sctx = current_sctx;
     int		save_estack_compiling = estack_compiling;
     int		do_estack_push;
-    int		emsg_before = called_emsg;
     int		new_def_function = FALSE;
 
     // When using a function that was compiled before: Free old instructions.
@@ -7107,7 +7106,7 @@ compile_def_function(ufunc_T *ufunc, int
 
 	// Bail out on the first error to avoid a flood of errors and report
 	// the right line number when inside try/catch.
-	if (emsg_before != called_emsg)
+	if (did_emsg_before != did_emsg)
 	    goto erret;
 
 	if (line != NULL && *line == '|')
@@ -7127,7 +7126,6 @@ compile_def_function(ufunc_T *ufunc, int
 		// beyond the last line
 		break;
 	}
-	emsg_before = called_emsg;
 
 	CLEAR_FIELD(ea);
 	ea.cmdlinep = &line;
@@ -7585,7 +7583,7 @@ erret:
 
 	if (errormsg != NULL)
 	    emsg(errormsg);
-	else if (called_emsg == called_emsg_before)
+	else if (did_emsg == did_emsg_before)
 	    emsg(_(e_compiling_def_function_failed));
     }