Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6f618936
Commit
6f618936
authored
Jan 15, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added implementation of Array.reverse.
parent
e6edbc45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
2 deletions
+61
-2
array.c
dlls/jscript/array.c
+35
-2
api.js
dlls/jscript/tests/api.js
+26
-0
No files found.
dlls/jscript/array.c
View file @
6f618936
...
@@ -469,8 +469,41 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
...
@@ -469,8 +469,41 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
static
HRESULT
Array_reverse
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
Array_reverse
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
{
FIXME
(
"
\n
"
);
DispatchEx
*
jsthis
;
return
E_NOTIMPL
;
DWORD
length
,
k
,
l
;
VARIANT
v1
,
v2
;
HRESULT
hres1
,
hres2
;
TRACE
(
"
\n
"
);
hres1
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres1
))
return
hres1
;
for
(
k
=
0
;
k
<
length
/
2
;
k
++
)
{
l
=
length
-
k
-
1
;
hres1
=
jsdisp_propget_idx
(
jsthis
,
k
,
&
v1
,
ei
,
sp
);
hres2
=
jsdisp_propget_idx
(
jsthis
,
l
,
&
v2
,
ei
,
sp
);
if
(
hres1
==
DISP_E_UNKNOWNNAME
)
jsdisp_delete_idx
(
jsthis
,
l
);
else
jsdisp_propput_idx
(
jsthis
,
l
,
&
v1
,
ei
,
sp
);
if
(
hres2
==
DISP_E_UNKNOWNNAME
)
jsdisp_delete_idx
(
jsthis
,
k
);
else
jsdisp_propput_idx
(
jsthis
,
k
,
&
v2
,
ei
,
sp
);
}
if
(
retv
)
{
V_VT
(
retv
)
=
VT_DISPATCH
;
V_DISPATCH
(
retv
)
=
(
IDispatch
*
)
_IDispatchEx_
(
jsthis
);
IDispatch_AddRef
(
V_DISPATCH
(
retv
));
}
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.4.4.9 */
/* ECMA-262 3rd Edition 15.4.4.9 */
...
...
dlls/jscript/tests/api.js
View file @
6f618936
...
@@ -688,6 +688,31 @@ ok(arr.valueOf === Object.prototype.valueOf, "arr.valueOf !== Object.prototype.v
...
@@ -688,6 +688,31 @@ ok(arr.valueOf === Object.prototype.valueOf, "arr.valueOf !== Object.prototype.v
ok
(
arr
===
arr
.
valueOf
(),
"arr !== arr.valueOf"
);
ok
(
arr
===
arr
.
valueOf
(),
"arr !== arr.valueOf"
);
arr
=
[
1
,
2
,
3
];
arr
=
[
1
,
2
,
3
];
tmp
=
arr
.
reverse
();
ok
(
tmp
===
arr
,
"tmp !== arr"
);
ok
(
arr
.
length
===
3
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"3,2,1"
,
"arr.toString() = "
+
arr
.
toString
());
arr
=
[];
arr
[
3
]
=
5
;
arr
[
5
]
=
1
;
tmp
=
arr
.
reverse
();
ok
(
tmp
===
arr
,
"tmp !== arr"
);
ok
(
arr
.
length
===
6
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"1,,5,,,"
,
"arr.toString() = "
+
arr
.
toString
());
arr
=
new
Object
();
arr
.
length
=
3
;
arr
[
0
]
=
"aa"
;
arr
[
2
]
=
2
;
arr
[
7
]
=
3
;
arr
.
reverse
=
Array
.
prototype
.
reverse
;
tmp
=
arr
.
reverse
();
ok
(
tmp
===
arr
,
"tmp !== arr"
);
ok
(
arr
.
length
===
3
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
[
0
]
===
2
&&
arr
[
1
]
===
undefined
&&
arr
[
2
]
===
"aa"
,
"unexpected array"
);
arr
=
[
1
,
2
,
3
];
tmp
=
arr
.
unshift
(
0
);
tmp
=
arr
.
unshift
(
0
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
4
),
"[1,2,3].unshift(0) returned "
+
tmp
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
4
),
"[1,2,3].unshift(0) returned "
+
tmp
);
ok
(
arr
.
length
===
4
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
length
===
4
,
"arr.length = "
+
arr
.
length
);
...
@@ -1854,6 +1879,7 @@ testArrayHostThis("shift");
...
@@ -1854,6 +1879,7 @@ testArrayHostThis("shift");
testArrayHostThis
(
"slice"
);
testArrayHostThis
(
"slice"
);
testArrayHostThis
(
"splice"
);
testArrayHostThis
(
"splice"
);
testArrayHostThis
(
"unshift"
);
testArrayHostThis
(
"unshift"
);
testArrayHostThis
(
"reverse"
);
function
testObjectInherit
(
obj
,
constr
,
ts
,
tls
,
vo
)
{
function
testObjectInherit
(
obj
,
constr
,
ts
,
tls
,
vo
)
{
ok
(
obj
instanceof
Object
,
"obj is not instance of Object"
);
ok
(
obj
instanceof
Object
,
"obj is not instance of Object"
);
...
...
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