diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-09-02 15:15:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-02 15:15:27 +0100 |
commit | 8deb2b30c77035bb682ccf80b781455ac1d6038b (patch) | |
tree | 66a1d18ad9971c123f42bd7879c56706e19be73b /src/evalfunc.c | |
parent | 119167265ebc7eced210a7f8ed2f4b90378f98f1 (diff) |
patch 9.0.0359: error message for wrong argument type is not specificv9.0.0359
Problem: Error message for wrong argument type is not specific.
Solution: Include more information in the error. (Yegappan Lakshmanan,
closes #11037)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index c7cf32297e..7c122e1b46 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3607,17 +3607,13 @@ f_deepcopy(typval_T *argvars, typval_T *rettv) { varnumber_T noref = 0; - if (in_vim9script() - && (check_for_opt_bool_arg(argvars, 1) == FAIL)) + if (check_for_opt_bool_arg(argvars, 1) == FAIL) return; if (argvars[1].v_type != VAR_UNKNOWN) noref = tv_get_bool_chk(&argvars[1], NULL); - if (noref < 0 || noref > 1) - semsg(_(e_using_number_as_bool_nr), noref); - else - item_copy(&argvars[0], rettv, TRUE, TRUE, - noref == 0 ? get_copyID() : 0); + + item_copy(&argvars[0], rettv, TRUE, TRUE, noref == 0 ? get_copyID() : 0); } /* @@ -5257,21 +5253,11 @@ f_gettagstack(typval_T *argvars, typval_T *rettv) static void f_gettext(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (check_for_nonempty_string_arg(argvars, 0) == FAIL) return; - if (argvars[0].v_type != VAR_STRING - || argvars[0].vval.v_string == NULL - || *argvars[0].vval.v_string == NUL) - { - semsg(_(e_invalid_argument_str), tv_get_string(&argvars[0])); - } - else - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave( - (char_u *)_(argvars[0].vval.v_string)); - } + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave((char_u *)_(argvars[0].vval.v_string)); } // for VIM_VERSION_ defines @@ -9641,7 +9627,9 @@ f_settagstack(typval_T *argvars, typval_T *rettv) // default is to replace the stack. if (argvars[2].v_type == VAR_UNKNOWN) action = 'r'; - else if (argvars[2].v_type == VAR_STRING) + else if (check_for_string_arg(argvars, 2) == FAIL) + return; + else { char_u *actstr; actstr = tv_get_string_chk(&argvars[2]); @@ -9656,11 +9644,6 @@ f_settagstack(typval_T *argvars, typval_T *rettv) return; } } - else - { - emsg(_(e_string_required)); - return; - } if (set_tagstack(wp, d, action) == OK) rettv->vval.v_number = 0; |