To: vim_dev@googlegroups.com Subject: Patch 8.2.1615 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1615 Problem: Vim9: cannot pass "true" to searchdecl(). Solution: use tv_get_bool_chk(). (closes #6881) Files: src/evalfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1614/src/evalfunc.c 2020-09-05 20:29:35.748679383 +0200 --- src/evalfunc.c 2020-09-05 21:34:16.116113543 +0200 *************** *** 6876,6883 **** static void f_searchdecl(typval_T *argvars, typval_T *rettv) { ! int locally = 1; ! int thisblock = 0; int error = FALSE; char_u *name; --- 6876,6883 ---- static void f_searchdecl(typval_T *argvars, typval_T *rettv) { ! int locally = TRUE; ! int thisblock = FALSE; int error = FALSE; char_u *name; *************** *** 6886,6894 **** name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! locally = (int)tv_get_number_chk(&argvars[1], &error) == 0; if (!error && argvars[2].v_type != VAR_UNKNOWN) ! thisblock = (int)tv_get_number_chk(&argvars[2], &error) != 0; } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name), --- 6886,6894 ---- name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! locally = !(int)tv_get_bool_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) ! thisblock = (int)tv_get_bool_chk(&argvars[2], &error); } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name), *** ../vim-8.2.1614/src/testdir/test_vim9_func.vim 2020-09-05 21:21:12.221502139 +0200 --- src/testdir/test_vim9_func.vim 2020-09-05 21:32:24.804332669 +0200 *************** *** 1547,1552 **** --- 1547,1556 ---- bwipe! enddef + def Test_searchdecl() + assert_equal(1, searchdecl('blah', true, true)) + enddef + def Fibonacci(n: number): number if n < 2 return n *** ../vim-8.2.1614/src/version.c 2020-09-05 21:21:12.221502139 +0200 --- src/version.c 2020-09-05 21:34:57.416030820 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1615, /**/ -- GUEST: He's killed the best man! SECOND GUEST: (holding a limp WOMAN) He's killed my auntie. FATHER: No, please! This is supposed to be a happy occasion! Let's not bicker and argue about who killed who ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///