summaryrefslogtreecommitdiff
path: root/src/typval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-22 22:21:26 +0100
committerBram Moolenaar <Bram@vim.org>2021-03-22 22:21:26 +0100
commitf28f2ac425600b88da0bdcc12a82cd620f575681 (patch)
treeb8101a4aee337f1b41dbd51f6e8cea5a6c48a2ff /src/typval.c
parent49f1e9ec3e7f4e1b3572367d02a83c2b6ebbed97 (diff)
downloadvim-git-f28f2ac425600b88da0bdcc12a82cd620f575681.tar.gz
patch 8.2.2646: Vim9: error for not using string doesn't mentionargumentv8.2.2646
Problem: Vim9: error for not using string doesn't mention argument. Solution: Add argument number.
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/typval.c b/src/typval.c
index 1cdab93ef..6c4da0cf9 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -344,11 +344,14 @@ tv_get_float(typval_T *varp)
* Give an error and return FAIL unless "tv" is a string.
*/
int
-check_for_string(typval_T *tv)
+check_for_string(typval_T *tv, int arg)
{
if (tv->v_type != VAR_STRING)
{
- emsg(_(e_stringreq));
+ if (arg > 0)
+ semsg(_(e_string_required_for_argument_nr), arg);
+ else
+ emsg(_(e_stringreq));
return FAIL;
}
return OK;
@@ -358,13 +361,16 @@ check_for_string(typval_T *tv)
* Give an error and return FAIL unless "tv" is a non-empty string.
*/
int
-check_for_nonempty_string(typval_T *tv)
+check_for_nonempty_string(typval_T *tv, int arg)
{
- if (check_for_string(tv) == FAIL)
+ if (check_for_string(tv, arg) == FAIL)
return FAIL;
if (tv->vval.v_string == NULL || *tv->vval.v_string == NUL)
{
- emsg(_(e_non_empty_string_required));
+ if (arg > 0)
+ semsg(_(e_non_empty_string_required_for_argument_nr), arg);
+ else
+ emsg(_(e_non_empty_string_required));
return FAIL;
}
return OK;