jscript: Added Array.length implementation.
This commit is contained in:
parent
9c25917e5d
commit
06d19171be
|
@ -51,8 +51,21 @@ static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','
|
|||
static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
ArrayInstance *This = (ArrayInstance*)dispex;
|
||||
|
||||
TRACE("%p %d\n", This, This->length);
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
V_VT(retv) = VT_I4;
|
||||
V_I4(retv) = This->length;
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Array_concat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
|
|
@ -18,16 +18,19 @@
|
|||
|
||||
var arr = new Array();
|
||||
ok(typeof(arr) === "object", "arr () is not object");
|
||||
ok((arr.length === 0), "arr.length is not 0");
|
||||
ok(arr["0"] === undefined, "arr[0] is not undefined");
|
||||
|
||||
var arr = new Array(1, 2, "test");
|
||||
ok(typeof(arr) === "object", "arr (1,2,test) is not object");
|
||||
ok((arr.length === 3), "arr.length is not 3");
|
||||
ok(arr["0"] === 1, "arr[0] is not 1");
|
||||
ok(arr["1"] === 2, "arr[1] is not 2");
|
||||
ok(arr["2"] === "test", "arr[2] is not \"test\"");
|
||||
|
||||
var arr = new Array(6);
|
||||
ok(typeof(arr) === "object", "arr (6) is not object");
|
||||
ok((arr.length === 6), "arr.length is not 6");
|
||||
ok(arr["0"] === undefined, "arr[0] is not undefined");
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue