From f28f2ac425600b88da0bdcc12a82cd620f575681 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 22 Mar 2021 22:21:26 +0100 Subject: 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. --- src/typval.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/typval.c') 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; -- cgit v1.2.1