jscript: Inherit some Boolean function from Object.
This commit is contained in:
parent
b1d0b1c739
commit
da6398dccd
|
@ -30,12 +30,7 @@ typedef struct {
|
|||
} BoolInstance;
|
||||
|
||||
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
|
||||
static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
|
||||
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
|
||||
static const WCHAR hasOwnPropertyW[] = {'h','a','s','O','w','n','P','r','o','p','e','r','t','y',0};
|
||||
static const WCHAR propertyIsEnumerableW[] =
|
||||
{'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
|
||||
static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
|
||||
|
||||
/* ECMA-262 3rd Edition 15.6.4.2 */
|
||||
static HRESULT Bool_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -66,13 +61,6 @@ static HRESULT Bool_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Bool_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
TRACE("\n");
|
||||
return Bool_toString(dispex, lcid, flags, dp, retv, ei, sp);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.6.4.3 */
|
||||
static HRESULT Bool_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
|
@ -92,27 +80,6 @@ static HRESULT Bool_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Bool_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Bool_propertyIsEnumerable(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Bool_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Bool_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
|
@ -131,10 +98,6 @@ static HRESULT Bool_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
|
|||
}
|
||||
|
||||
static const builtin_prop_t Bool_props[] = {
|
||||
{hasOwnPropertyW, Bool_hasOwnProperty, PROPF_METHOD},
|
||||
{isPrototypeOfW, Bool_isPrototypeOf, PROPF_METHOD},
|
||||
{propertyIsEnumerableW, Bool_propertyIsEnumerable, PROPF_METHOD},
|
||||
{toLocaleStringW, Bool_toLocaleString, PROPF_METHOD},
|
||||
{toStringW, Bool_toString, PROPF_METHOD},
|
||||
{valueOfW, Bool_valueOf, PROPF_METHOD}
|
||||
};
|
||||
|
@ -188,7 +151,7 @@ static HRESULT BoolConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT alloc_bool(script_ctx_t *ctx, BOOL use_constr, BoolInstance **ret)
|
||||
static HRESULT alloc_bool(script_ctx_t *ctx, DispatchEx *object_prototype, BoolInstance **ret)
|
||||
{
|
||||
BoolInstance *bool;
|
||||
HRESULT hres;
|
||||
|
@ -197,10 +160,10 @@ static HRESULT alloc_bool(script_ctx_t *ctx, BOOL use_constr, BoolInstance **ret
|
|||
if(!bool)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(use_constr)
|
||||
hres = init_dispex_from_constr(&bool->dispex, ctx, &Bool_info, ctx->bool_constr);
|
||||
if(object_prototype)
|
||||
hres = init_dispex(&bool->dispex, ctx, &Bool_info, object_prototype);
|
||||
else
|
||||
hres = init_dispex(&bool->dispex, ctx, &Bool_info, NULL);
|
||||
hres = init_dispex_from_constr(&bool->dispex, ctx, &Bool_info, ctx->bool_constr);
|
||||
|
||||
if(FAILED(hres)) {
|
||||
heap_free(bool);
|
||||
|
@ -211,12 +174,12 @@ static HRESULT alloc_bool(script_ctx_t *ctx, BOOL use_constr, BoolInstance **ret
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_bool_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||
HRESULT create_bool_constr(script_ctx_t *ctx, DispatchEx *object_prototype, DispatchEx **ret)
|
||||
{
|
||||
BoolInstance *bool;
|
||||
HRESULT hres;
|
||||
|
||||
hres = alloc_bool(ctx, FALSE, &bool);
|
||||
hres = alloc_bool(ctx, object_prototype, &bool);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
@ -231,7 +194,7 @@ HRESULT create_bool(script_ctx_t *ctx, VARIANT_BOOL b, DispatchEx **ret)
|
|||
BoolInstance *bool;
|
||||
HRESULT hres;
|
||||
|
||||
hres = alloc_bool(ctx, TRUE, &bool);
|
||||
hres = alloc_bool(ctx, NULL, &bool);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -758,7 +758,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, DispatchEx *object_prototype
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_bool_constr(ctx, &ctx->bool_constr);
|
||||
hres = create_bool_constr(ctx, object_prototype, &ctx->bool_constr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ HRESULT init_function_constr(script_ctx_t*,DispatchEx*);
|
|||
HRESULT create_object_prototype(script_ctx_t*,DispatchEx**);
|
||||
|
||||
HRESULT create_array_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_bool_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_bool_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
|
||||
HRESULT create_date_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
|
||||
HRESULT init_error_constr(script_ctx_t*);
|
||||
HRESULT create_number_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
|
||||
|
|
|
@ -1390,5 +1390,6 @@ testObjectInherit(new String("test"), false, true, false);
|
|||
testObjectInherit(/test/g, false, true, true);
|
||||
testObjectInherit(new Number(1), false, false, false);
|
||||
testObjectInherit(new Date(), false, false, false);
|
||||
testObjectInherit(new Boolean(true), false, true, false);
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue