Commit 7fa373e3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added to_object(VT_BOOL) implementation.

parent e7903ecf
......@@ -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;
}
......@@ -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*);
......
......@@ -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;
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment