Commit 864ebf14 authored by olehougaard's avatar olehougaard

Fixed use of undefined in ArraySort.

Changed 'undefined' in ArraySort to 'void 0'. Also added regression test to catch the error.
Review URL: http://codereview.chromium.org/6073

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@406 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e61b8034
......@@ -743,7 +743,7 @@ function ArraySort(comparefn) {
if (IS_UNDEFINED(this[i])) {
length--;
this[i] = this[length];
this[length] = undefined;
this[length] = void 0;
} else {
i++;
}
......
......@@ -131,3 +131,12 @@ function TestArraySortingWithHoles() {
}
TestArraySortingWithHoles();
// Test array sorting with undefined elemeents in the array.
function TestArraySortingWithUndefined() {
var a = [3, void 0, 2];
a.sort();
assertArrayEquals([ 2, 3, void 0], a);
}
TestArraySortingWithUndefined();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment