jscript: Added Bool_valueOf implementation.

This commit is contained in:
Piotr Caban 2009-07-06 10:38:45 +02:00 committed by Alexandre Julliard
parent 1e72bc8718
commit 4725b5698c
2 changed files with 17 additions and 2 deletions

View File

@ -74,11 +74,25 @@ static HRESULT Bool_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DI
return E_NOTIMPL;
}
/* 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)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
if(!is_class(dispex, JSCLASS_BOOLEAN)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(retv) {
BoolInstance *bool = (BoolInstance*)dispex;
V_VT(retv) = VT_BOOL;
V_BOOL(retv) = bool->val;
}
return S_OK;
}
static HRESULT Bool_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,

View File

@ -1084,5 +1084,6 @@ var bool = new Boolean();
ok(bool.toString() === "false", "bool.toString() = " + bool.toString());
var bool = new Boolean("false");
ok(bool.toString() === "true", "bool.toString() = " + bool.toString());
ok(bool.valueOf() === Boolean(1), "bool.valueOf() = " + bool.valueOf());
reportSuccess();