comparison src/vim9compile.c @ 24406:a26f0fa12845 v8.2.2743

patch 8.2.2743: Vim9: function state stuck when compiling with ":silent!" Commit: https://github.com/vim/vim/commit/599410cb3cb19946cd6df22441da5de003e114bb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 10 14:03:43 2021 +0200 patch 8.2.2743: Vim9: function state stuck when compiling with ":silent!" Problem: Vim9: function state stuck when compiling with ":silent!". Solution: Check for uf_def_status to be UF_COMPILING.
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Apr 2021 14:15:03 +0200
parents a2a7d2d6e724
children 96e0b898d5b4
comparison
equal deleted inserted replaced
24405:2831ce589a7d 24406:a26f0fa12845
8427 char_u *p; 8427 char_u *p;
8428 char *errormsg = NULL; // error message 8428 char *errormsg = NULL; // error message
8429 cctx_T cctx; 8429 cctx_T cctx;
8430 garray_T *instr; 8430 garray_T *instr;
8431 int did_emsg_before = did_emsg; 8431 int did_emsg_before = did_emsg;
8432 int did_emsg_silent_before = did_emsg_silent;
8432 int ret = FAIL; 8433 int ret = FAIL;
8433 sctx_T save_current_sctx = current_sctx; 8434 sctx_T save_current_sctx = current_sctx;
8434 int save_estack_compiling = estack_compiling; 8435 int save_estack_compiling = estack_compiling;
8435 int do_estack_push; 8436 int do_estack_push;
8436 int new_def_function = FALSE; 8437 int new_def_function = FALSE;
8965 8966
8966 // Return zero if there is no return at the end. 8967 // Return zero if there is no return at the end.
8967 generate_instr(&cctx, ISN_RETURN_ZERO); 8968 generate_instr(&cctx, ISN_RETURN_ZERO);
8968 } 8969 }
8969 8970
8971 // When compiled with ":silent!" and there was an error don't consider the
8972 // function compiled.
8973 if (emsg_silent == 0 || did_emsg_silent == did_emsg_silent_before)
8970 { 8974 {
8971 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) 8975 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
8972 + ufunc->uf_dfunc_idx; 8976 + ufunc->uf_dfunc_idx;
8973 dfunc->df_deleted = FALSE; 8977 dfunc->df_deleted = FALSE;
8974 dfunc->df_script_seq = current_sctx.sc_seq; 8978 dfunc->df_script_seq = current_sctx.sc_seq;
8992 } 8996 }
8993 8997
8994 ret = OK; 8998 ret = OK;
8995 8999
8996 erret: 9000 erret:
8997 if (ret == FAIL) 9001 if (ufunc->uf_def_status == UF_COMPILING)
8998 { 9002 {
8999 int idx; 9003 int idx;
9000 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) 9004 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
9001 + ufunc->uf_dfunc_idx; 9005 + ufunc->uf_dfunc_idx;
9002 9006