diff src/userfunc.c @ 32586:304341915488 v9.0.1625

patch 9.0.1625: "super" is not considered a reserved name Commit: https://github.com/vim/vim/commit/ce723f391844695a07d9af02ef60330afd3e158c Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 10 19:00:12 2023 +0100 patch 9.0.1625: "super" is not considered a reserved name Problem: "super" is not considered a reserved name. Solution: Add "super" to the list of reserved names. (closes https://github.com/vim/vim/issues/12515)
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Jun 2023 20:15:04 +0200
parents 2d1eba13035c
children 448aef880252
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -86,12 +86,23 @@ one_function_arg(
 	return arg;
     }
 
-    // Vim9 script: cannot use script var name for argument. In function: also
-    // check local vars and arguments.
-    if (!skip && argtypes != NULL && check_defined(arg, p - arg,
-			       evalarg == NULL ? NULL : evalarg->eval_cctx,
+    // Extra checks in Vim9 script.
+    if (!skip && argtypes != NULL)
+    {
+	int c = *p;
+	*p = NUL;
+	int r = check_reserved_name(arg, FALSE);
+	*p = c;
+	if (r == FAIL)
+	    return arg;
+
+	// Cannot use script var name for argument. In function: also check
+	// local vars and arguments.
+	if (check_defined(arg, p - arg,
+				   evalarg == NULL ? NULL : evalarg->eval_cctx,
 			       eap == NULL ? NULL : eap->cstack, TRUE) == FAIL)
-	return arg;
+	    return arg;
+    }
 
     if (newargs != NULL && ga_grow(newargs, 1) == FAIL)
 	return arg;