diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-28 21:06:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-28 21:06:08 +0200 |
commit | d0edaf9dc253e619ccc321ceaac321aee11c1ea5 (patch) | |
tree | 27559339d69ea3bcfaa8cc8e6a87fd6e752c0d4b /src/vim9compile.c | |
parent | dc3275a1ac73b6c4d0c9d2e238ea80b477705b6f (diff) |
patch 8.2.2897: Vim9: can use reserved words at the script levelv8.2.2897
Problem: Vim9: can use reserved words at the script level.
Solution: Check variable names for reserved words. (closes #8253)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 995c1d7491..2ea487de78 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -5594,14 +5594,6 @@ assignment_len(char_u *p, int *heredoc) return 0; } -// words that cannot be used as a variable -static char *reserved[] = { - "true", - "false", - "null", - NULL -}; - /* * Generate the load instruction for "name". */ @@ -5995,16 +5987,9 @@ compile_lhs( } else { - int idx; - // No specific kind of variable recognized, just a name. - for (idx = 0; reserved[idx] != NULL; ++idx) - if (STRCMP(reserved[idx], lhs->lhs_name) == 0) - { - semsg(_(e_cannot_use_reserved_name), lhs->lhs_name); - return FAIL; - } - + if (check_reserved_name(lhs->lhs_name) == FAIL) + return FAIL; if (lookup_local(var_start, lhs->lhs_varlen, &lhs->lhs_local_lvar, cctx) == OK) |