jscript: Added ArrayInstance::on_put implementation.
This commit is contained in:
parent
06d19171be
commit
f2e7626c7a
|
@ -194,7 +194,23 @@ static void Array_destructor(DispatchEx *dispex)
|
|||
|
||||
static void Array_on_put(DispatchEx *dispex, const WCHAR *name)
|
||||
{
|
||||
FIXME("\n");
|
||||
ArrayInstance *array = (ArrayInstance*)dispex;
|
||||
const WCHAR *ptr = name;
|
||||
DWORD id = 0;
|
||||
|
||||
if(!isdigitW(*ptr))
|
||||
return;
|
||||
|
||||
while(*ptr && isdigitW(*ptr)) {
|
||||
id = id*10 + (*ptr-'0');
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if(*ptr)
|
||||
return;
|
||||
|
||||
if(id >= array->length)
|
||||
array->length = id+1;
|
||||
}
|
||||
|
||||
static const builtin_prop_t Array_props[] = {
|
||||
|
|
|
@ -28,6 +28,9 @@ 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\"");
|
||||
|
||||
arr["7"] = true;
|
||||
ok((arr.length === 8), "arr.length is not 8");
|
||||
|
||||
var arr = new Array(6);
|
||||
ok(typeof(arr) === "object", "arr (6) is not object");
|
||||
ok((arr.length === 6), "arr.length is not 6");
|
||||
|
|
Loading…
Reference in New Issue