Mercurial > vim
comparison src/evalvars.c @ 21610:586241ee8096 v8.2.1355
patch 8.2.1355: Vim9: no error using :let for options and registers
Commit: https://github.com/vim/vim/commit/c2ee44cc382d4b097f51ea3251f00fb35493ea4f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 2 16:59:00 2020 +0200
patch 8.2.1355: Vim9: no error using :let for options and registers
Problem: Vim9: no error using :let for options and registers.
Solution: Give an error. (closes https://github.com/vim/vim/issues/6568)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Aug 2020 17:00:06 +0200 |
parents | 4e679db1c404 |
children | 3c6c52fbc8ea |
comparison
equal
deleted
inserted
replaced
21609:5f68185d8148 | 21610:586241ee8096 |
---|---|
1217 char_u *arg_end = NULL; | 1217 char_u *arg_end = NULL; |
1218 int len; | 1218 int len; |
1219 int opt_flags; | 1219 int opt_flags; |
1220 char_u *tofree = NULL; | 1220 char_u *tofree = NULL; |
1221 | 1221 |
1222 if (in_vim9script() && (flags & LET_NO_COMMAND) == 0 | |
1223 && vim_strchr((char_u *)"$@&", *arg) != NULL) | |
1224 { | |
1225 vim9_declare_error(arg); | |
1226 return NULL; | |
1227 } | |
1228 | |
1222 // ":let $VAR = expr": Set environment variable. | 1229 // ":let $VAR = expr": Set environment variable. |
1223 if (*arg == '$') | 1230 if (*arg == '$') |
1224 { | 1231 { |
1225 if (flags & LET_IS_CONST) | 1232 if (flags & LET_IS_CONST) |
1226 { | 1233 { |
1227 emsg(_("E996: Cannot lock an environment variable")); | 1234 emsg(_("E996: Cannot lock an environment variable")); |
1228 return NULL; | |
1229 } | |
1230 if (in_vim9script() && (flags & LET_NO_COMMAND) == 0) | |
1231 { | |
1232 vim9_declare_error(arg); | |
1233 return NULL; | 1235 return NULL; |
1234 } | 1236 } |
1235 | 1237 |
1236 // Find the end of the name. | 1238 // Find the end of the name. |
1237 ++arg; | 1239 ++arg; |
2425 } | 2427 } |
2426 } | 2428 } |
2427 else | 2429 else |
2428 { | 2430 { |
2429 scriptitem_T *si = SCRIPT_ITEM(import->imp_sid); | 2431 scriptitem_T *si = SCRIPT_ITEM(import->imp_sid); |
2430 svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) | 2432 svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) |
2431 + import->imp_var_vals_idx; | 2433 + import->imp_var_vals_idx; |
2432 tv = sv->sv_tv; | 2434 tv = sv->sv_tv; |
2433 } | 2435 } |
2434 } | 2436 } |
2435 } | 2437 } |