patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Problem: Vim9: error for not using string doesn't mention argument.
Solution: Add argument number.
diff --git a/src/typval.c b/src/typval.c
index 1cdab93..6c4da0c 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -344,11 +344,14 @@
* 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 @@
* 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;