diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-08 20:35:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-08 20:35:30 +0000 |
commit | dce2441a603f2c9343a4a46091283a32420d80a2 (patch) | |
tree | 649301b5de780305aa6869466f859fe86692d55a /src/userfunc.c | |
parent | 3a5988c025f8517ba382730dc54bb13df937edb4 (diff) | |
download | vim-git-8.2.4332.tar.gz |
patch 8.2.4332: Vim9: incomplete test for existing script variable in blockv8.2.4332
Problem: Vim9: incomplete test for existing script variable in block.
Solution: Add a couple more tests. Fix uncovered problem.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 0c54e3574..59415dbd7 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -55,6 +55,7 @@ func_tbl_get(void) * If "argtypes" is not NULL also get the type: "arg: type" (:def function). * If "types_optional" is TRUE a missing type is OK, use "any". * If "evalarg" is not NULL use it to check for an already declared name. + * If "eap" is not NULL use it to check for an already declared name. * Return a pointer to after the type. * When something is wrong return "arg". */ @@ -65,6 +66,7 @@ one_function_arg( garray_T *argtypes, int types_optional, evalarg_T *evalarg, + exarg_T *eap, int is_vararg, int skip) { @@ -87,7 +89,8 @@ one_function_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, TRUE) == FAIL) + evalarg == NULL ? NULL : evalarg->eval_cctx, + eap == NULL ? NULL : eap->cstack, TRUE) == FAIL) return arg; if (newargs != NULL && ga_grow(newargs, 1) == FAIL) @@ -210,7 +213,7 @@ get_function_args( int *varargs, garray_T *default_args, int skip, - exarg_T *eap, + exarg_T *eap, // can be NULL garray_T *lines_to_free) { int mustend = FALSE; @@ -279,7 +282,7 @@ get_function_args( arg = p; p = one_function_arg(p, newargs, argtypes, types_optional, - evalarg, TRUE, skip); + evalarg, eap, TRUE, skip); if (p == arg) break; if (*skipwhite(p) == '=') @@ -295,7 +298,7 @@ get_function_args( arg = p; p = one_function_arg(p, newargs, argtypes, types_optional, - evalarg, FALSE, skip); + evalarg, eap, FALSE, skip); if (p == arg) break; |