Patch 8.2.3408
Problem: Can delete a numbered function. (Naohiro Ono)
Solution: Disallow deleting a numbered function. (closes #8760)
Files: src/userfunc.c, src/testdir/test_user_func.vim
*** ../vim-8.2.3407/src/userfunc.c 2021-09-05 16:36:20.235647849 +0200
--- src/userfunc.c 2021-09-06 20:55:38.984500156 +0200
***************
*** 4669,4674 ****
--- 4669,4681 ----
if (eap->nextcmd != NULL)
*p = NUL;
+ if (isdigit(*name) && fudi.fd_dict == NULL)
+ {
+ if (!eap->skip)
+ semsg(_(e_invarg2), eap->arg);
+ vim_free(name);
+ return;
+ }
if (!eap->skip)
fp = find_func(name, is_global, NULL);
vim_free(name);
*** ../vim-8.2.3407/src/testdir/test_user_func.vim 2021-05-25
20:13:56.316778428 +0200
--- src/testdir/test_user_func.vim 2021-09-06 20:55:11.704583952 +0200
***************
*** 434,439 ****
--- 434,444 ----
func d.fn()
return 1
endfunc
+
+ " cannot delete the dict function by number
+ let nr = substitute(execute('echo d'), '.*function(''\(\d\+\)'').*', '\1',
'')
+ call assert_fails('delfunction g:' .. nr, 'E475: Invalid argument: g:')
+
delfunc d.fn
call assert_equal({'a' : 10}, d)
endfunc
*** ../vim-8.2.3407/src/version.c 2021-09-06 19:19:41.595784061 +0200
--- src/version.c 2021-09-06 20:56:11.508400893 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3408,
/**/
--
The average life of an organization chart is six months. You can safely
ignore any order from your boss that would take six months to complete.
(Scott Adams - The Dilbert principle)
/// 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/202109061857.186IvR621436373%40masaka.moolenaar.net.