To: vim_dev@googlegroups.com Subject: Patch 8.2.4168 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4168 (after 8.2.4163) Problem: Disallowing empty function name breaks existing plugins. Solution: Allow empty function name in legacy script. Files: src/userfunc.c, src/testdir/test_autoload.vim, src/testdir/sautest/autoload/foo.vim *** ../vim-8.2.4167/src/userfunc.c 2022-01-20 19:56:45.551663706 +0000 --- src/userfunc.c 2022-01-21 10:23:47.162218934 +0000 *************** *** 3693,3700 **** // Note that TFN_ flags use the same values as GLV_ flags. end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, lead > 2 ? 0 : FNE_CHECK_START); ! if (end == start ! || (end != NULL && end[-1] == AUTOLOAD_CHAR && *end == '(')) { if (!skip) emsg(_(e_function_name_required)); --- 3693,3700 ---- // Note that TFN_ flags use the same values as GLV_ flags. end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, lead > 2 ? 0 : FNE_CHECK_START); ! if (end == start || (in_vim9script() && end != NULL ! && end[-1] == AUTOLOAD_CHAR && *end == '(')) { if (!skip) emsg(_(e_function_name_required)); *** ../vim-8.2.4167/src/testdir/test_autoload.vim 2020-08-12 17:50:31.871655841 +0100 --- src/testdir/test_autoload.vim 2022-01-21 10:30:10.854377174 +0000 *************** *** 10,15 **** --- 10,18 ---- call assert_equal(1, g:called_foo_bar_echo) eval 'bar'->g:foo#addFoo()->assert_equal('barfoo') + + " empty name works in legacy script + call assert_equal('empty', foo#()) endfunc func Test_source_autoload() *************** *** 23,26 **** --- 26,30 ---- call assert_equal(49, auto9#add42(7)) endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4167/src/testdir/sautest/autoload/foo.vim 2019-08-04 21:44:34.000000000 +0100 --- src/testdir/sautest/autoload/foo.vim 2022-01-21 10:25:56.847483083 +0000 *************** *** 9,11 **** --- 9,15 ---- func foo#addFoo(head) return a:head .. 'foo' endfunc + + func foo#() + return 'empty' + endfunc *** ../vim-8.2.4167/src/version.c 2022-01-20 21:32:50.331303977 +0000 --- src/version.c 2022-01-21 10:24:39.973105038 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4168, /**/ -- TIM: Too late. ARTHUR: What? TIM: There he is! [They all turn, and see a large white RABBIT lollop a few yards out of the cave. Accompanied by terrifying chord and jarring metallic monster noise.] "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///