diff src/userfunc.c @ 19281:9fcdeaa18bd1 v8.2.0199

patch 8.2.0199: Vim9 script commands not sufficiently tested Commit: https://github.com/vim/vim/commit/0f18b6d17baa7d33f209a3184726a162c2bb7ed8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 2 17:22:27 2020 +0100 patch 8.2.0199: Vim9 script commands not sufficiently tested Problem: Vim9 script commands not sufficiently tested. Solution: Add more tests. Fix script-local function use.
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Feb 2020 17:30:03 +0100
parents a8d2d3c8f0b3
children 86665583dc83
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1060,6 +1060,8 @@ call_user_func(
     if (fp->uf_dfunc_idx >= 0)
     {
 	estack_push_ufunc(ETYPE_UFUNC, fp, 1);
+	save_current_sctx = current_sctx;
+	current_sctx = fp->uf_script_ctx;
 
 	// Execute the compiled function.
 	call_def_function(fp, argcount, argvars, rettv);
@@ -1067,6 +1069,7 @@ call_user_func(
 	current_funccal = fc->caller;
 
 	estack_pop();
+	current_sctx = save_current_sctx;
 	free_funccal(fc);
 	return;
     }