diff src/userfunc.c @ 21263:71bd2f9adb61 v8.2.1182

patch 8.2.1182: Vim9: no check for whitespace after comma in lambda Commit: https://github.com/vim/vim/commit/914e7eaa67f8d816e15fb4a1180e6bece88d9742 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 11 15:20:48 2020 +0200 patch 8.2.1182: Vim9: no check for whitespace after comma in lambda Problem: Vim9: no check for whitespace after comma in lambda. Solution: Give error if white space is missing.
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Jul 2020 15:30:04 +0200
parents a4d00a2dadd6
children 8d1d11afd8c8
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -266,10 +266,20 @@ get_function_args(
 	    else if (any_default)
 	    {
 		emsg(_("E989: Non-default argument follows default argument"));
-		mustend = TRUE;
+		goto err_ret;
 	    }
 	    if (*p == ',')
+	    {
 		++p;
+		// Don't give this error when skipping, it makes the "->" not
+		// found in "{k,v -> x}" and give a confusing error.
+		if (!skip && in_vim9script()
+				      && !IS_WHITE_OR_NUL(*p) && *p != endchar)
+		{
+		    semsg(_(e_white_after), ",");
+		    goto err_ret;
+		}
+	    }
 	    else
 		mustend = TRUE;
 	}