comparison src/evalfunc.c @ 22131:bd3541849208 v8.2.1615

patch 8.2.1615: Vim9: cannot pass "true" to searchdecl() Commit: https://github.com/vim/vim/commit/30788d3d37a90b0702d94b7272ed26672534ba6f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 5 21:35:16 2020 +0200 patch 8.2.1615: Vim9: cannot pass "true" to searchdecl() Problem: Vim9: cannot pass "true" to searchdecl(). Solution: use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6881)
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Sep 2020 21:45:03 +0200
parents 978f91276449
children 4fd33ca087e1
comparison
equal deleted inserted replaced
22130:2b7c85de5c77 22131:bd3541849208
6874 * "searchdecl()" function 6874 * "searchdecl()" function
6875 */ 6875 */
6876 static void 6876 static void
6877 f_searchdecl(typval_T *argvars, typval_T *rettv) 6877 f_searchdecl(typval_T *argvars, typval_T *rettv)
6878 { 6878 {
6879 int locally = 1; 6879 int locally = TRUE;
6880 int thisblock = 0; 6880 int thisblock = FALSE;
6881 int error = FALSE; 6881 int error = FALSE;
6882 char_u *name; 6882 char_u *name;
6883 6883
6884 rettv->vval.v_number = 1; // default: FAIL 6884 rettv->vval.v_number = 1; // default: FAIL
6885 6885
6886 name = tv_get_string_chk(&argvars[0]); 6886 name = tv_get_string_chk(&argvars[0]);
6887 if (argvars[1].v_type != VAR_UNKNOWN) 6887 if (argvars[1].v_type != VAR_UNKNOWN)
6888 { 6888 {
6889 locally = (int)tv_get_number_chk(&argvars[1], &error) == 0; 6889 locally = !(int)tv_get_bool_chk(&argvars[1], &error);
6890 if (!error && argvars[2].v_type != VAR_UNKNOWN) 6890 if (!error && argvars[2].v_type != VAR_UNKNOWN)
6891 thisblock = (int)tv_get_number_chk(&argvars[2], &error) != 0; 6891 thisblock = (int)tv_get_bool_chk(&argvars[2], &error);
6892 } 6892 }
6893 if (!error && name != NULL) 6893 if (!error && name != NULL)
6894 rettv->vval.v_number = find_decl(name, (int)STRLEN(name), 6894 rettv->vval.v_number = find_decl(name, (int)STRLEN(name),
6895 locally, thisblock, SEARCH_KEEP) == FAIL; 6895 locally, thisblock, SEARCH_KEEP) == FAIL;
6896 } 6896 }