summaryrefslogtreecommitdiffstats
path: root/src/ex_eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-17 12:45:15 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-17 12:45:15 +0100
commit0d03263fd731986c0eee1a08e0f1b19f1bc3a7ad (patch)
tree7777e5301a42e533fc3c51af7ea541816fb29985 /src/ex_eval.c
parent7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97 (diff)
patch 8.2.4970: "eval 123" gives an error, "eval 'abc'" does notv8.2.4970
Problem: "eval 123" gives an error, "eval 'abc'" does not. Solution: Also give an error when evaluating only a string. (closes #10434)
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index f3e2ca28cf..61d288157d 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -888,8 +888,8 @@ report_discard_pending(int pending, void *value)
}
/*
- * Return TRUE if "arg" is only a variable, register, environment variable or
- * option name.
+ * Return TRUE if "arg" is only a variable, register, environment variable,
+ * option name or string.
*/
int
cmd_is_name_only(char_u *arg)
@@ -904,6 +904,17 @@ cmd_is_name_only(char_u *arg)
if (*p != NUL)
++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
{
if (*p == '&')