diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-12 19:52:25 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-12 19:52:25 +0000 |
commit | a749a42ed25534c88c636e5ab6603f1f97b857a4 (patch) | |
tree | 2458c780205a1f80efd0e579ed2f75346a4d2085 /src/eval.c | |
parent | 6e28703a8e41f775f64e442c5d11ce1ff599aa3f (diff) |
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistenciesv8.2.4360
Problem: Vim9: allowing use of "s:" leads to inconsistencies.
Solution: Disallow using "s:" in Vim9 script at the script level.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 81a1dd0a97..261a397aa9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -878,6 +878,14 @@ get_lval( return lp->ll_name_end; } + // Cannot use "s:var" at the Vim9 script level. "s: type" is OK. + if (in_vim9script() && at_script_level() + && name[0] == 's' && name[1] == ':' && !VIM_ISWHITE(name[2])) + { + semsg(_(e_cannot_use_s_colon_in_vim9_script_str), name); + return NULL; + } + // Find the end of the name. p = find_name_end(name, &expr_start, &expr_end, fne_flags); lp->ll_name_end = p; @@ -3732,6 +3740,12 @@ eval7( emsg(_(e_cannot_use_underscore_here)); ret = FAIL; } + else if (evaluate && in_vim9script() && len > 2 + && s[0] == 's' && s[1] == ':') + { + semsg(_(e_cannot_use_s_colon_in_vim9_script_str), s); + ret = FAIL; + } else if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(') { // "name(..." recursive! |