mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibJS: Update Array.prototype.sort comments to align with implementation
This was fixed in the change-array-by-copy proposal. See: https://github.com/tc39/proposal-change-array-by-copy/commit/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,
|
||||
for (; j < item_count; ++j) {
|
||||
// a. Perform ? CreateDataPropertyOrThrow(obj, ! ToString(𝔽(j)), sortedList[j]).
|
||||
|
||||
// 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
|
||||
// a. Perform ? Set(obj, ! ToString(𝔽(j)), sortedList[j], true).
|
||||
TRY(object->set(j, sorted_list[j], Object::ShouldThrowExceptions::Yes));
|
||||
|
||||
// b. Set j to j + 1.
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue