Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

enhanced enum support for sort_unnamed_constructors_first #3248

Merged
merged 2 commits into from
Feb 25, 2022

Conversation

pq
Copy link
Contributor

@pq pq commented Feb 24, 2022

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 95.608% when pulling 50c6cc6 on sort_unnamed_constructors_first_enums into dbb7b11 on master.

// Sort members by offset.
var members = node.members.toList()
var members = classMembers.toList()
..sort((ClassMember m1, ClassMember m2) => m1.offset - m2.offset);
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't think of this on the last PR, but I'm kind of surprised that we need to sort the members. I thought we already returned them in source order. Not critical, but it would improve performance to not make a pass confirming that everything is already sorted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting! I've made a note to loop back and check on this. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it may be interesting to use a SplayTreeSet instead to keep always the order within the data structure?

@pq pq merged commit 0a4f39c into master Feb 25, 2022
@pq pq deleted the sort_unnamed_constructors_first_enums branch February 25, 2022 00:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

enhanced enums support for sort_unnamed_constructors_first
4 participants