Jacek Caban : jscript: Added to_object(VT_BOOL) implementation.
Alexandre Julliard
julliard at winehq.org
Wed Sep 17 07:14:46 CDT 2008
Module: wine
Branch: master
Commit: 7fa373e364320369eed110f51baad7639be4a8e0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7fa373e364320369eed110f51baad7639be4a8e0
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Sep 16 20:45:29 2008 +0200
jscript: Added to_object(VT_BOOL) implementation.
---
dlls/jscript/bool.c | 17 +++++++++++++++++
dlls/jscript/jscript.h | 1 +
dlls/jscript/jsutils.c | 7 +++++++
dlls/jscript/tests/lang.js | 5 ++++-
4 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c
index a98a4ff..1add8ef 100644
--- a/dlls/jscript/bool.c
+++ b/dlls/jscript/bool.c
@@ -24,6 +24,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
DispatchEx dispex;
+
+ VARIANT_BOOL val;
} BoolInstance;
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
@@ -145,3 +147,18 @@ HRESULT create_bool_constr(script_ctx_t *ctx, DispatchEx **ret)
jsdisp_release(&bool->dispex);
return hres;
}
+
+HRESULT create_bool(script_ctx_t *ctx, VARIANT_BOOL b, DispatchEx **ret)
+{
+ BoolInstance *bool;
+ HRESULT hres;
+
+ hres = alloc_bool(ctx, TRUE, &bool);
+ if(FAILED(hres))
+ return hres;
+
+ bool->val = b;
+
+ *ret = &bool->dispex;
+ return S_OK;
+}
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index a098b82..8f14e63 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -134,6 +134,7 @@ HRESULT create_math(script_ctx_t*,DispatchEx**);
HRESULT create_array(script_ctx_t*,DWORD,DispatchEx**);
HRESULT create_regexp_str(script_ctx_t*,const WCHAR*,DWORD,const WCHAR*,DWORD,DispatchEx**);
HRESULT create_string(script_ctx_t*,const WCHAR*,DWORD,DispatchEx**);
+HRESULT create_bool(script_ctx_t*,VARIANT_BOOL,DispatchEx**);
HRESULT to_primitive(script_ctx_t*,VARIANT*,jsexcept_t*,VARIANT*);
HRESULT to_boolean(VARIANT*,VARIANT_BOOL*);
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index 2b0c31e..01b0ef7 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -264,6 +264,13 @@ HRESULT to_object(exec_ctx_t *ctx, VARIANT *v, IDispatch **disp)
IDispatch_AddRef(V_DISPATCH(v));
*disp = V_DISPATCH(v);
break;
+ case VT_BOOL:
+ hres = create_bool(ctx->parser->script, V_BOOL(v), &dispex);
+ if(FAILED(hres))
+ return hres;
+
+ *disp = (IDispatch*)_IDispatchEx_(dispex);
+ break;
default:
FIXME("unsupported vt %d\n", V_VT(v));
return E_NOTIMPL;
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index e4c4a2c..3ca57c0 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -234,7 +234,10 @@ ok(tmp-- === 2, "tmp-- (2) is not 2");
ok(tmp === 1, "decremented tmp is not 1");
String.prototype.test = true;
-ok("".test === true, "\"\",test is not true");
+ok("".test === true, "\"\".test is not true");
+
+Boolean.prototype.test = true;
+ok(true.test === true, "true.test is not true");
var state = "";
try {
More information about the wine-cvs
mailing list