mirror of
https://github.com/RGBCube/serenity
synced 2025-07-12 20:47:35 +00:00
LibJS: Update Array.prototype.sort comments to align with implementation
This was fixed in the change-array-by-copy proposal. See:
60823eb
This commit is contained in:
parent
b89aced2e3
commit
a8d532c4fe
1 changed files with 1 additions and 14 deletions
|
@ -1582,21 +1582,8 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort)
|
||||||
|
|
||||||
// 9. Repeat, while j < itemCount,
|
// 9. Repeat, while j < itemCount,
|
||||||
for (; j < item_count; ++j) {
|
for (; j < item_count; ++j) {
|
||||||
// a. Perform ? CreateDataPropertyOrThrow(obj, ! ToString(𝔽(j)), sortedList[j]).
|
// a. Perform ? Set(obj, ! ToString(𝔽(j)), sortedList[j], true).
|
||||||
|
|
||||||
// FIXME: Spec issue: The above step should likely be:
|
|
||||||
//
|
|
||||||
// Perform ? Set(obj, ! ToString(𝔽(j)), items[j], true).
|
|
||||||
//
|
|
||||||
// That is the behavior of SortIndexedProperties in ECMA-262, and about a dozen test262
|
|
||||||
// tests will failed if CreateDataPropertyOrThrow is used instead. For example,
|
|
||||||
// test/built-ins/Array/prototype/sort/precise-getter-appends-elements.js fails in
|
|
||||||
// CreateDataPropertyOrThrow because the Array object is configurable but the property
|
|
||||||
// created by Object.defineProperty is not.
|
|
||||||
//
|
|
||||||
// See: https://github.com/tc39/proposal-change-array-by-copy/issues/97
|
|
||||||
TRY(object->set(j, sorted_list[j], Object::ShouldThrowExceptions::Yes));
|
TRY(object->set(j, sorted_list[j], Object::ShouldThrowExceptions::Yes));
|
||||||
|
|
||||||
// b. Set j to j + 1.
|
// b. Set j to j + 1.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue