forked from aniani/vim
patch 8.2.1615: Vim9: cannot pass "true" to searchdecl()
Problem: Vim9: cannot pass "true" to searchdecl(). Solution: use tv_get_bool_chk(). (closes #6881)
This commit is contained in:
@@ -6876,8 +6876,8 @@ f_search(typval_T *argvars, typval_T *rettv)
|
|||||||
static void
|
static void
|
||||||
f_searchdecl(typval_T *argvars, typval_T *rettv)
|
f_searchdecl(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
int locally = 1;
|
int locally = TRUE;
|
||||||
int thisblock = 0;
|
int thisblock = FALSE;
|
||||||
int error = FALSE;
|
int error = FALSE;
|
||||||
char_u *name;
|
char_u *name;
|
||||||
|
|
||||||
@@ -6886,9 +6886,9 @@ f_searchdecl(typval_T *argvars, typval_T *rettv)
|
|||||||
name = tv_get_string_chk(&argvars[0]);
|
name = tv_get_string_chk(&argvars[0]);
|
||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
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)
|
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)
|
if (!error && name != NULL)
|
||||||
rettv->vval.v_number = find_decl(name, (int)STRLEN(name),
|
rettv->vval.v_number = find_decl(name, (int)STRLEN(name),
|
||||||
|
|||||||
@@ -1547,6 +1547,10 @@ def Test_searchcount()
|
|||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_searchdecl()
|
||||||
|
assert_equal(1, searchdecl('blah', true, true))
|
||||||
|
enddef
|
||||||
|
|
||||||
def Fibonacci(n: number): number
|
def Fibonacci(n: number): number
|
||||||
if n < 2
|
if n < 2
|
||||||
return n
|
return n
|
||||||
|
|||||||
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1615,
|
||||||
/**/
|
/**/
|
||||||
1614,
|
1614,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user