diff 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
line wrap: on
line diff
--- a/src/time.c
+++ b/src/time.c
@@ -805,19 +805,14 @@ f_timer_info(typval_T *argvars, typval_T
     if (rettv_list_alloc(rettv) == FAIL)
 	return;
 
-    if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+    if (check_for_opt_number_arg(argvars, 0) == FAIL)
 	return;
 
     if (argvars[0].v_type != VAR_UNKNOWN)
     {
-	if (argvars[0].v_type != VAR_NUMBER)
-	    emsg(_(e_number_expected));
-	else
-	{
-	    timer = find_timer((int)tv_get_number(&argvars[0]));
-	    if (timer != NULL)
-		add_timer_info(rettv, timer);
-	}
+	timer = find_timer((int)tv_get_number(&argvars[0]));
+	if (timer != NULL)
+	    add_timer_info(rettv, timer);
     }
     else
 	add_timer_info_all(rettv);
@@ -909,14 +904,9 @@ f_timer_stop(typval_T *argvars, typval_T
 {
     timer_T *timer;
 
-    if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+    if (check_for_number_arg(argvars, 0) == FAIL)
 	return;
 
-    if (argvars[0].v_type != VAR_NUMBER)
-    {
-	emsg(_(e_number_expected));
-	return;
-    }
     timer = find_timer((int)tv_get_number(&argvars[0]));
     if (timer != NULL)
 	stop_timer(timer);