To: vim_dev@googlegroups.com Subject: Patch 8.2.3408 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///