0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.2.4662: no error for using out of range list index

Problem:    No error for using out of range list index.
Solution:   Check list index at script level like in compiled function.
            (closes #10051)
This commit is contained in:
Bram Moolenaar
2022-04-01 15:26:58 +01:00
parent ffe6e646dc
commit 22ebd172e4
8 changed files with 26 additions and 11 deletions

View File

@@ -1647,13 +1647,15 @@ ex_let_one(
{
lval_T lv;
char_u *p;
int lval_flags = (flags & (ASSIGN_NO_DECL | ASSIGN_DECL))
? GLV_NO_DECL : 0;
if (op != NULL && *op != '=')
lval_flags |= GLV_ASSIGN_WITH_OP;
// ":let var = expr": Set internal variable.
// ":let var: type = expr": Set internal variable with type.
// ":let {expr} = expr": Idem, name made with curly braces
p = get_lval(arg, tv, &lv, FALSE, FALSE,
(flags & (ASSIGN_NO_DECL | ASSIGN_DECL))
? GLV_NO_DECL : 0, FNE_CHECK_START);
p = get_lval(arg, tv, &lv, FALSE, FALSE, lval_flags, FNE_CHECK_START);
if (p != NULL && lv.ll_name != NULL)
{
if (endchars != NULL && vim_strchr(endchars,