diff src/vim9execute.c @ 24637:4a4f64cdc798 v8.2.2857

patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level Commit: https://github.com/vim/vim/commit/ff65288aa89dcd50760ad942d58baff70c6e93e6 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 16 15:24:49 2021 +0200 patch 8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level Problem: Vim9: exception in ISN_INSTR caught at wrong level. Solution: Set the starting trylevel in exec_instructions(). (closes https://github.com/vim/vim/issues/8214)
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 May 2021 15:30:03 +0200
parents 07b3d21a8b4b
children 668df21d8bc6
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1295,6 +1295,9 @@ exec_instructions(ectx_T *ectx)
     // Start execution at the first instruction.
     ectx->ec_iidx = 0;
 
+    // Only catch exceptions in this instruction list.
+    ectx->ec_trylevel_at_start = trylevel;
+
     for (;;)
     {
 	isn_T	    *iptr;
@@ -4158,7 +4161,6 @@ call_def_function(
     ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);
     ga_init2(&ectx.ec_funcrefs, sizeof(partial_T *), 10);
     ectx.ec_did_emsg_before = did_emsg_before;
-    ectx.ec_trylevel_at_start = trylevel;
 
     idx = argc - ufunc->uf_args.ga_len;
     if (idx > 0 && ufunc->uf_va_name == NULL)