patch 9.0.0230: no error for comma missing in list in :def function
Problem: No error for comma missing in list in :def function.
Solution: Check for missing comma. (closes #10943)
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 8cd095c..370dce3 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -975,6 +975,7 @@
int count = 0;
int is_const;
int is_all_const = TRUE; // reset when non-const encountered
+ int must_end = FALSE;
for (;;)
{
@@ -993,6 +994,11 @@
++p;
break;
}
+ if (must_end)
+ {
+ semsg(_(e_missing_comma_in_list_str), p);
+ return FAIL;
+ }
if (compile_expr0_ext(&p, cctx, &is_const) == FAIL)
return FAIL;
if (!is_const)
@@ -1007,6 +1013,8 @@
return FAIL;
}
}
+ else
+ must_end = TRUE;
whitep = p;
p = skipwhite(p);
}