Patch 8.2.2195
Problem: Failing tests for :const.
Solution: Add missing check for ASSIGN_FINAL.
Files: src/eval.c, src/evalvars.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.2194/src/eval.c 2020-12-22 12:20:04.541293877 +0100
--- src/eval.c 2020-12-22 21:36:14.466740488 +0100
***************
*** 1334,1340 ****
{
typval_T tv;
! if (flags & ASSIGN_CONST)
{
emsg(_(e_cannot_mod));
*endp = cc;
--- 1334,1340 ----
{
typval_T tv;
! if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
{
emsg(_(e_cannot_mod));
*endp = cc;
***************
*** 1372,1378 ****
listitem_T *ll_li = lp->ll_li;
int ll_n1 = lp->ll_n1;
! if (flags & ASSIGN_CONST)
{
emsg(_("E996: Cannot lock a range"));
return;
--- 1372,1378 ----
listitem_T *ll_li = lp->ll_li;
int ll_n1 = lp->ll_n1;
! if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
{
emsg(_("E996: Cannot lock a range"));
return;
***************
*** 1431,1437 ****
/*
* Assign to a List or Dictionary item.
*/
! if (flags & ASSIGN_CONST)
{
emsg(_("E996: Cannot lock a list or dict"));
return;
--- 1431,1437 ----
/*
* Assign to a List or Dictionary item.
*/
! if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
{
emsg(_("E996: Cannot lock a list or dict"));
return;
*** ../vim-8.2.2194/src/evalvars.c 2020-12-22 21:19:35.293652280 +0100
--- src/evalvars.c 2020-12-22 22:06:10.548926176 +0100
***************
*** 752,760 ****
emsg(_(e_cannot_use_let_in_vim9_script));
return;
}
- if (eap->cmdidx == CMD_const && !vim9script && !eap->forceit)
- // In legacy Vim script ":const" works like ":final".
- eap->cmdidx = CMD_final;
if (eap->cmdidx == CMD_const)
flags |= ASSIGN_CONST;
--- 752,757 ----
***************
*** 3231,3237 ****
init_tv(tv);
}
! // ":const var = val" locks the value
if (flags & ASSIGN_CONST)
// Like :lockvar! name: lock the value and what it contains, but only
// if the reference count is up to one. That locks only literal
--- 3228,3235 ----
init_tv(tv);
}
! // ":const var = value" locks the value
! // ":final var = value" locks "var"
if (flags & ASSIGN_CONST)
// Like :lockvar! name: lock the value and what it contains, but only
// if the reference count is up to one. That locks only literal
*** ../vim-8.2.2194/src/testdir/test_vim9_func.vim 2020-12-22
21:19:35.293652280 +0100
--- src/testdir/test_vim9_func.vim 2020-12-22 22:01:29.245943446 +0100
***************
*** 1032,1038 ****
call Change()
unlet g:Aconst
END
! CheckScriptFailure(lines, 'E1122: Variable is locked: Aconst', 2)
enddef
" Test that inside :function a Python function can be defined, :def is not
--- 1032,1038 ----
call Change()
unlet g:Aconst
END
! CheckScriptFailure(lines, 'E741: Value is locked: Aconst', 2)
enddef
" Test that inside :function a Python function can be defined, :def is not
*** ../vim-8.2.2194/src/version.c 2020-12-22 21:19:35.293652280 +0100
--- src/version.c 2020-12-22 22:06:50.696786373 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2195,
/**/
--
The goal of science is to build better mousetraps.
The goal of nature is to build better mice.
/// 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/202012222108.0BML8cX62688507%40masaka.moolenaar.net.