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
06064d22
Commit
06064d22
authored
Aug 29, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Make Array.push generic.
parent
5c819cb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
array.c
dlls/jscript/array.c
+33
-3
api.js
dlls/jscript/tests/api.js
+13
-0
No files found.
dlls/jscript/array.c
View file @
06064d22
...
...
@@ -46,6 +46,29 @@ static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0};
static
const
WCHAR
default_separatorW
[]
=
{
','
,
0
};
static
HRESULT
get_jsdisp_length
(
DispatchEx
*
obj
,
LCID
lcid
,
jsexcept_t
*
ei
,
DWORD
*
ret
)
{
VARIANT
var
;
HRESULT
hres
;
hres
=
jsdisp_propget_name
(
obj
,
lengthW
,
lcid
,
&
var
,
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_uint32
(
obj
->
ctx
,
&
var
,
ei
,
ret
);
VariantClear
(
&
var
);
return
hres
;
}
static
HRESULT
set_jsdisp_length
(
DispatchEx
*
obj
,
LCID
lcid
,
jsexcept_t
*
ei
,
DWORD
length
)
{
VARIANT
var
;
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
length
;
return
jsdisp_propput_name
(
obj
,
lengthW
,
lcid
,
&
var
,
ei
,
NULL
/*FIXME*/
);
}
static
HRESULT
Array_length
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
...
...
@@ -380,17 +403,24 @@ static HRESULT Array_push(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
if
(
dispex
->
builtin_info
->
class
==
JSCLASS_ARRAY
)
{
length
=
((
ArrayInstance
*
)
dispex
)
->
length
;
}
else
{
FIXME
(
"not Array this
\n
"
);
return
E_NOTIMPL
;
hres
=
get_jsdisp_length
(
dispex
,
lcid
,
ei
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
}
n
=
dp
->
cArgs
-
dp
->
cNamedArgs
;
n
=
arg_cnt
(
dp
)
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
dispex
,
length
+
i
,
lcid
,
get_arg
(
dp
,
i
),
ei
,
sp
);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
!
is_class
(
dispex
,
JSCLASS_ARRAY
))
{
hres
=
set_jsdisp_length
(
dispex
,
lcid
,
ei
,
length
+
n
);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
retv
)
{
V_VT
(
retv
)
=
VT_I4
;
V_I4
(
retv
)
=
length
+
n
;
...
...
dlls/jscript/tests/api.js
View file @
06064d22
...
...
@@ -492,6 +492,19 @@ ok(arr.push(true, 'b', false) === 10, "arr.push(true, 'b', false) !== 10");
ok
(
arr
[
8
]
===
"b"
,
"arr[8] != 'b'"
);
ok
(
arr
.
length
===
10
,
"arr.length != 10"
);
var
arr
=
new
Object
();
arr
.
push
=
Array
.
prototype
.
push
;
arr
.
length
=
6
;
ok
(
arr
.
push
()
===
6
,
"arr.push() !== 6"
);
ok
(
arr
.
push
(
1
)
===
7
,
"arr.push(1) !== 7"
);
ok
(
arr
[
6
]
===
1
,
"arr[6] != 1"
);
ok
(
arr
.
length
===
7
,
"arr.length != 10"
);
ok
(
arr
.
push
(
true
,
'b'
,
false
)
===
10
,
"arr.push(true, 'b', false) !== 10"
);
ok
(
arr
[
8
]
===
"b"
,
"arr[8] != 'b'"
);
ok
(
arr
.
length
===
10
,
"arr.length != 10"
);
arr
=
[
3
,
4
,
5
];
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
2
,
"arr.length = "
+
arr
.
length
);
...
...
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