jscript: Use enum to pass enumeration type to jsdisp_next_prop.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-04-20 19:11:56 +02:00 committed by Alexandre Julliard
parent 1917fe0e07
commit c4948c428a
3 changed files with 12 additions and 7 deletions

View File

@ -1700,7 +1700,7 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex,
TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
hres = jsdisp_next_prop(This, id, FALSE, pid);
hres = jsdisp_next_prop(This, id, JSDISP_ENUM_ALL, pid);
if(hres == S_FALSE)
*pid = DISPID_STARTENUM;
return hres;
@ -2366,12 +2366,12 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
return S_OK;
}
HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_type, DISPID *ret)
{
dispex_prop_t *iter;
HRESULT hres;
if(id == DISPID_STARTENUM && !own_only) {
if(id == DISPID_STARTENUM && enum_type == JSDISP_ENUM_ALL) {
hres = fill_protrefs(obj);
if(FAILED(hres))
return hres;
@ -2383,7 +2383,7 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
for(iter = &obj->props[id + 1]; iter < obj->props + obj->prop_cnt; iter++) {
if(!iter->name || iter->type == PROP_DELETED)
continue;
if(own_only && iter->type == PROP_PROTREF)
if(enum_type != JSDISP_ENUM_ALL && iter->type == PROP_PROTREF)
continue;
if(!(get_flags(obj, iter) & PROPF_ENUMERABLE))
continue;

View File

@ -290,6 +290,11 @@ void jsdisp_release(jsdisp_t*) DECLSPEC_HIDDEN;
#endif
enum jsdisp_enum_type {
JSDISP_ENUM_ALL,
JSDISP_ENUM_OWN_ENUMERABLE
};
HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN;
HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN;
@ -315,7 +320,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_define_data_property(jsdisp_t*,const WCHAR*,unsigned,jsval_t) DECLSPEC_HIDDEN;
HRESULT jsdisp_next_prop(jsdisp_t*,DISPID,BOOL,DISPID*) DECLSPEC_HIDDEN;
HRESULT jsdisp_next_prop(jsdisp_t*,DISPID,enum jsdisp_enum_type,DISPID*) DECLSPEC_HIDDEN;
HRESULT jsdisp_get_prop_name(jsdisp_t*,DISPID,jsstr_t**);
void jsdisp_freeze(jsdisp_t*,BOOL) DECLSPEC_HIDDEN;
BOOL jsdisp_is_frozen(jsdisp_t*,BOOL) DECLSPEC_HIDDEN;

View File

@ -404,7 +404,7 @@ static HRESULT jsdisp_define_properties(script_ctx_t *ctx, jsdisp_t *obj, jsval_
}
while(1) {
hres = jsdisp_next_prop(list_obj, id, TRUE, &id);
hres = jsdisp_next_prop(list_obj, id, JSDISP_ENUM_OWN_ENUMERABLE, &id);
if(hres != S_OK)
break;
@ -652,7 +652,7 @@ static HRESULT Object_keys(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return hres;
do {
hres = jsdisp_next_prop(obj, id, TRUE, &id);
hres = jsdisp_next_prop(obj, id, JSDISP_ENUM_OWN_ENUMERABLE, &id);
if(hres != S_OK)
break;