diff src/vim9compile.c @ 22341:fc3350a38389 v8.2.1719

patch 8.2.1719: Vim9: no error if comma is missing in between arguments Commit: https://github.com/vim/vim/commit/10e4f12bf4cd08328618bbf4e57a15435296e586 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 20 22:43:52 2020 +0200 patch 8.2.1719: Vim9: no error if comma is missing in between arguments Problem: Vim9: no error if comma is missing in between arguments. Solution: Give an error message.
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Sep 2020 22:45:03 +0200
parents fb69b43d73f3
children 9f5a84baa464
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2290,6 +2290,7 @@ compile_arguments(char_u **arg, cctx_T *
 {
     char_u  *p = *arg;
     char_u  *whitep = *arg;
+    int	    must_end = FALSE;
 
     for (;;)
     {
@@ -2300,6 +2301,11 @@ compile_arguments(char_u **arg, cctx_T *
 	    *arg = p + 1;
 	    return OK;
 	}
+	if (must_end)
+	{
+	    semsg(_(e_missing_comma_before_argument_str), p);
+	    return FAIL;
+	}
 
 	if (compile_expr0(&p, cctx) == FAIL)
 	    return FAIL;
@@ -2316,6 +2322,8 @@ compile_arguments(char_u **arg, cctx_T *
 	    if (*p != NUL && !VIM_ISWHITE(*p))
 		semsg(_(e_white_space_required_after_str), ",");
 	}
+	else
+	    must_end = TRUE;
 	whitep = p;
 	p = skipwhite(p);
     }