comparison src/vim9execute.c @ 22736:56907027dba7 v8.2.1916

patch 8.2.1916: Vim9: function call is aborted even when "silent!" is used Commit: https://github.com/vim/vim/commit/171fb923b8f8da9fb0db1c8c86e35cf4e1339000 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 28 16:54:47 2020 +0100 patch 8.2.1916: Vim9: function call is aborted even when "silent!" is used Problem: Vim9: function call is aborted even when "silent!" is used. Solution: Use did_emsg instead of called_emsg. (closes https://github.com/vim/vim/issues/7213)
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Oct 2020 17:00:03 +0100
parents 8968ed4ba4ba
children f7f2d73ff85e
comparison
equal deleted inserted replaced
22735:6a0c4559c941 22736:56907027dba7
548 static int 548 static int
549 call_bfunc(int func_idx, int argcount, ectx_T *ectx) 549 call_bfunc(int func_idx, int argcount, ectx_T *ectx)
550 { 550 {
551 typval_T argvars[MAX_FUNC_ARGS]; 551 typval_T argvars[MAX_FUNC_ARGS];
552 int idx; 552 int idx;
553 int called_emsg_before = called_emsg; 553 int did_emsg_before = did_emsg;
554 ectx_T *prev_ectx = current_ectx; 554 ectx_T *prev_ectx = current_ectx;
555 555
556 if (call_prepare(argcount, argvars, ectx) == FAIL) 556 if (call_prepare(argcount, argvars, ectx) == FAIL)
557 return FAIL; 557 return FAIL;
558 558
564 564
565 // Clear the arguments. 565 // Clear the arguments.
566 for (idx = 0; idx < argcount; ++idx) 566 for (idx = 0; idx < argcount; ++idx)
567 clear_tv(&argvars[idx]); 567 clear_tv(&argvars[idx]);
568 568
569 if (called_emsg != called_emsg_before) 569 if (did_emsg != did_emsg_before)
570 return FAIL; 570 return FAIL;
571 return OK; 571 return OK;
572 } 572 }
573 573
574 /* 574 /*
832 int save_suppress_errthrow = suppress_errthrow; 832 int save_suppress_errthrow = suppress_errthrow;
833 msglist_T **saved_msg_list = NULL; 833 msglist_T **saved_msg_list = NULL;
834 msglist_T *private_msg_list = NULL; 834 msglist_T *private_msg_list = NULL;
835 cmdmod_T save_cmdmod; 835 cmdmod_T save_cmdmod;
836 int restore_cmdmod = FALSE; 836 int restore_cmdmod = FALSE;
837 int trylevel_at_start = trylevel;
837 838
838 // Get pointer to item in the stack. 839 // Get pointer to item in the stack.
839 #define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx) 840 #define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
840 841
841 // Get pointer to item at the bottom of the stack, -1 is the bottom. 842 // Get pointer to item at the bottom of the stack, -1 is the bottom.
2864 // only fails when out of memory 2865 // only fails when out of memory
2865 goto failed; 2866 goto failed;
2866 continue; 2867 continue;
2867 2868
2868 on_error: 2869 on_error:
2869 if (trylevel == 0) 2870 // If we are not inside a try-catch started here, abort execution.
2871 if (trylevel <= trylevel_at_start)
2870 goto failed; 2872 goto failed;
2871 } 2873 }
2872 2874
2873 done: 2875 done:
2874 // function finished, get result from the stack. 2876 // function finished, get result from the stack.