Commit 7af3f651 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

jscript: Add more jsdisp_t to Instance helpers.

parent 55f6e3c3
......@@ -34,15 +34,25 @@ typedef struct {
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
static inline BoolInstance *bool_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, BoolInstance, dispex);
}
static inline BoolInstance *bool_from_vdisp(vdisp_t *vdisp)
{
return bool_from_jsdisp(vdisp->u.jsdisp);
}
static inline BoolInstance *bool_this(vdisp_t *jsthis)
{
return is_vclass(jsthis, JSCLASS_BOOLEAN) ? (BoolInstance*)jsthis->u.jsdisp : NULL;
return is_vclass(jsthis, JSCLASS_BOOLEAN) ? bool_from_vdisp(jsthis) : NULL;
}
BOOL bool_obj_value(jsdisp_t *obj)
{
assert(is_class(obj, JSCLASS_BOOLEAN));
return ((BoolInstance*)obj)->val;
return bool_from_jsdisp(obj)->val;
}
/* ECMA-262 3rd Edition 15.6.4.2 */
......
......@@ -34,9 +34,14 @@ static const WCHAR lboundW[] = {'l','b','o','u','n','d',0};
static const WCHAR toArrayW[] = {'t','o','A','r','r','a','y',0};
static const WCHAR uboundW[] = {'u','b','o','u','n','d',0};
static inline VBArrayInstance *vbarray_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, VBArrayInstance, dispex);
}
static inline VBArrayInstance *vbarray_from_vdisp(vdisp_t *vdisp)
{
return CONTAINING_RECORD(vdisp->u.jsdisp, VBArrayInstance, dispex);
return vbarray_from_jsdisp(vdisp->u.jsdisp);
}
static inline VBArrayInstance *vbarray_this(vdisp_t *jsthis)
......@@ -236,7 +241,7 @@ static HRESULT VBArray_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
static void VBArray_destructor(jsdisp_t *dispex)
{
VBArrayInstance *vbarray = (VBArrayInstance*)dispex;
VBArrayInstance *vbarray = vbarray_from_jsdisp(dispex);
SafeArrayDestroy(vbarray->safearray);
heap_free(vbarray);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment