Mercurial > vim
comparison src/filepath.c @ 30015:adb0de8be4ce v9.0.0345
patch 9.0.0345: error message for list argument could be clearer
Commit: https://github.com/vim/vim/commit/d83392a43a48c566c0f3b76382a3648584dae32b
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 1 12:22:46 2022 +0100
patch 9.0.0345: error message for list argument could be clearer
Problem: Error message for list argument could be clearer.
Solution: Include the argument number. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11027)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Sep 2022 13:30:05 +0200 |
parents | 3276298c67c5 |
children | f005dea14c8b |
comparison
equal
deleted
inserted
replaced
30014:3fb163e2ef6c | 30015:adb0de8be4ce |
---|---|
1601 char_u *name = (char_u *)item; | 1601 char_u *name = (char_u *)item; |
1602 | 1602 |
1603 return checkitem_common(context, name, NULL); | 1603 return checkitem_common(context, name, NULL); |
1604 } | 1604 } |
1605 | 1605 |
1606 /* | |
1607 * Process the keys in the Dict argument to the readdir() and readdirex() | |
1608 * functions. Assumes the Dict argument is the 3rd argument. | |
1609 */ | |
1606 static int | 1610 static int |
1607 readdirex_dict_arg(typval_T *tv, int *cmp) | 1611 readdirex_dict_arg(typval_T *argvars, int *cmp) |
1608 { | 1612 { |
1609 char_u *compare; | 1613 char_u *compare; |
1610 | 1614 |
1611 if (tv->v_type != VAR_DICT) | 1615 if (check_for_nonnull_dict_arg(argvars, 2) == FAIL) |
1612 { | |
1613 emsg(_(e_dictionary_required)); | |
1614 return FAIL; | 1616 return FAIL; |
1615 } | 1617 |
1616 | 1618 if (dict_has_key(argvars[2].vval.v_dict, "sort")) |
1617 if (dict_has_key(tv->vval.v_dict, "sort")) | 1619 compare = dict_get_string(argvars[2].vval.v_dict, "sort", FALSE); |
1618 compare = dict_get_string(tv->vval.v_dict, "sort", FALSE); | |
1619 else | 1620 else |
1620 { | 1621 { |
1621 semsg(_(e_dictionary_key_str_required), "sort"); | 1622 semsg(_(e_dictionary_key_str_required), "sort"); |
1622 return FAIL; | 1623 return FAIL; |
1623 } | 1624 } |
1658 | 1659 |
1659 path = tv_get_string(&argvars[0]); | 1660 path = tv_get_string(&argvars[0]); |
1660 expr = &argvars[1]; | 1661 expr = &argvars[1]; |
1661 | 1662 |
1662 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && | 1663 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && |
1663 readdirex_dict_arg(&argvars[2], &sort) == FAIL) | 1664 readdirex_dict_arg(argvars, &sort) == FAIL) |
1664 return; | 1665 return; |
1665 | 1666 |
1666 ret = readdir_core(&ga, path, FALSE, (void *)expr, | 1667 ret = readdir_core(&ga, path, FALSE, (void *)expr, |
1667 (expr->v_type == VAR_UNKNOWN) ? NULL : readdir_checkitem, sort); | 1668 (expr->v_type == VAR_UNKNOWN) ? NULL : readdir_checkitem, sort); |
1668 if (ret == OK) | 1669 if (ret == OK) |
1711 | 1712 |
1712 path = tv_get_string(&argvars[0]); | 1713 path = tv_get_string(&argvars[0]); |
1713 expr = &argvars[1]; | 1714 expr = &argvars[1]; |
1714 | 1715 |
1715 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && | 1716 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && |
1716 readdirex_dict_arg(&argvars[2], &sort) == FAIL) | 1717 readdirex_dict_arg(argvars, &sort) == FAIL) |
1717 return; | 1718 return; |
1718 | 1719 |
1719 ret = readdir_core(&ga, path, TRUE, (void *)expr, | 1720 ret = readdir_core(&ga, path, TRUE, (void *)expr, |
1720 (expr->v_type == VAR_UNKNOWN) ? NULL : readdirex_checkitem, sort); | 1721 (expr->v_type == VAR_UNKNOWN) ? NULL : readdirex_checkitem, sort); |
1721 if (ret == OK) | 1722 if (ret == OK) |