jscript: Add more jsdisp_t to Instance helpers.

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-09-22 10:00:36 +02:00 committed by Alexandre Julliard
parent 55f6e3c350
commit 7af3f65188
2 changed files with 19 additions and 4 deletions

View File

@ -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 */

View File

@ -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);