comparison src/evalfunc.c @ 21660:9a2ce62b93e9 v8.2.1380

patch 8.2.1380: Vim9: return type of getreg() is always a string Commit: https://github.com/vim/vim/commit/3d945cc925dddb99a1ee86ec194b5b95221c72d7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 6 21:26:59 2020 +0200 patch 8.2.1380: Vim9: return type of getreg() is always a string Problem: Vim9: return type of getreg() is always a string. Solution: Use list of strings when there are three arguments. (closes https://github.com/vim/vim/issues/6633)
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Aug 2020 21:30:04 +0200
parents 4dfd00f481fb
children f27187782dc6
comparison
equal deleted inserted replaced
21659:e7e3d2a0df51 21660:9a2ce62b93e9
389 || argtypes[0]->tt_type == VAR_DICT) 389 || argtypes[0]->tt_type == VAR_DICT)
390 return argtypes[0]->tt_member; 390 return argtypes[0]->tt_member;
391 if (argtypes[0]->tt_type == VAR_BLOB) 391 if (argtypes[0]->tt_type == VAR_BLOB)
392 return &t_number; 392 return &t_number;
393 return &t_any; 393 return &t_any;
394 }
395
396 static type_T *
397 ret_getreg(int argcount, type_T **argtypes UNUSED)
398 {
399 // Assume that if the third argument is passed it's non-zero
400 if (argcount == 3)
401 return &t_list_string;
402 return &t_string;
394 } 403 }
395 404
396 static type_T *ret_f_function(int argcount, type_T **argtypes); 405 static type_T *ret_f_function(int argcount, type_T **argtypes);
397 406
398 /* 407 /*
639 {"getmatches", 0, 1, 0, ret_list_dict_any, f_getmatches}, 648 {"getmatches", 0, 1, 0, ret_list_dict_any, f_getmatches},
640 {"getmousepos", 0, 0, 0, ret_dict_number, f_getmousepos}, 649 {"getmousepos", 0, 0, 0, ret_dict_number, f_getmousepos},
641 {"getpid", 0, 0, 0, ret_number, f_getpid}, 650 {"getpid", 0, 0, 0, ret_number, f_getpid},
642 {"getpos", 1, 1, FEARG_1, ret_list_number, f_getpos}, 651 {"getpos", 1, 1, FEARG_1, ret_list_number, f_getpos},
643 {"getqflist", 0, 1, 0, ret_list_or_dict_0, f_getqflist}, 652 {"getqflist", 0, 1, 0, ret_list_or_dict_0, f_getqflist},
644 {"getreg", 0, 3, FEARG_1, ret_string, f_getreg}, 653 {"getreg", 0, 3, FEARG_1, ret_getreg, f_getreg},
645 {"getreginfo", 0, 1, FEARG_1, ret_dict_any, f_getreginfo}, 654 {"getreginfo", 0, 1, FEARG_1, ret_dict_any, f_getreginfo},
646 {"getregtype", 0, 1, FEARG_1, ret_string, f_getregtype}, 655 {"getregtype", 0, 1, FEARG_1, ret_string, f_getregtype},
647 {"gettabinfo", 0, 1, FEARG_1, ret_list_dict_any, f_gettabinfo}, 656 {"gettabinfo", 0, 1, FEARG_1, ret_list_dict_any, f_gettabinfo},
648 {"gettabvar", 2, 3, FEARG_1, ret_any, f_gettabvar}, 657 {"gettabvar", 2, 3, FEARG_1, ret_any, f_gettabvar},
649 {"gettabwinvar", 3, 4, FEARG_1, ret_any, f_gettabwinvar}, 658 {"gettabwinvar", 3, 4, FEARG_1, ret_any, f_gettabwinvar},