diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-16 19:04:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-16 19:04:24 +0100 |
commit | 8fa745e7be3a791ac25f93ef0227bbc48ade8a37 (patch) | |
tree | 2784f5de78824527acc5d31f3eb96fd4264ac989 /src/userfunc.c | |
parent | abd58d8aee7fec2b9e07c829eb925b0a1f7118db (diff) | |
download | vim-git-8fa745e7be3a791ac25f93ef0227bbc48ade8a37.tar.gz |
patch 9.0.0481: in :def function all closures in loop get the same variablesv9.0.0481
Problem: In a :def function all closures in a loop get the same variables.
Solution: Use a separate list of variables for LOADOUTER and STOREOUTER.
Not copied at end of loop yet.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 35ce3f308..f0e9cd7c7 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -2452,7 +2452,12 @@ func_clear_free(ufunc_T *fp, int force) * This is for when a compiled function defines a global function. */ int -copy_func(char_u *lambda, char_u *global, ectx_T *ectx) +copy_lambda_to_global_func( + char_u *lambda, + char_u *global, + short loop_var_idx, + short loop_var_count, + ectx_T *ectx) { ufunc_T *ufunc = find_func_even_dead(lambda, FFED_IS_GLOBAL); ufunc_T *fp = NULL; @@ -2519,7 +2524,8 @@ copy_func(char_u *lambda, char_u *global, ectx_T *ectx) if (pt == NULL) goto failed; - if (fill_partial_and_closure(pt, ufunc, ectx) == FAIL) + if (fill_partial_and_closure(pt, ufunc, loop_var_idx, loop_var_count, + ectx) == FAIL) { vim_free(pt); goto failed; |