Mercurial > vim
diff src/typval.c @ 24210:083f07f99e20 v8.2.2646
patch 8.2.2646: Vim9: error for not using string doesn't mentionargument
Commit: https://github.com/vim/vim/commit/f28f2ac425600b88da0bdcc12a82cd620f575681
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 22 22:21:26 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Mar 2021 22:30:03 +0100 |
parents | 5db7d275543c |
children | 35603c7991d7 |
line wrap: on
line diff
--- 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;