jscript: Make Array.slice generic.

This commit is contained in:
Jacek Caban 2009-09-02 12:25:39 +02:00 committed by Alexandre Julliard
parent 00644c5449
commit f39d5e46d9
2 changed files with 12 additions and 2 deletions

View File

@ -456,8 +456,9 @@ static HRESULT Array_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
if(is_class(dispex, 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;
}
if(arg_cnt(dp)) {

View File

@ -628,6 +628,15 @@ arr[12] = 2;
ok(arr.slice(5).toString() === "a,,,,,,,2", "arr.slice(5).toString() = " + arr.slice(5).toString());
ok(arr.slice(5).length === 8, "arr.slice(5).length = " + arr.slice(5).length);
obj = new Object();
obj.length = 3;
obj[0] = 1;
obj[1] = 2;
obj[2] = 3;
tmp = Array.prototype.slice.call(obj, 1, 2);
ok(tmp.length === 1, "tmp.length = " + tmp.length);
ok(tmp[0] === 2, "tmp[0] = " + tmp[0]);
var num = new Number(2);
ok(num.toString() === "2", "num(2).toString !== 2");
var num = new Number();