mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.0359: error message for wrong argument type is not specific
Problem: Error message for wrong argument type is not specific. Solution: Include more information in the error. (Yegappan Lakshmanan, closes #11037)
This commit is contained in:
committed by
Bram Moolenaar
parent
119167265e
commit
8deb2b30c7
@@ -960,11 +960,8 @@ string_reduce(
|
||||
return;
|
||||
p += STRLEN(rettv->vval.v_string);
|
||||
}
|
||||
else if (argvars[2].v_type != VAR_STRING)
|
||||
{
|
||||
semsg(_(e_string_expected_for_argument_nr), 3);
|
||||
else if (check_for_string_arg(argvars, 2) == FAIL)
|
||||
return;
|
||||
}
|
||||
else
|
||||
copy_tv(&argvars[2], rettv);
|
||||
|
||||
@@ -1047,21 +1044,11 @@ f_charidx(typval_T *argvars, typval_T *rettv)
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_string_arg(argvars, 0) == FAIL
|
||||
if ((check_for_string_arg(argvars, 0) == FAIL
|
||||
|| check_for_number_arg(argvars, 1) == FAIL
|
||||
|| check_for_opt_bool_arg(argvars, 2) == FAIL))
|
||||
return;
|
||||
|
||||
if (argvars[0].v_type != VAR_STRING || argvars[1].v_type != VAR_NUMBER
|
||||
|| (argvars[2].v_type != VAR_UNKNOWN
|
||||
&& argvars[2].v_type != VAR_NUMBER
|
||||
&& argvars[2].v_type != VAR_BOOL))
|
||||
{
|
||||
emsg(_(e_invalid_argument));
|
||||
return;
|
||||
}
|
||||
|
||||
str = tv_get_string_chk(&argvars[0]);
|
||||
idx = tv_get_number_chk(&argvars[1], NULL);
|
||||
if (str == NULL || idx < 0)
|
||||
@@ -1783,11 +1770,8 @@ f_trim(typval_T *argvars, typval_T *rettv)
|
||||
if (head == NULL)
|
||||
return;
|
||||
|
||||
if (argvars[1].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_STRING)
|
||||
{
|
||||
semsg(_(e_invalid_argument_str), tv_get_string(&argvars[1]));
|
||||
if (check_for_opt_string_arg(argvars, 1) == FAIL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (argvars[1].v_type == VAR_STRING)
|
||||
{
|
||||
|
Reference in New Issue
Block a user