diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-31 01:16:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:19 -0500 |
commit | 5c1a3defc6ba20fd833c99012c01195f39e515e6 (patch) | |
tree | 94df9d556d55660e5ca1f8b6c2040eda02f1af04 /source4/lib/ejs | |
parent | 6bdb915e275a90f3efc3e7c7bde003fa6aeaca05 (diff) | |
download | samba-5c1a3defc6ba20fd833c99012c01195f39e515e6.tar.gz samba-5c1a3defc6ba20fd833c99012c01195f39e515e6.tar.bz2 samba-5c1a3defc6ba20fd833c99012c01195f39e515e6.zip |
r7124: fixed a bug in array construction (see ECMA standard section 15.4.2.2)
(This used to be commit f9f1d85e651afca7a65804b3124daa11208965e8)
Diffstat (limited to 'source4/lib/ejs')
-rw-r--r-- | source4/lib/ejs/ejsProcs.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source4/lib/ejs/ejsProcs.c b/source4/lib/ejs/ejsProcs.c index 39df18ef94..b15985c8cf 100644 --- a/source4/lib/ejs/ejsProcs.c +++ b/source4/lib/ejs/ejsProcs.c @@ -171,7 +171,7 @@ static int arrayConsProc(EjsHandle eid, int argc, MprVar **argv) mprAssert(obj); - if (argc == 1) { + if (argc == 1 && mprVarIsNumber(argv[0]->type)) { /* * x = new Array(size); */ @@ -181,7 +181,7 @@ static int arrayConsProc(EjsHandle eid, int argc, MprVar **argv) mprItoa(i, idx, sizeof(idx)); mprCreateProperty(obj, idx, &undef); } - } else if (argc > 1) { + } else { /* * x = new Array(element0, element1, ..., elementN): */ @@ -190,9 +190,6 @@ static int arrayConsProc(EjsHandle eid, int argc, MprVar **argv) mprItoa(i, idx, sizeof(idx)); mprCreateProperty(obj, idx, argv[i]); } - - } else { - max = 0; } lp = mprCreatePropertyValue(obj, "length", mprCreateIntegerVar(max)); |