To: vim_dev@googlegroups.com Subject: Patch 8.2.0276 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0276 Problem: Vim9: not allowing space before ")" in function call is too restrictive. (Ben Jackson) Solution: Skip space before the ")". Adjust other space checks. Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.0275/src/vim9compile.c 2020-02-17 21:12:05.073229752 +0100 --- src/vim9compile.c 2020-02-19 12:10:57.887878205 +0100 *************** *** 1658,1666 **** if (compile_expr1(&p, cctx) == FAIL) return FAIL; ++*argcount; if (*p == ',') ! p = skipwhite(p + 1); } if (*p != ')') { emsg(_(e_missing_close)); --- 1658,1678 ---- if (compile_expr1(&p, cctx) == FAIL) return FAIL; ++*argcount; + + if (*p != ',' && *skipwhite(p) == ',') + { + emsg(_("E1068: No white space allowed before ,")); + p = skipwhite(p); + } if (*p == ',') ! { ! ++p; ! if (!VIM_ISWHITE(*p)) ! emsg(_("E1069: white space required after ,")); ! } ! p = skipwhite(p); } + p = skipwhite(p); if (*p != ')') { emsg(_(e_missing_close)); *** ../vim-8.2.0275/src/testdir/test_vim9_expr.vim 2020-02-17 21:12:05.073229752 +0100 --- src/testdir/test_vim9_expr.vim 2020-02-19 12:38:36.335844128 +0100 *************** *** 9,14 **** --- 9,22 ---- call delete('Xdef') endfunc + " Check that "line" inside ":def" results in an "error" message when executed. + func CheckDefExecFailure(line, error) + call writefile(['def! Func()', a:line, 'enddef'], 'Xdef') + so Xdef + call assert_fails('call Func()', a:error, a:line) + call delete('Xdef') + endfunc + func CheckDefFailureList(lines, error) call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef') call assert_fails('so Xdef', a:error, string(a:lines)) *************** *** 725,733 **** --- 733,749 ---- return a:arg endfunc + func CallMe2(one, two) + return a:one .. a:two + endfunc + def Test_expr7_trailing() " user function call assert_equal(123, CallMe(123)) + assert_equal(123, CallMe( 123)) + assert_equal(123, CallMe(123 )) + assert_equal('yesno', CallMe2('yes', 'no')) + assert_equal('yesno', CallMe2( 'yes', 'no' )) assert_equal('nothing', CallMe('nothing')) " partial call *************** *** 761,764 **** --- 777,784 ---- func Test_expr_fails() call CheckDefFailure("let x = '1'is2", 'E488:') call CheckDefFailure("let x = '1'isnot2", 'E488:') + + call CheckDefExecFailure("CallMe ('yes')", 'E492:') + call CheckDefFailure("CallMe2('yes','no')", 'E1069:') + call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:') endfunc *** ../vim-8.2.0275/src/version.c 2020-02-18 21:54:36.982093690 +0100 --- src/version.c 2020-02-19 11:54:10.252182035 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 276, /**/ -- From "know your smileys": <<<:-{ Worf (Never smiles anyways, so he's a bad smiley) /// 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 ///