Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Array findLast and findLastIndex #1665

Merged
merged 3 commits into from
Oct 23, 2021

Conversation

bsinky
Copy link
Contributor

@bsinky bsinky commented Oct 13, 2021

This Pull Request closes #1654.

It changes the following:

  • Implements Array.prototype.findLast
  • Implements Array.prototype.findLastIndex.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Just some small nitpicks that are easily solvable. Everything else looks good!

boa/src/builtins/array/mod.rs Outdated Show resolved Hide resolved
boa/src/builtins/array/mod.rs Outdated Show resolved Hide resolved
@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Oct 13, 2021
@jedel1043 jedel1043 added this to the v0.14.0 milestone Oct 13, 2021
@jedel1043
Copy link
Member

Test262 conformance changes:

Test result main count PR count difference
Total 86,438 86,438 0
Passed 37,764 37,814 +50
Ignored 19,022 19,022 0
Failed 29,652 29,602 -50
Panics 0 0 0
Conformance 43.69% 43.75% +0.06%
Fixed tests (50):
test/built-ins/Array/prototype/findLastIndex/predicate-called-for-each-array-property.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/predicate-called-for-each-array-property.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/name.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/name.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/predicate-not-called-on-empty-array.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/predicate-not-called-on-empty-array.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-this-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-this-length.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-negative-one-if-predicate-returns-false-value.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-negative-one-if-predicate-returns-false-value.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-property.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-property.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/length.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-index-predicate-result-is-true.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-index-predicate-result-is-true.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-predicate-call.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/return-abrupt-from-predicate-call.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/prop-desc.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/prop-desc.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/array-altered-during-loop.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/array-altered-during-loop.js (previously Failed)
test/built-ins/Array/prototype/findLastIndex/predicate-call-this-strict.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/call-with-boolean.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLastIndex/call-with-boolean.js (previously Failed)
test/built-ins/Array/prototype/findLast/predicate-called-for-each-array-property.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/predicate-called-for-each-array-property.js (previously Failed)
test/built-ins/Array/prototype/findLast/name.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/name.js (previously Failed)
test/built-ins/Array/prototype/findLast/predicate-not-called-on-empty-array.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/predicate-not-called-on-empty-array.js (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-this-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-this-length.js (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-property.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-property.js (previously Failed)
test/built-ins/Array/prototype/findLast/length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/length.js (previously Failed)
test/built-ins/Array/prototype/findLast/return-undefined-if-predicate-returns-false-value.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/return-undefined-if-predicate-returns-false-value.js (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-predicate-call.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/return-abrupt-from-predicate-call.js (previously Failed)
test/built-ins/Array/prototype/findLast/prop-desc.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/prop-desc.js (previously Failed)
test/built-ins/Array/prototype/findLast/array-altered-during-loop.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/array-altered-during-loop.js (previously Failed)
test/built-ins/Array/prototype/findLast/return-found-value-predicate-result-is-true.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/return-found-value-predicate-result-is-true.js (previously Failed)
test/built-ins/Array/prototype/findLast/predicate-call-this-strict.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/call-with-boolean.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/findLast/call-with-boolean.js (previously Failed)

@bsinky
Copy link
Contributor Author

bsinky commented Oct 13, 2021

Thanks for the suggestions! They should all be updated now. I left the comments as-is, the implementation is different but at least they show how it matches up with the proposal.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Looks good to me 😁

boa/src/builtins/array/mod.rs Outdated Show resolved Hide resolved
@RageKnify RageKnify merged commit b7858c1 into boa-dev:main Oct 23, 2021
@bsinky bsinky deleted the array-findlast branch October 23, 2021 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Array.prototype.findLast and Array.prototype.findLastIndex
6 participants