jscript: Added disp_delete helper and use it in interp_delete_ident.
This commit is contained in:
parent
6b56c65f8d
commit
e6fc8d9b0c
|
@ -1462,6 +1462,42 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
|
||||||
return delete_prop(prop);
|
return delete_prop(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
|
||||||
|
{
|
||||||
|
IDispatchEx *dispex;
|
||||||
|
jsdisp_t *jsdisp;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
||||||
|
if(jsdisp) {
|
||||||
|
dispex_prop_t *prop;
|
||||||
|
|
||||||
|
*ret = TRUE;
|
||||||
|
prop = get_prop(jsdisp, id);
|
||||||
|
if(prop)
|
||||||
|
hres = delete_prop(prop);
|
||||||
|
else
|
||||||
|
hres = DISP_E_MEMBERNOTFOUND;
|
||||||
|
|
||||||
|
jsdisp_release(jsdisp);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
*ret = FALSE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IDispatchEx_DeleteMemberByDispID(dispex, id);
|
||||||
|
IDispatchEx_Release(dispex);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
*ret = TRUE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT jsdisp_is_own_prop(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
|
HRESULT jsdisp_is_own_prop(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
|
||||||
{
|
{
|
||||||
dispex_prop_t *prop;
|
dispex_prop_t *prop;
|
||||||
|
|
|
@ -1648,9 +1648,8 @@ static HRESULT interp_delete(exec_ctx_t *ctx)
|
||||||
static HRESULT interp_delete_ident(exec_ctx_t *ctx)
|
static HRESULT interp_delete_ident(exec_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
const BSTR arg = get_op_bstr(ctx, 0);
|
const BSTR arg = get_op_bstr(ctx, 0);
|
||||||
IDispatchEx *dispex;
|
|
||||||
exprval_t exprval;
|
exprval_t exprval;
|
||||||
BOOL ret = FALSE;
|
BOOL ret;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("%s\n", debugstr_w(arg));
|
TRACE("%s\n", debugstr_w(arg));
|
||||||
|
@ -1665,16 +1664,10 @@ static HRESULT interp_delete_ident(exec_ctx_t *ctx)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = IDispatch_QueryInterface(exprval.u.idref.disp, &IID_IDispatchEx, (void**)&dispex);
|
hres = disp_delete(exprval.u.idref.disp, exprval.u.idref.id, &ret);
|
||||||
IDispatch_Release(exprval.u.idref.disp);
|
IDispatch_Release(exprval.u.idref.disp);
|
||||||
if(SUCCEEDED(hres)) {
|
if(FAILED(hres))
|
||||||
hres = IDispatchEx_DeleteMemberByDispID(dispex, exprval.u.idref.id);
|
return ret;
|
||||||
IDispatchEx_Release(dispex);
|
|
||||||
if(FAILED(hres))
|
|
||||||
return hres;
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return stack_push(ctx, jsval_bool(ret));
|
return stack_push(ctx, jsval_bool(ret));
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,6 +275,7 @@ HRESULT jsdisp_propput_idx(jsdisp_t*,DWORD,jsval_t) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_propget_name(jsdisp_t*,LPCWSTR,jsval_t*) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_propget_name(jsdisp_t*,LPCWSTR,jsval_t*) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_get_id(jsdisp_t*,const WCHAR*,DWORD,DISPID*) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_get_id(jsdisp_t*,const WCHAR*,DWORD,DISPID*) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT disp_delete(IDispatch*,DISPID,BOOL*) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_is_own_prop(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_is_own_prop(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
|
||||||
HRESULT jsdisp_is_enumerable(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
|
HRESULT jsdisp_is_enumerable(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue