1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

r7124: fixed a bug in array construction (see ECMA standard section 15.4.2.2)

This commit is contained in:
Andrew Tridgell 2005-05-31 01:16:01 +00:00 committed by Gerald (Jerry) Carter
parent 277f26edac
commit f9f1d85e65

View File

@ -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));