comparison src/time.c @ 30043:fd855ad74887 v9.0.0359

patch 9.0.0359: error message for wrong argument type is not specific Commit: https://github.com/vim/vim/commit/8deb2b30c77035bb682ccf80b781455ac1d6038b Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Sep 2 15:15:27 2022 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Sep 2022 16:30:07 +0200
parents 86eb4aba16c3
children 029c59bf78f1
comparison
equal deleted inserted replaced
30042:24d37e312b7b 30043:fd855ad74887
803 timer_T *timer = NULL; 803 timer_T *timer = NULL;
804 804
805 if (rettv_list_alloc(rettv) == FAIL) 805 if (rettv_list_alloc(rettv) == FAIL)
806 return; 806 return;
807 807
808 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) 808 if (check_for_opt_number_arg(argvars, 0) == FAIL)
809 return; 809 return;
810 810
811 if (argvars[0].v_type != VAR_UNKNOWN) 811 if (argvars[0].v_type != VAR_UNKNOWN)
812 { 812 {
813 if (argvars[0].v_type != VAR_NUMBER) 813 timer = find_timer((int)tv_get_number(&argvars[0]));
814 emsg(_(e_number_expected)); 814 if (timer != NULL)
815 else 815 add_timer_info(rettv, timer);
816 {
817 timer = find_timer((int)tv_get_number(&argvars[0]));
818 if (timer != NULL)
819 add_timer_info(rettv, timer);
820 }
821 } 816 }
822 else 817 else
823 add_timer_info_all(rettv); 818 add_timer_info_all(rettv);
824 } 819 }
825 820
907 void 902 void
908 f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED) 903 f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
909 { 904 {
910 timer_T *timer; 905 timer_T *timer;
911 906
912 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) 907 if (check_for_number_arg(argvars, 0) == FAIL)
913 return; 908 return;
914 909
915 if (argvars[0].v_type != VAR_NUMBER)
916 {
917 emsg(_(e_number_expected));
918 return;
919 }
920 timer = find_timer((int)tv_get_number(&argvars[0])); 910 timer = find_timer((int)tv_get_number(&argvars[0]));
921 if (timer != NULL) 911 if (timer != NULL)
922 stop_timer(timer); 912 stop_timer(timer);
923 } 913 }
924 914