Patch 8.2.3651
Problem: Vim9: no error for :lock or :unlock with unknown variable.
Solution: Give an error. (closes #9188)
Files: src/evalvars.c, src/errors.h, src/testdir/test_vim9_cmd.vim
*** ../vim-8.2.3650/src/evalvars.c 2021-11-22 20:10:14.882598756 +0000
--- src/evalvars.c 2021-11-22 21:52:02.814630751 +0000
***************
*** 1827,1833 ****
--- 1827,1838 ----
// Normal name or expanded name.
di = find_var(lp->ll_name, NULL, TRUE);
if (di == NULL)
+ {
+ if (in_vim9script())
+ semsg(_(e_cannot_find_variable_to_unlock_str),
+ lp->ll_name);
ret = FAIL;
+ }
else if ((di->di_flags & DI_FLAGS_FIX)
&& di->di_tv.v_type != VAR_DICT
&& di->di_tv.v_type != VAR_LIST)
*** ../vim-8.2.3650/src/errors.h 2021-11-22 15:37:11.748625338 +0000
--- src/errors.h 2021-11-22 21:50:29.842588377 +0000
***************
*** 686,688 ****
--- 686,690 ----
INIT(= N_("E1244: Bad color string: %s"));
EXTERN char e_cannot_expand_sfile_in_vim9_function[]
INIT(= N_("E1245: Cannot expand <sfile> in a Vim9 function"));
+ EXTERN char e_cannot_find_variable_to_unlock_str[]
+ INIT(= N_("E1246: Cannot find variable to (un)lock: %s"));
*** ../vim-8.2.3650/src/testdir/test_vim9_cmd.vim 2021-11-22
15:05:42.713617025 +0000
--- src/testdir/test_vim9_cmd.vim 2021-11-22 21:55:53.182675346 +0000
***************
*** 1370,1375 ****
--- 1370,1392 ----
unlockvar theList
END
CheckDefFailure(lines, 'E1178', 2)
+
+ lines =<< trim END
+ vim9script
+ var name = 'john'
+ lockvar nameX
+ END
+ CheckScriptFailure(lines, 'E1246', 3)
+
+ lines =<< trim END
+ vim9script
+ var name = 'john'
+ def LockIt()
+ lockvar nameX
+ enddef
+ LockIt()
+ END
+ CheckScriptFailure(lines, 'E1246', 1)
enddef
def Test_substitute_expr()
*** ../vim-8.2.3650/src/version.c 2021-11-22 20:10:14.886598758 +0000
--- src/version.c 2021-11-22 21:57:59.246672353 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3651,
/**/
--
SIGFUN -- signature too funny (core dumped)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20211122215913.2553E1C3E09%40moolenaar.net.