Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f30de9b9
Commit
f30de9b9
authored
Oct 17, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Number.valueOf implementation.
parent
7526b880
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
number.c
dlls/jscript/number.c
+17
-12
api.js
dlls/jscript/tests/api.js
+9
-0
No files found.
dlls/jscript/number.c
View file @
f30de9b9
...
...
@@ -105,8 +105,18 @@ static HRESULT Number_toPrecision(DispatchEx *dispex, LCID lcid, WORD flags, DIS
static
HRESULT
Number_valueOf
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
TRACE
(
"
\n
"
);
if
(
!
is_class
(
dispex
,
JSCLASS_NUMBER
))
{
FIXME
(
"throw TypeError
\n
"
);
return
E_FAIL
;
}
if
(
retv
)
{
NumberInstance
*
number
=
(
NumberInstance
*
)
dispex
;
*
retv
=
number
->
num
;
}
return
S_OK
;
}
static
HRESULT
Number_hasOwnProperty
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
@@ -198,19 +208,13 @@ static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
case
DISPATCH_CONSTRUCT
:
{
DispatchEx
*
obj
;
switch
(
arg_cnt
(
dp
))
{
case
0
:
V_VT
(
&
num
)
=
VT_I4
;
V_I4
(
&
num
)
=
0
;
break
;
case
1
:
if
(
arg_cnt
(
dp
))
{
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
;
}
else
{
V_VT
(
&
num
)
=
VT_I4
;
V_I4
(
&
num
)
=
0
;
}
hres
=
create_number
(
dispex
->
ctx
,
&
num
,
&
obj
);
...
...
@@ -258,6 +262,7 @@ HRESULT create_number_constr(script_ctx_t *ctx, DispatchEx **ret)
if
(
FAILED
(
hres
))
return
hres
;
V_VT
(
&
number
->
num
)
=
VT_I4
;
hres
=
create_builtin_function
(
ctx
,
NumberConstr_value
,
PROPF_CONSTR
,
&
number
->
dispex
,
ret
);
jsdisp_release
(
&
number
->
dispex
);
...
...
dlls/jscript/tests/api.js
View file @
f30de9b9
...
...
@@ -362,6 +362,15 @@ ok(Number() === 0, "Number() = " + Number());
ok
(
Number
(
false
)
===
0
,
"Number(false) = "
+
Number
(
false
));
ok
(
Number
(
"43"
)
===
43
,
"Number('43') = "
+
Number
(
"43"
));
tmp
=
(
new
Number
(
1
)).
valueOf
();
ok
(
tmp
===
1
,
"(new Number(1)).valueOf = "
+
tmp
);
tmp
=
(
new
Number
(
1
,
2
)).
valueOf
();
ok
(
tmp
===
1
,
"(new Number(1,2)).valueOf = "
+
tmp
);
tmp
=
(
new
Number
()).
valueOf
();
ok
(
tmp
===
0
,
"(new Number()).valueOf = "
+
tmp
);
tmp
=
Number
.
prototype
.
valueOf
();
ok
(
tmp
===
0
,
"Number.prototype.valueOf = "
+
tmp
);
tmp
=
Math
.
min
(
1
);
ok
(
tmp
===
1
,
"Math.min(1) = "
+
tmp
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment