To: vim_dev@googlegroups.com Subject: Patch 8.2.2405 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2405 Problem: Vim9: no need to allow white space before "(" for :def. Solution: Give an error for stray white space. (issue #7734) Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.2404/src/userfunc.c 2021-01-24 12:53:30.780247041 +0100 --- src/userfunc.c 2021-01-24 21:12:33.076903484 +0100 *************** *** 3199,3204 **** --- 3199,3210 ---- p = vim_strchr(p, '('); } + if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1])) + { + semsg(_(e_no_white_space_allowed_before_str), "("); + goto ret_free; + } + // In Vim9 script only global functions can be redefined. if (vim9script && eap->forceit && !is_global) { *** ../vim-8.2.2404/src/testdir/test_vim9_func.vim 2021-01-21 20:21:24.244670457 +0100 --- src/testdir/test_vim9_func.vim 2021-01-24 21:11:57.220997330 +0100 *************** *** 116,121 **** --- 116,153 ---- CheckScriptFailure(lines, 'E126:', 2) enddef + def Test_white_space_before_paren() + var lines =<< trim END + vim9script + def Test () + echo 'test' + enddef + END + CheckScriptFailure(lines, 'E1068:', 2) + + lines =<< trim END + vim9script + func Test () + echo 'test' + endfunc + END + CheckScriptFailure(lines, 'E1068:', 2) + + lines =<< trim END + def Test () + echo 'test' + enddef + END + CheckScriptFailure(lines, 'E1068:', 1) + + lines =<< trim END + func Test () + echo 'test' + endfunc + END + CheckScriptSuccess(lines) + enddef + def Test_enddef_dict_key() var d = { enddef: 'x', *** ../vim-8.2.2404/src/version.c 2021-01-24 20:51:56.788245240 +0100 --- src/version.c 2021-01-24 21:10:39.933199895 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2405, /**/ -- Get a life? What is the URL where it can be downloaded? /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///