comparison src/userfunc.c @ 23996:c192411b27e8 v8.2.2540

patch 8.2.2540: Vim9: no error for using script var name for argument Commit: https://github.com/vim/vim/commit/b4893b84507570f24af32597716ffb67fb0ef24e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 21 22:20:24 2021 +0100 patch 8.2.2540: Vim9: no error for using script var name for argument Problem: Vim9: no error for using script var name for argument. Solution: Check for this error. (closes https://github.com/vim/vim/issues/7868)
author Bram Moolenaar <Bram@vim.org>
date Sun, 21 Feb 2021 22:30:05 +0100
parents 686af23ec132
children 90fbe1a3b23c
comparison
equal deleted inserted replaced
23995:ac050d89a914 23996:c192411b27e8
78 { 78 {
79 if (!skip) 79 if (!skip)
80 semsg(_("E125: Illegal argument: %s"), arg); 80 semsg(_("E125: Illegal argument: %s"), arg);
81 return arg; 81 return arg;
82 } 82 }
83
84 // Vim9 script: cannot use script var name for argument.
85 if (argtypes != NULL && script_var_exists(arg, p - arg, FALSE, NULL) == OK)
86 {
87 semsg(_(e_variable_already_declared_in_script), arg);
88 return arg;
89 }
90
83 if (newargs != NULL && ga_grow(newargs, 1) == FAIL) 91 if (newargs != NULL && ga_grow(newargs, 1) == FAIL)
84 return arg; 92 return arg;
85 if (newargs != NULL) 93 if (newargs != NULL)
86 { 94 {
87 int c; 95 int c;