forked from aniani/vim
patch 9.0.1611: v:maxcol can be changed in a :for loop
Problem: v:maxcol can be changed in a :for loop. Solution: Check for read-only loop variable. (closes #12470)
This commit is contained in:
@@ -3842,7 +3842,8 @@ set_var_const(
|
||||
}
|
||||
|
||||
if ((flags & ASSIGN_FOR_LOOP) == 0
|
||||
&& var_check_permission(di, name) == FAIL)
|
||||
? var_check_permission(di, name) == FAIL
|
||||
: var_check_ro(di->di_flags, name, FALSE))
|
||||
goto failed;
|
||||
}
|
||||
else
|
||||
|
@@ -126,6 +126,7 @@ func Test_for_invalid()
|
||||
call assert_fails("for x in 99", 'E1098:')
|
||||
call assert_fails("for x in function('winnr')", 'E1098:')
|
||||
call assert_fails("for x in {'a': 9}", 'E1098:')
|
||||
call assert_fails("for v:maxcol in range(1)", 'E46:')
|
||||
|
||||
if 0
|
||||
/1/5/2/s/\n
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1611,
|
||||
/**/
|
||||
1610,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user