jscript: Added to_object(VT_BOOL) implementation.
This commit is contained in:
parent
e7903ecfa9
commit
7fa373e364
|
@ -24,6 +24,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DispatchEx dispex;
|
DispatchEx dispex;
|
||||||
|
|
||||||
|
VARIANT_BOOL val;
|
||||||
} BoolInstance;
|
} BoolInstance;
|
||||||
|
|
||||||
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
|
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);
|
jsdisp_release(&bool->dispex);
|
||||||
return hres;
|
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_array(script_ctx_t*,DWORD,DispatchEx**);
|
||||||
HRESULT create_regexp_str(script_ctx_t*,const WCHAR*,DWORD,const WCHAR*,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_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_primitive(script_ctx_t*,VARIANT*,jsexcept_t*,VARIANT*);
|
||||||
HRESULT to_boolean(VARIANT*,VARIANT_BOOL*);
|
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));
|
IDispatch_AddRef(V_DISPATCH(v));
|
||||||
*disp = V_DISPATCH(v);
|
*disp = V_DISPATCH(v);
|
||||||
break;
|
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:
|
default:
|
||||||
FIXME("unsupported vt %d\n", V_VT(v));
|
FIXME("unsupported vt %d\n", V_VT(v));
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
|
|
@ -234,7 +234,10 @@ ok(tmp-- === 2, "tmp-- (2) is not 2");
|
||||||
ok(tmp === 1, "decremented tmp is not 1");
|
ok(tmp === 1, "decremented tmp is not 1");
|
||||||
|
|
||||||
String.prototype.test = true;
|
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 = "";
|
var state = "";
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue