Patch 8.2.2504
Problem: Vim9: crash when using an argument from a closure.
Solution: Check if gen_load_outer is NULL. (closes #7821)
Files: src/vim9compile.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.2503/src/vim9compile.c 2021-02-11 21:19:30.526147922 +0100
--- src/vim9compile.c 2021-02-12 21:50:24.789890749 +0100
***************
*** 261,267 ****
if (arg_exists(name, len, idxp, type, gen_load_outer, cctx->ctx_outer)
== OK)
{
! ++*gen_load_outer;
return OK;
}
}
--- 261,268 ----
if (arg_exists(name, len, idxp, type, gen_load_outer, cctx->ctx_outer)
== OK)
{
! if (gen_load_outer != NULL)
! ++*gen_load_outer;
return OK;
}
}
*** ../vim-8.2.2503/src/testdir/test_vim9_func.vim 2021-02-07
15:59:44.438603736 +0100
--- src/testdir/test_vim9_func.vim 2021-02-12 21:47:42.370393447 +0100
***************
*** 1669,1674 ****
--- 1669,1686 ----
unlet g:UseArg
unlet g:UseVararg
+
+ var lines =<< trim END
+ vim9script
+ def Test(Fun: func(number): number): list<number>
+ return map([1, 2, 3], (_, i) => Fun(i))
+ enddef
+ def Inc(nr: number): number
+ return nr + 2
+ enddef
+ assert_equal([3, 4, 5], Test(Inc))
+ END
+ CheckScriptSuccess(lines)
enddef
def MakeGetAndAppendRefs()
*** ../vim-8.2.2503/src/version.c 2021-02-12 21:32:42.600949557 +0100
--- src/version.c 2021-02-12 21:49:27.478068808 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2504,
/**/
--
Courtroom Quote #19:
Q: Doctor, how many autopsies have you performed on dead people?
A: All my autopsies have been performed on dead people.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202102122052.11CKqG5J964821%40masaka.moolenaar.net.