diff src/eval.c @ 24408:96e0b898d5b4 v8.2.2744

patch 8.2.2744: Vim9: no way to explicitly ignore an argument Commit: https://github.com/vim/vim/commit/962c43bf0d6a33b905f2acd920d3701476ebb5c9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 10 17:18:09 2021 +0200 patch 8.2.2744: Vim9: no way to explicitly ignore an argument Problem: Vim9: no way to explicitly ignore an argument. Solution: Use the underscore as the name for an ignored argument.
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Apr 2021 17:30:03 +0200
parents 1a145eb83a28
children 78343859f42d
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -3514,7 +3514,12 @@ eval7(
 	{
 	    int	    flags = evalarg == NULL ? 0 : evalarg->eval_flags;
 
-	    if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
+	    if (in_vim9script() && len == 1 && *s == '_')
+	    {
+		emsg(_(e_cannot_use_underscore_here));
+		ret = FAIL;
+	    }
+	    else if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
 	    {
 		// "name(..."  recursive!
 		*arg = skipwhite(*arg);