Mercurial > vim
changeset 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 | 2b7c85de5c77 |
children | ec61183332b7 |
files | src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c |
diffstat | 3 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -6876,8 +6876,8 @@ f_search(typval_T *argvars, typval_T *re static void f_searchdecl(typval_T *argvars, typval_T *rettv) { - int locally = 1; - int thisblock = 0; + int locally = TRUE; + int thisblock = FALSE; int error = FALSE; char_u *name; @@ -6886,9 +6886,9 @@ f_searchdecl(typval_T *argvars, typval_T name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - locally = (int)tv_get_number_chk(&argvars[1], &error) == 0; + locally = !(int)tv_get_bool_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) - thisblock = (int)tv_get_number_chk(&argvars[2], &error) != 0; + thisblock = (int)tv_get_bool_chk(&argvars[2], &error); } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name),