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

patch 8.2.3656: Vim9: no error for an evironment variable by itself

Problem:    Vim9: no error for an evironment variable by itself.
Solution:   Give a "without effect" error. (closes #9166)
This commit is contained in:
Bram Moolenaar
2021-11-23 14:52:06 +00:00
parent cc9d725bbb
commit 65259b5c6a
3 changed files with 13 additions and 1 deletions

View File

@@ -888,7 +888,8 @@ report_discard_pending(int pending, void *value)
} }
/* /*
* Return TRUE if "arg" is only a variable, register or option name. * Return TRUE if "arg" is only a variable, register, environment variable or
* option name.
*/ */
int int
cmd_is_name_only(char_u *arg) cmd_is_name_only(char_u *arg)
@@ -911,6 +912,8 @@ cmd_is_name_only(char_u *arg)
if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0) if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
p += 2; p += 2;
} }
else if (*p == '$')
++p;
get_name_len(&p, &alias, FALSE, FALSE); get_name_len(&p, &alias, FALSE, FALSE);
} }
name_only = ends_excmd2(arg, skipwhite(p)); name_only = ends_excmd2(arg, skipwhite(p));

View File

@@ -584,6 +584,13 @@ def Test_use_register()
END END
CheckDefAndScriptFailure(lines, 'E1207:', 2) CheckDefAndScriptFailure(lines, 'E1207:', 2)
&g:showbreak = '' &g:showbreak = ''
lines =<< trim END
$SomeEnv = 'value'
$SomeEnv
END
CheckDefAndScriptFailure(lines, 'E1207:', 2)
$SomeEnv = ''
enddef enddef
def Test_environment_use_linebreak() def Test_environment_use_linebreak()

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3656,
/**/ /**/
3655, 3655,
/**/ /**/