mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.3053: Vim9: cannot assign to @@ in :def function
Problem: Vim9: cannot assign to @@ in :def function Solution: Handle '@' like '"'.
This commit is contained in:
@@ -228,16 +228,6 @@ def Test_assignment()
|
||||
CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')
|
||||
CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1012:')
|
||||
|
||||
lines =<< trim END
|
||||
@c = 'areg'
|
||||
@c ..= 'add'
|
||||
assert_equal('aregadd', @c)
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
|
||||
CheckDefFailure(['@a += "more"'], 'E1051:')
|
||||
CheckDefFailure(['@a += 123'], 'E1012:')
|
||||
|
||||
v:errmsg = 'none'
|
||||
v:errmsg ..= 'again'
|
||||
assert_equal('noneagain', v:errmsg)
|
||||
@@ -249,6 +239,21 @@ def Test_assignment()
|
||||
END
|
||||
enddef
|
||||
|
||||
def Test_assign_register()
|
||||
var lines =<< trim END
|
||||
@c = 'areg'
|
||||
@c ..= 'add'
|
||||
assert_equal('aregadd', @c)
|
||||
|
||||
@@ = 'some text'
|
||||
assert_equal('some text', getreg('"'))
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
|
||||
CheckDefFailure(['@a += "more"'], 'E1051:')
|
||||
CheckDefFailure(['@a += 123'], 'E1012:')
|
||||
enddef
|
||||
|
||||
def Test_reserved_name()
|
||||
for name in ['true', 'false', 'null']
|
||||
CheckDefExecAndScriptFailure(['var ' .. name .. ' = 0'], 'E1034:')
|
||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3053,
|
||||
/**/
|
||||
3052,
|
||||
/**/
|
||||
|
@@ -5854,7 +5854,8 @@ get_var_dest(
|
||||
}
|
||||
else if (*name == '@')
|
||||
{
|
||||
if (!valid_yank_reg(name[1], FALSE) || name[1] == '.')
|
||||
if (name[1] != '@'
|
||||
&& (!valid_yank_reg(name[1], FALSE) || name[1] == '.'))
|
||||
{
|
||||
emsg_invreg(name[1]);
|
||||
return FAIL;
|
||||
|
Reference in New Issue
Block a user