Matter fix introspect.contains (#20685)

This commit is contained in:
s-hadinger 2024-02-08 02:42:21 +01:00 committed by GitHub
parent 715914bdd0
commit a5e3391ca8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -665,6 +665,7 @@ BERRY_API bbool be_copy(bvm *vm, int index)
} }
/* `onlyins` limits the search to instance, and discards module. Makes sure getmethod does not return anything for module. */ /* `onlyins` limits the search to instance, and discards module. Makes sure getmethod does not return anything for module. */
/* may return BE_NONE */
static int ins_member(bvm *vm, int index, const char *k, bbool onlyins) static int ins_member(bvm *vm, int index, const char *k, bbool onlyins)
{ {
int type = BE_NIL; int type = BE_NIL;
@ -681,12 +682,12 @@ static int ins_member(bvm *vm, int index, const char *k, bbool onlyins)
bmodule *module = var_toobj(o); bmodule *module = var_toobj(o);
type = be_module_attr(vm, module, be_newstr(vm, k), top); type = be_module_attr(vm, module, be_newstr(vm, k), top);
} }
return type == BE_NONE ? BE_NIL : type; return type;
} }
BERRY_API bbool be_getmember(bvm *vm, int index, const char *k) BERRY_API bbool be_getmember(bvm *vm, int index, const char *k)
{ {
return ins_member(vm, index, k, bfalse) != BE_NIL; return ins_member(vm, index, k, bfalse) != BE_NONE;
} }
BERRY_API bbool be_getmethod(bvm *vm, int index, const char *k) BERRY_API bbool be_getmethod(bvm *vm, int index, const char *k)