Commit 53e831e2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added Number function implementation.

parent c3e2a6f9
......@@ -167,6 +167,23 @@ static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
if(!arg_cnt(dp)) {
if(retv) {
V_VT(retv) = VT_I4;
V_I4(retv) = 0;
}
return S_OK;
}
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num);
if(FAILED(hres))
return hres;
if(retv)
*retv = num;
break;
case DISPATCH_CONSTRUCT: {
DispatchEx *obj;
......
......@@ -89,4 +89,8 @@ ok(num.toString() === "2", "num(2).toString !== 2");
var num = new Number();
ok(num.toString() === "0", "num().toString !== 0");
ok(Number() === 0, "Number() = " + Number());
ok(Number(false) === 0, "Number(false) = " + Number(false));
ok(Number("43") === 43, "Number('43') = " + Number("43"));
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