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.prototype.toReversed #19

Merged
merged 1 commit into from Nov 7, 2023

Conversation

bnoordhuis
Copy link
Contributor

No description provided.

if (JS_IsException(arr))
goto exception;

if (len > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to return early here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I copied this pattern from elsewhere in this file and I kind of agree with it because it means fewer calls to JS_FreeValue(). I try hard to keep the reference counting in one place, otherwise it's too easy to screw up.

If you don't like the indent level, I could change it to a goto.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point about the consistency. LGTM!

@bnoordhuis bnoordhuis merged commit a3a57fe into quickjs-ng:master Nov 7, 2023
7 checks passed
@bnoordhuis bnoordhuis deleted the array-p-toreversed branch November 7, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants