0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.0495: closure doesn't work properly in nested loop

Problem:    Closure doesn't work properly in nested loop.
Solution:   Save variables up to the outer loop.
This commit is contained in:
Bram Moolenaar
2022-09-18 12:00:21 +01:00
parent 96caa557f9
commit dbbb02bc77
3 changed files with 30 additions and 2 deletions

View File

@@ -2671,7 +2671,7 @@ execute_endloop(isn_T *iptr, ectx_T *ectx)
{
partial_T *pt = ((partial_T **)gap->ga_data)[idx];
if (pt->pt_refcount > 1)
if (pt->pt_refcount > 1 && pt->pt_loopvars == NULL)
{
int refcount = pt->pt_refcount;
int i;
@@ -2727,7 +2727,7 @@ execute_endloop(isn_T *iptr, ectx_T *ectx)
{
partial_T *pt = ((partial_T **)gap->ga_data)[idx];
if (pt->pt_refcount > 1)
if (pt->pt_refcount > 1 && pt->pt_loopvars == NULL)
{
++loopvars->lvs_refcount;
pt->pt_loopvars = loopvars;