comparison src/typval.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 86eb4aba16c3
children ba22d5536d3e
comparison
equal deleted inserted replaced
30014:3fb163e2ef6c 30015:adb0de8be4ce
501 check_for_list_arg(typval_T *args, int idx) 501 check_for_list_arg(typval_T *args, int idx)
502 { 502 {
503 if (args[idx].v_type != VAR_LIST) 503 if (args[idx].v_type != VAR_LIST)
504 { 504 {
505 semsg(_(e_list_required_for_argument_nr), idx + 1); 505 semsg(_(e_list_required_for_argument_nr), idx + 1);
506 return FAIL;
507 }
508 return OK;
509 }
510
511 /*
512 * Give an error and return FAIL unless "args[idx]" is a non-NULL list.
513 */
514 int
515 check_for_nonnull_list_arg(typval_T *args, int idx)
516 {
517 if (check_for_list_arg(args, idx) == FAIL)
518 return FAIL;
519
520 if (args[idx].vval.v_list == NULL)
521 {
522 semsg(_(e_non_null_list_required_for_argument_nr), idx + 1);
506 return FAIL; 523 return FAIL;
507 } 524 }
508 return OK; 525 return OK;
509 } 526 }
510 527