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
80bd994b
Commit
80bd994b
authored
Oct 07, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Array.pop implementation.
parent
4783dd1e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
12 deletions
+94
-12
array.c
dlls/jscript/array.c
+57
-3
dispex.c
dlls/jscript/dispex.c
+15
-8
jscript.h
dlls/jscript/jscript.h
+1
-0
api.js
dlls/jscript/tests/api.js
+21
-1
No files found.
dlls/jscript/array.c
View file @
80bd994b
...
...
@@ -286,10 +286,64 @@ static HRESULT Array_join(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
}
static
HRESULT
Array_pop
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
VARIANT
val
;
DWORD
length
;
WCHAR
buf
[
14
];
DISPID
id
;
HRESULT
hres
;
static
const
WCHAR
formatW
[]
=
{
'%'
,
'd'
,
0
};
TRACE
(
"
\n
"
);
if
(
is_class
(
dispex
,
JSCLASS_ARRAY
))
{
ArrayInstance
*
array
=
(
ArrayInstance
*
)
dispex
;
length
=
array
->
length
;
}
else
{
FIXME
(
"not Array this
\n
"
);
return
E_NOTIMPL
;
}
if
(
!
length
)
{
if
(
retv
)
V_VT
(
retv
)
=
VT_EMPTY
;
return
S_OK
;
}
sprintfW
(
buf
,
formatW
,
--
length
);
hres
=
jsdisp_get_id
(
dispex
,
buf
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propget
(
dispex
,
id
,
lcid
,
&
val
,
ei
,
caller
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
IDispatchEx_DeleteMemberByDispID
(
_IDispatchEx_
(
dispex
),
id
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
V_VT
(
&
val
)
=
VT_EMPTY
;
hres
=
S_OK
;
}
else
{
return
hres
;
}
if
(
SUCCEEDED
(
hres
))
{
if
(
is_class
(
dispex
,
JSCLASS_ARRAY
))
{
ArrayInstance
*
array
=
(
ArrayInstance
*
)
dispex
;
array
->
length
=
length
;
}
}
if
(
FAILED
(
hres
))
{
VariantClear
(
&
val
);
return
hres
;
}
if
(
retv
)
*
retv
=
val
;
else
VariantClear
(
&
val
);
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.4.4.7 */
...
...
dlls/jscript/dispex.c
View file @
80bd994b
...
...
@@ -969,6 +969,20 @@ HRESULT jsdisp_propget_idx(DispatchEx *obj, DWORD idx, LCID lcid, VARIANT *var,
return
jsdisp_propget_name
(
obj
,
buf
,
lcid
,
var
,
ei
,
caller
);
}
HRESULT
jsdisp_propget
(
DispatchEx
*
jsdisp
,
DISPID
id
,
LCID
lcid
,
VARIANT
*
val
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
dispex_prop_t
*
prop
;
prop
=
get_prop
(
jsdisp
,
id
);
if
(
!
prop
)
return
DISP_E_MEMBERNOTFOUND
;
V_VT
(
val
)
=
VT_EMPTY
;
return
prop_get
(
jsdisp
,
prop
,
lcid
,
&
dp
,
val
,
ei
,
caller
);
}
HRESULT
disp_propget
(
IDispatch
*
disp
,
DISPID
id
,
LCID
lcid
,
VARIANT
*
val
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
...
...
@@ -978,14 +992,7 @@ HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
jsdisp
=
iface_to_jsdisp
((
IUnknown
*
)
disp
);
if
(
jsdisp
)
{
dispex_prop_t
*
prop
;
prop
=
get_prop
(
jsdisp
,
id
);
if
(
prop
)
hres
=
prop_get
(
jsdisp
,
prop
,
lcid
,
&
dp
,
val
,
ei
,
caller
);
else
hres
=
DISP_E_MEMBERNOTFOUND
;
hres
=
jsdisp_propget
(
jsdisp
,
id
,
lcid
,
val
,
ei
,
caller
);
IDispatchEx_Release
(
_IDispatchEx_
(
jsdisp
));
return
hres
;
}
...
...
dlls/jscript/jscript.h
View file @
80bd994b
...
...
@@ -125,6 +125,7 @@ HRESULT disp_call(IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,I
HRESULT
jsdisp_call_value
(
DispatchEx
*
,
LCID
,
WORD
,
DISPPARAMS
*
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
disp_propget
(
IDispatch
*
,
DISPID
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
disp_propput
(
IDispatch
*
,
DISPID
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propget
(
DispatchEx
*
,
DISPID
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propput_name
(
DispatchEx
*
,
const
WCHAR
*
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propput_idx
(
DispatchEx
*
,
DWORD
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propget_idx
(
DispatchEx
*
,
DWORD
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
...
...
dlls/jscript/tests/api.js
View file @
80bd994b
...
...
@@ -229,6 +229,26 @@ 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
);
ok
(
tmp
===
5
,
"pop() = "
+
tmp
);
tmp
=
arr
.
pop
(
2
);
ok
(
arr
.
length
===
1
,
"arr.length = "
+
arr
.
length
);
ok
(
tmp
===
4
,
"pop() = "
+
tmp
);
tmp
=
arr
.
pop
();
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
length
);
ok
(
tmp
===
3
,
"pop() = "
+
tmp
);
for
(
tmp
in
arr
)
ok
(
false
,
"not deleted "
+
tmp
);
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
);
ok
(
tmp
===
undefined
,
"tmp = "
+
tmp
);
arr
=
[
1
,
2
,
null
,
false
,
undefined
,,
"a"
];
tmp
=
arr
.
join
();
...
...
@@ -275,7 +295,7 @@ ok(tmp[6] === num, "tmp[6] !== num");
ok
(
tmp
.
length
===
7
,
"tmp.length = "
+
tmp
.
length
);
arr
=
[].
concat
();
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
l
r
ngth
);
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
l
e
ngth
);
arr
=
[
1
,];
tmp
=
arr
.
concat
([
2
]);
...
...
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