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
91dcc245
Commit
91dcc245
authored
Jan 20, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Make Array.pop generic.
parent
9a9c075e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
26 deletions
+29
-26
array.c
dlls/jscript/array.c
+17
-26
api.js
dlls/jscript/tests/api.js
+12
-0
No files found.
dlls/jscript/array.c
View file @
91dcc245
...
...
@@ -372,52 +372,42 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
return
hres
;
}
static
HRESULT
Array_pop
(
script_ctx_t
*
ctx
,
vdisp_t
*
js
this
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
Array_pop
(
script_ctx_t
*
ctx
,
vdisp_t
*
v
this
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
DispatchEx
*
jsthis
;
VARIANT
val
;
DWORD
length
;
WCHAR
buf
[
14
];
DISPID
id
;
HRESULT
hres
;
static
const
WCHAR
formatW
[]
=
{
'%'
,
'd'
,
0
};
TRACE
(
"
\n
"
);
if
(
is_vclass
(
jsthis
,
JSCLASS_ARRAY
))
{
ArrayInstance
*
array
=
array_from_vdisp
(
jsthis
);
length
=
array
->
length
;
}
else
{
FIXME
(
"not Array this
\n
"
);
return
E_NOTIMPL
;
}
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
length
)
{
hres
=
set_length
(
jsthis
,
ei
,
0
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
V_VT
(
retv
)
=
VT_EMPTY
;
return
S_OK
;
}
sprintfW
(
buf
,
formatW
,
--
length
)
;
hres
=
jsdisp_
get_id
(
jsthis
->
u
.
jsdisp
,
buf
,
0
,
&
id
);
length
--
;
hres
=
jsdisp_
propget_idx
(
jsthis
,
length
,
&
val
,
ei
,
caller
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propget
(
jsthis
->
u
.
jsdisp
,
id
,
&
val
,
ei
,
caller
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
IDispatchEx_DeleteMemberByDispID
(
jsthis
->
u
.
dispex
,
id
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
jsdisp_delete_idx
(
jsthis
,
length
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
V_VT
(
&
val
)
=
VT_EMPTY
;
hres
=
S_OK
;
}
else
{
}
else
return
hres
;
}
if
(
SUCCEEDED
(
hres
))
{
ArrayInstance
*
array
=
array_from_vdisp
(
jsthis
);
array
->
length
=
length
;
}
if
(
SUCCEEDED
(
hres
))
hres
=
set_length
(
jsthis
,
ei
,
length
);
if
(
FAILED
(
hres
))
{
VariantClear
(
&
val
);
...
...
@@ -428,6 +418,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
*
retv
=
val
;
else
VariantClear
(
&
val
);
return
S_OK
;
}
...
...
dlls/jscript/tests/api.js
View file @
91dcc245
...
...
@@ -618,6 +618,12 @@ 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
.
pop
=
Array
.
prototype
.
pop
;
ok
(
arr
.
pop
()
===
false
,
"arr.pop() !== false"
);
ok
(
arr
[
8
]
===
"b"
,
"arr[8] !== 'b'"
);
ok
(
arr
.
pop
()
===
'b'
,
"arr.pop() !== 'b'"
);
ok
(
arr
[
8
]
===
undefined
,
"arr[8] !== undefined"
);
arr
=
[
3
,
4
,
5
];
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
2
,
"arr.length = "
+
arr
.
length
);
...
...
@@ -633,6 +639,11 @@ for(tmp in arr)
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
length
);
ok
(
tmp
===
undefined
,
"tmp = "
+
tmp
);
arr
=
new
Object
();
arr
.
pop
=
Array
.
prototype
.
pop
;
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
length
);
ok
(
tmp
===
undefined
,
"tmp = "
+
tmp
);
arr
=
[,,,,,];
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
5
,
"arr.length = "
+
arr
.
length
);
...
...
@@ -1891,6 +1902,7 @@ testArrayHostThis("splice");
testArrayHostThis
(
"unshift"
);
testArrayHostThis
(
"reverse"
);
testArrayHostThis
(
"join"
);
testArrayHostThis
(
"pop"
);
function
testObjectInherit
(
obj
,
constr
,
ts
,
tls
,
vo
)
{
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