[INFER] Handle non-array arguments to Array.concat, bug 617750.

This commit is contained in:
Brian Hackett 2010-12-13 11:15:56 -08:00
parent 36bc0fe646
commit c4c526a2cb
2 changed files with 9 additions and 0 deletions

View File

@ -5,3 +5,6 @@ x[1] = 2;
x[2] = 3;
var y = x.concat();
assertEq(y[3], undefined);
var z = x.concat(/abc/).pop();
assertEq(x.source, "abc");

View File

@ -2595,6 +2595,12 @@ array_concat(JSContext *cx, uintN argc, Value *vp)
}
}
/*
* The type handler for Array.concat only handles array arguments.
* Inform type inference of any non-array arguments passed in.
*/
cx->addTypePropertyId(ntype, JSID_VOID, v);
if (!SetArrayElement(cx, nobj, length, v))
return false;
length++;