Jacek Caban : jscript: Added ArrayInstance::on_put implementation.
Alexandre Julliard
julliard at winehq.org
Tue Sep 16 06:54:20 CDT 2008
Module: wine
Branch: master
Commit: f2e7626c7a24c1c927b9469fa29cef55689ef894
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f2e7626c7a24c1c927b9469fa29cef55689ef894
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 15 20:37:46 2008 +0200
jscript: Added ArrayInstance::on_put implementation.
---
dlls/jscript/array.c | 18 +++++++++++++++++-
dlls/jscript/tests/api.js | 3 +++
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 65097be..c131865 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -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[] = {
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index e874027..eed48dc 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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");
More information about the wine-cvs
mailing list