Skip to content

Commit

Permalink
patch 8.2.3175: Vim9: using illegal pointer with nested lambdas.
Browse files Browse the repository at this point in the history
Problem:    Vim9: using illegal pointer with inline function inside a lambda.
Solution:   Clear eval_tofree_cmdline when advancing to the next line.
            (closes #8578)
  • Loading branch information
brammool committed Jul 18, 2021
1 parent 47bc9c3 commit c6ba2f9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/eval.c
Expand Up @@ -2177,6 +2177,11 @@ eval_next_line(evalarg_T *evalarg)
vim_free(evalarg->eval_tofree);
evalarg->eval_tofree = line;
}

// Advanced to the next line, "arg" no longer points into the previous
// line.
VIM_CLEAR(evalarg->eval_tofree_cmdline);

return skipwhite(line);
}

Expand Down
16 changes: 16 additions & 0 deletions src/testdir/test_vim9_func.vim
Expand Up @@ -2265,6 +2265,22 @@ def Test_nested_inline_lambda()
})
END
CheckScriptSuccess(lines)

lines =<< trim END
vim9script

def s:func()
range(10)
->mapnew((_, _) => ({
key: range(10)->mapnew((_, _) => {
return ' '
}),
}))
enddef

defcomp
END
CheckScriptSuccess(lines)
enddef

def Shadowed(): list<number>
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3175,
/**/
3174,
/**/
Expand Down

0 comments on commit c6ba2f9

Please sign in to comment.