mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.4970: "eval 123" gives an error, "eval 'abc'" does not
Problem: "eval 123" gives an error, "eval 'abc'" does not. Solution: Also give an error when evaluating only a string. (closes #10434)
This commit is contained in:
@@ -888,8 +888,8 @@ report_discard_pending(int pending, void *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "arg" is only a variable, register, environment variable or
|
* Return TRUE if "arg" is only a variable, register, environment variable,
|
||||||
* option name.
|
* option name or string.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cmd_is_name_only(char_u *arg)
|
cmd_is_name_only(char_u *arg)
|
||||||
@@ -904,6 +904,17 @@ cmd_is_name_only(char_u *arg)
|
|||||||
if (*p != NUL)
|
if (*p != NUL)
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
else if (*p == '\'' || *p == '"')
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (*p == '"')
|
||||||
|
r = eval_string(&p, NULL, FALSE, FALSE);
|
||||||
|
else
|
||||||
|
r = eval_lit_string(&p, NULL, FALSE, FALSE);
|
||||||
|
if (r == FAIL)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*p == '&')
|
if (*p == '&')
|
||||||
|
@@ -697,6 +697,16 @@ def Test_use_register()
|
|||||||
END
|
END
|
||||||
v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
|
v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
|
||||||
$SomeEnv = ''
|
$SomeEnv = ''
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
eval 'value'
|
||||||
|
END
|
||||||
|
v9.CheckDefAndScriptFailure(lines, 'E1207:', 1)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
eval "value"
|
||||||
|
END
|
||||||
|
v9.CheckDefAndScriptFailure(lines, 'E1207:', 1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_environment_use_linebreak()
|
def Test_environment_use_linebreak()
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4970,
|
||||||
/**/
|
/**/
|
||||||
4969,
|
4969,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user