Piotr Caban : jscript: Added Bool_valueOf implementation.
Alexandre Julliard
julliard at winehq.org
Mon Jul 6 09:33:59 CDT 2009
Module: wine
Branch: master
Commit: 4725b5698ceb7023879772f888e5cc1f8cf2df29
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4725b5698ceb7023879772f888e5cc1f8cf2df29
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Mon Jul 6 10:38:45 2009 +0200
jscript: Added Bool_valueOf implementation.
---
dlls/jscript/bool.c | 18 ++++++++++++++++--
dlls/jscript/tests/api.js | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c
index e7cf22f..c1cf297 100644
--- a/dlls/jscript/bool.c
+++ b/dlls/jscript/bool.c
@@ -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,
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index c789cc0..2e7f2d4 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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();
More information about the wine-cvs
mailing list