Mercurial > vim
changeset 23614:455ad460ff4f v8.2.2349
patch 8.2.2349: Vim9: cannot handle line break after parenthesis at line end
Commit: https://github.com/vim/vim/commit/2415669348c455df0d1b9bf55b17a06d2f990c19
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 14 20:35:49 2021 +0100
patch 8.2.2349: Vim9: cannot handle line break after parenthesis at line end
Problem: Vim9: cannot handle line break after parenthesis at line end.
Solution: Skip over line break. (closes https://github.com/vim/vim/issues/7677)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 14 Jan 2021 20:45:05 +0100 |
parents | cbabd97da7d8 |
children | c96dd2e2ada2 |
files | src/testdir/test_vim9_expr.vim src/version.c src/vim9compile.c |
diffstat | 3 files changed, 26 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -2523,18 +2523,26 @@ enddef def Test_expr7_parens() # (expr) - assert_equal(4, (6 * 4) / 6) - assert_equal(0, 6 * ( 4 / 6 )) - - assert_equal(6, +6) - assert_equal(-6, -6) - assert_equal(false, !-3) - assert_equal(true, !+0) -enddef - -def Test_expr7_parens_vim9script() var lines =<< trim END - vim9script + assert_equal(4, (6 * 4) / 6) + assert_equal(0, 6 * ( 4 / 6 )) + + assert_equal(6, +6) + assert_equal(-6, -6) + assert_equal(false, !-3) + assert_equal(true, !+0) + + assert_equal(7, 5 + ( + 2)) + assert_equal(7, 5 + ( + 2 + )) + assert_equal(7, 5 + ( # comment + 2)) + assert_equal(7, 5 + ( # comment + # comment + 2)) + var s = ( 'one' .. @@ -2542,7 +2550,7 @@ def Test_expr7_parens_vim9script() ) assert_equal('onetwo', s) END - CheckScriptSuccess(lines) + CheckDefAndScriptSuccess(lines) enddef def Test_expr7_negate_add()
--- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2349, +/**/ 2348, /**/ 2347,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3554,8 +3554,10 @@ compile_leader(cctx_T *cctx, int numeric compile_parenthesis(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) { int ret; - - *arg = skipwhite(*arg + 1); + char_u *p = *arg + 1; + + if (may_get_next_line_error(p, arg, cctx) == FAIL) + return FAIL; if (ppconst->pp_used <= PPSIZE - 10) { ret = compile_expr1(arg, cctx, ppconst);