diff src/evalfunc.c @ 23592:2322b643e329 v8.2.2338

patch 8.2.2338: Vim9: no error if using job_info() result wrongly Commit: https://github.com/vim/vim/commit/64ed4d4398e92ac56a9bbd66d5ec992dd4c335f7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 12 21:22:31 2021 +0100 patch 8.2.2338: Vim9: no error if using job_info() result wrongly Problem: Vim9: no error if using job_info() result wrongly. Solution: Adjust return type on number of arguments. (closes https://github.com/vim/vim/issues/7667)
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Jan 2021 21:30:03 +0100
parents 510088f8c66f
children d3e064f54890
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -472,6 +472,13 @@ ret_dict_any(int argcount UNUSED, type_T
     return &t_dict_any;
 }
     static type_T *
+ret_job_info(int argcount, type_T **argtypes UNUSED)
+{
+    if (argcount == 0)
+	return &t_list_job;
+    return &t_dict_any;
+}
+    static type_T *
 ret_dict_number(int argcount UNUSED, type_T **argtypes UNUSED)
 {
     return &t_dict_number;
@@ -1100,7 +1107,7 @@ static funcentry_T global_functions[] =
     {"job_getchannel",	1, 1, FEARG_1,	    NULL,
 			ret_channel,	    JOB_FUNC(f_job_getchannel)},
     {"job_info",	0, 1, FEARG_1,	    NULL,
-			ret_dict_any,	    JOB_FUNC(f_job_info)},
+			ret_job_info,	    JOB_FUNC(f_job_info)},
     {"job_setoptions",	2, 2, FEARG_1,	    NULL,
 			ret_void,	    JOB_FUNC(f_job_setoptions)},
     {"job_start",	1, 2, FEARG_1,	    NULL,