Commit 9b74d6a9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added Number constructor implementation.

parent 8b13719c
......@@ -133,8 +133,44 @@ static const builtin_info_t Number_info = {
static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
VARIANT num;
HRESULT hres;
TRACE("\n");
switch(flags) {
case DISPATCH_CONSTRUCT: {
DispatchEx *obj;
switch(arg_cnt(dp)) {
case 0:
V_VT(&num) = VT_I4;
V_I4(&num) = 0;
break;
case 1:
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num);
if(FAILED(hres))
return hres;
break;
default:
FIXME("unimplemented args\n");
return E_NOTIMPL;
}
hres = create_number(dispex->ctx, &num, &obj);
if(FAILED(hres))
return hres;
V_VT(retv) = VT_DISPATCH;
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(obj);
break;
}
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT alloc_number(script_ctx_t *ctx, BOOL use_constr, NumberInstance **ret)
......
......@@ -84,4 +84,6 @@ ok(tmp === "1,2,,false,,,a", "arr.toString() = " + tmp);
tmp = arr.toString("test");
ok(tmp === "1,2,,false,,,a", "arr.toString() = " + tmp);
var num = new Number(2);
reportSuccess();
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