diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-10 18:50:52 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-10 18:50:52 +0000 |
commit | 5e6b9882fe0218ae4878f6ad0561c8654a2277d8 (patch) | |
tree | 299fedea9366a67e12353910e03632dd9bf0236d | |
parent | 577bd85d55f30019c890ec80fd44d91108ec35c9 (diff) | |
download | vim-git-5e6b9882fe0218ae4878f6ad0561c8654a2277d8.tar.gz |
patch 8.2.4055: Vim9: line break in expression causes v:errmsg to be fillecv8.2.4055
Problem: Vim9: line break in expression causes v:errmsg to be filled.
(Yegappan Lakshmanan)
Solution: Do not give an error when skipping over an expression.
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 16 | ||||
-rw-r--r-- | src/userfunc.c | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 52237e33f..039387dc3 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -3147,6 +3147,22 @@ def Test_expr7_method_call() CheckDefExecFailure(lines, 'E1013:') enddef +def Test_expr7_method_call_linebreak() + # this was giving an error when skipping over the expression + var lines =<< trim END + vim9script + def Test() + var a: dict<any> = {b: {}} + a.b->extend({f1: 1, + f2: 2}) + echo a + enddef + defcompile + assert_equal('', v:errmsg) + END + CheckScriptSuccess(lines) +enddef + def Test_expr7_not() var lines =<< trim END diff --git a/src/userfunc.c b/src/userfunc.c index a3ff38c0a..48f5890e8 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1703,6 +1703,8 @@ get_func_tv( typval_T argvars[MAX_FUNC_ARGS + 1]; // vars for arguments int argcount = 0; // number of arguments found int vim9script = in_vim9script(); + int evaluate = evalarg == NULL + ? FALSE : (evalarg->eval_flags & EVAL_EVALUATE); /* * Get the arguments. @@ -1728,7 +1730,9 @@ get_func_tv( { if (*argp != ',' && *skipwhite(argp) == ',') { - semsg(_(e_no_white_space_allowed_before_str_str), ",", argp); + if (evaluate) + semsg(_(e_no_white_space_allowed_before_str_str), + ",", argp); ret = FAIL; break; } @@ -1739,7 +1743,8 @@ get_func_tv( break; if (vim9script && !IS_WHITE_OR_NUL(argp[1])) { - semsg(_(e_white_space_required_after_str_str), ",", argp); + if (evaluate) + semsg(_(e_white_space_required_after_str_str), ",", argp); ret = FAIL; break; } @@ -1778,7 +1783,7 @@ get_func_tv( funcargs.ga_len -= i; } - else if (!aborting()) + else if (!aborting() && evaluate) { if (argcount == MAX_FUNC_ARGS) emsg_funcname(e_too_many_arguments_for_function_str_2, name); diff --git a/src/version.c b/src/version.c index 7d080c40b..e46a3802b 100644 --- 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 */ /**/ + 4055, +/**/ 4054, /**/ 4053, |